Tomographer  v1.0a
Tomographer C++ Framework Documentation
Tomographer::UniformBinsHistogramWithErrorBars< Scalar_, CountType_ > Struct Template Reference

Stores a histogram along with error bars. More...

#include <tomographer/histogram.h>

+ Inheritance diagram for Tomographer::UniformBinsHistogramWithErrorBars< Scalar_, CountType_ >:
+ Collaboration diagram for Tomographer::UniformBinsHistogramWithErrorBars< Scalar_, CountType_ >:

Public Types

typedef Scalar_ Scalar
 The Scalar (X-axis) Type. See UniformBinsHistogram<Scalar_,CountType_>::Scalar.
 
typedef CountType_ CountType
 The Type used to keep track of counts. See UniformBinsHistogram<Scalar_,CountType_>::CountType.
 
typedef UniformBinsHistogram< Scalar_, CountType_ > Base_
 Shortcut for our base class type.
 
typedef Base_::Params Params
 Shortcut for our base class' histogram parameters. See UniformBinsHistogram<typename Scalar_, typename CountType_>::Params.
 
- Public Types inherited from Tomographer::UniformBinsHistogram< Scalar_, CountType_ >
typedef Scalar_ Scalar
 The scalar type of the "X"-axis of the histogram (usually double)
 
typedef CountType_ CountType
 The type that serves to count how many hits in each bin.
 

Public Member Functions

 UniformBinsHistogramWithErrorBars (Params params=Params())
 Constructor, with given histogram parameters. More...
 
 UniformBinsHistogramWithErrorBars (Scalar min, Scalar max, std::size_t num_bins)
 Constructor, with given histogram parameters. More...
 
void reset ()
 Resets the histogram to zero counts everywhere, and zero error bars. More...
 
CountType errorbar (std::size_t i) const
 For the Histogram Interface. Get error bar for bin number i. More...
 
std::string pretty_print (int max_width=0) const
 Print the histogram in human readable form. More...
 
- Public Member Functions inherited from Tomographer::UniformBinsHistogram< Scalar_, CountType_ >
 UniformBinsHistogram (Params p=Params())
 Constructor: stores the parameters and initializes the histogram to zero counts everywhere.
 
 UniformBinsHistogram (Scalar min_, Scalar max_, std::size_t num_bins)
 Constructor: stores the parameters and initializes the histogram to zero counts everywhere.
 
template<typename HistogramType >
 UniformBinsHistogram (const HistogramType &other)
 Constructor: copy another histogram type.
 
void reset ()
 Resets the histogram to zero counts everywhere.
 
template<typename EigenType >
void load (const Eigen::DenseBase< EigenType > &x, CountType off_chart_=0)
 Load data for the histogram. Uses current histogram parameters, just sets the bin counts. More...
 
template<typename EigenType >
void add (const Eigen::ArrayBase< EigenType > &x, CountType off_chart_=0)
 Add data to the histogram. More...
 
template<typename OtherScalar , typename OtherCountType >
void add (const UniformBinsHistogram< OtherScalar, OtherCountType > &x)
 Add data to the histogram. More...
 
std::size_t num_bins () const
 Shorthand for params.num_bins
 
CountType count (std::size_t i) const
 Shorthand for bins(i)
 
bool is_within_bounds (Scalar value) const
 Shorthand for params.is_within_bounds(value)
 
std::size_t bin_index (Scalar value) const
 Shorthand for params.bin_index(value)
 
Scalar bin_lower_value (int index) const
 Shorthand for params.bin_lower_value(index)
 
Scalar bin_center_value (std::size_t index) const
 Shorthand for params.bin_center_value(index)
 
Scalar bin_upper_value (std::size_t index) const
 Shorthand for params.bin_upper_value(index)
 
Scalar bin_resolution () const
 Shorthand for params.bin_resolution()
 
std::size_t record (Scalar value)
 Record a new value in the histogram. More...
 
std::size_t record (Scalar value, CountType weight)
 Record a new value in the histogram, with a certain weight. More...
 
std::string pretty_print (int max_width=0) const
 Pretty-print the histogram and return it as a string with horizontal bars. More...
 

Public Attributes

Eigen::Array< CountType, Eigen::Dynamic, 1 > delta
 The error bars associated with each histogram bin.
 
- Public Attributes inherited from Tomographer::UniformBinsHistogram< Scalar_, CountType_ >
Params params
 Parameters of this histogram (range and # of bins)
 
Eigen::Array< CountType, Eigen::Dynamic, 1 > bins
 The counts for each bin.
 
CountType off_chart
 The number of points that fell outside of the given range.
 

Static Public Attributes

static constexpr bool HasErrorBars = true
 For the Histogram Interface. This type of histogram does provide error bars.
 
- Static Public Attributes inherited from Tomographer::UniformBinsHistogram< Scalar_, CountType_ >
static constexpr bool HasErrorBars = false
 This histogram type does not provide error bars (see Histogram Interface)
 

Detailed Description

template<typename Scalar_, typename CountType_ = double>
struct Tomographer::UniformBinsHistogramWithErrorBars< Scalar_, CountType_ >

Stores a histogram along with error bars.

Builds on top of UniformBinsHistogram<Scalar,CountType> to store error bars corresponding to each bin.

Definition at line 385 of file histogram.h.

Constructor & Destructor Documentation

template<typename Scalar_, typename CountType_ = double>
Tomographer::UniformBinsHistogramWithErrorBars< Scalar_, CountType_ >::UniformBinsHistogramWithErrorBars ( Params  params = Params())
inline

Constructor, with given histogram parameters.

Constructs an empty histogram with the given parameters. All bin counts, off-chart counts and delta error bars are initialized to zero.

Definition at line 415 of file histogram.h.

template<typename Scalar_, typename CountType_ = double>
Tomographer::UniformBinsHistogramWithErrorBars< Scalar_, CountType_ >::UniformBinsHistogramWithErrorBars ( Scalar  min,
Scalar  max,
std::size_t  num_bins 
)
inline

Constructor, with given histogram parameters.

Constructs an empty histogram with the given parameters. All bin counts, off-chart counts and delta error bars are initialized to zero.

Definition at line 425 of file histogram.h.

Member Function Documentation

template<typename Scalar_, typename CountType_ = double>
CountType Tomographer::UniformBinsHistogramWithErrorBars< Scalar_, CountType_ >::errorbar ( std::size_t  i) const
inline

For the Histogram Interface. Get error bar for bin number i.

This simply returns delta(i).

Definition at line 447 of file histogram.h.

template<typename Scalar_, typename CountType_ = double>
std::string Tomographer::UniformBinsHistogramWithErrorBars< Scalar_, CountType_ >::pretty_print ( int  max_width = 0) const
inline

Print the histogram in human readable form.

Returns a string which can be e.g. printed to the terminal, which produces a visual representation of the histogram.

Parameters
max_widththe maximum line length the displayed histogram should fit in.

Definition at line 459 of file histogram.h.

template<typename Scalar_, typename CountType_ = double>
void Tomographer::UniformBinsHistogramWithErrorBars< Scalar_, CountType_ >::reset ( )
inline

Resets the histogram to zero counts everywhere, and zero error bars.

Warning
the corresponding base class has NO virtual methods. So don't see this class inheritance as object polymorphism. If you need to reset a uniform bins histogram with error bars, you need to know its type.

Definition at line 436 of file histogram.h.


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