Tomographer  v5.3
Tomographer C++ Framework Documentation
Tomographer::HistogramParams< Scalar_ > Struct Template Reference

The parameters of a Histogram. More...

#include <tomographer/histogram.h>

+ Inheritance diagram for Tomographer::HistogramParams< Scalar_ >:
+ Collaboration diagram for Tomographer::HistogramParams< Scalar_ >:

Public Types

typedef Scalar_ Scalar
 The scalar type used to specify the "value" (horizongal axis) of the histogram.
 

Public Member Functions

 HistogramParams (Scalar min_=0.0, Scalar max_=1.0, Eigen::Index num_bins_=50)
 The obvious constructor.
 
template<typename Params2 >
 HistogramParams (const Params2 &other)
 Copy constructor, from any other Histogram::Params type.
 
bool isWithinBounds (Scalar value) const
 Tests whether the given value is in the range of the histogram. More...
 
Eigen::Index binIndex (Scalar value) const
 Returns which bin this value should be counted in (index in the histogram's bins array) More...
 
Eigen::Index binIndexUnsafe (Scalar value) const
 Returns which bin this value should be counted in. More...
 
Scalar binLowerValue (Eigen::Index index) const
 Returns the value which a given bin index represents (lower bin value limit) More...
 
Scalar binCenterValue (Eigen::Index index) const
 Returns the value which a given bin index represents (center bin value) More...
 
Scalar binUpperValue (Eigen::Index index) const
 Returns the value which a given bin index represents (upper bin value limit) More...
 
Scalar binResolution () const
 Returns the width of a bin. More...
 
Eigen::Array< Scalar, Eigen::Dynamic, 1 > valuesCenter () const
 Return an array of values corresponding to the center of each bin.
 
Eigen::Array< Scalar, Eigen::Dynamic, 1 > valuesLower () const
 Return an array of values corresponding to the lower value of each bin.
 
Eigen::Array< Scalar, Eigen::Dynamic, 1 > valuesUpper () const
 Return an array of values corresponding to the upper value of each bin.
 

Public Attributes

Scalar min
 Lower range value.
 
Scalar max
 Upper range value.
 
Eigen::Index num_bins
 Number of bins to split the range into.
 

Detailed Description

template<typename Scalar_ = double>
struct Tomographer::HistogramParams< Scalar_ >

The parameters of a Histogram.

This is the \([\text{min},\text{max}]\) range along with the number of bins.

Since
Since Tomographer 5.3, this class can be serialized with Boost.Serialization.

Definition at line 72 of file histogram.h.

Member Function Documentation

§ binCenterValue()

template<typename Scalar_ = double>
Scalar Tomographer::HistogramParams< Scalar_ >::binCenterValue ( Eigen::Index  index) const
inline

Returns the value which a given bin index represents (center bin value)

This is the value at the center of the bin.

Note
The index must be valid, i.e. index >= 0 && index < num_bins, or you might get an assert() failure in your face.

Definition at line 157 of file histogram.h.

§ binIndex()

template<typename Scalar_ = double>
Eigen::Index Tomographer::HistogramParams< Scalar_ >::binIndex ( Scalar  value) const
inline

Returns which bin this value should be counted in (index in the histogram's bins array)

Note
Raises std::out_of_range if the value is not in the range \( [\text{min},\text{max}[ \).

Definition at line 117 of file histogram.h.

§ binIndexUnsafe()

template<typename Scalar_ = double>
Eigen::Index Tomographer::HistogramParams< Scalar_ >::binIndexUnsafe ( Scalar  value) const
inline

Returns which bin this value should be counted in.

This function blindly assumes its argument is within bounds, i.e. it must satisfy isWithinBounds(value).

Use this function only if you're sure the value is within bounds, otherwise call binIndex().

Definition at line 133 of file histogram.h.

§ binLowerValue()

template<typename Scalar_ = double>
Scalar Tomographer::HistogramParams< Scalar_ >::binLowerValue ( Eigen::Index  index) const
inline

Returns the value which a given bin index represents (lower bin value limit)

This is the value at the left edge of the bin.

Note
The index must be valid, i.e. index >= 0 && index < num_bins, or you might get an assert() failure in your face.

Definition at line 145 of file histogram.h.

§ binResolution()

template<typename Scalar_ = double>
Scalar Tomographer::HistogramParams< Scalar_ >::binResolution ( ) const
inline

Returns the width of a bin.

This is simply (max - min) / num_bins.

Definition at line 179 of file histogram.h.

§ binUpperValue()

template<typename Scalar_ = double>
Scalar Tomographer::HistogramParams< Scalar_ >::binUpperValue ( Eigen::Index  index) const
inline

Returns the value which a given bin index represents (upper bin value limit)

This is the value at the right edge of the bin.

Note
The index must be valid, i.e. index >= 0 && index < num_bins, or you might get an assert() failure in your face.

Definition at line 170 of file histogram.h.

§ isWithinBounds()

template<typename Scalar_ = double>
bool Tomographer::HistogramParams< Scalar_ >::isWithinBounds ( Scalar  value) const
inline

Tests whether the given value is in the range of the histogram.

Returns
true if value is finite (not inf or nan) and within the interval \([\text{min},\text{max}[\).

Definition at line 107 of file histogram.h.


The documentation for this struct was generated from the following file: