tttrlib
A library for time-tagged time resolved data
Loading...
Searching...
No Matches
Classes | Functions
HistogramAxis.h File Reference
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <map>
#include <cmath>

Go to the source code of this file.

Classes

class  HistogramAxis< T >
 

Functions

template<typename T >
void linspace (double start, double stop, T *bin_edges, int n_bins)
 
template<typename T >
void logspace (double start, double stop, T *bin_edges, int n_bins)
 
template<typename T >
int search_bin_idx (T value, T *bin_edges, int n_bins)
 
template<typename T >
int calc_bin_idx (T begin, T bin_width, T value)
 

Function Documentation

◆ calc_bin_idx()

template<typename T >
int calc_bin_idx ( T begin,
T bin_width,
T value )
inline

Calculates for a linear axis the bin index for a particular value.

Template Parameters
T
Parameters
begin
bin_width
value
Returns

◆ linspace()

template<typename T >
void linspace ( double start,
double stop,
T * bin_edges,
int n_bins )
inline

◆ logspace()

template<typename T >
void logspace ( double start,
double stop,
T * bin_edges,
int n_bins )
inline

◆ search_bin_idx()

template<typename T >
int search_bin_idx ( T value,
T * bin_edges,
int n_bins )
inline

Searches for the bin index of a value within a list of bin edges

If a value is inside the bounds find the bin. The search partitions the bin_edges in upper and lower ranges and adapts the edge for the upper and lower range depending if the target value is bigger or smaller than the bin in the middle.

Template Parameters
T
Parameters
value
bin_edges
n_bins
Returns
negative value if the search value is out of the bounds. Otherwise the bin number is returned.