Tomographer
v5.4
Tomographer C++ Framework Documentation
|
Histogram aggregator, if each histogram doesn't have error bars. More...
#include <tomographer/histogram.h>
Public Types | |
typedef HistogramType_ | HistogramType |
The histogram type corresponding to the result of a task. More... | |
typedef HistogramType::Params | HistogramParams |
The parameters type used to describe our histogram range and number of bins. | |
typedef HistogramType::Scalar | HistogramScalarType |
The scalar type of the histogram (i.e., x-axis labels) | |
typedef CountRealType_ | CountRealType |
Type used for averaged histogram counts (e.g. double) | |
typedef AveragedHistogram< HistogramType, CountRealType > | FinalHistogramType |
The type of the final resulting, averaged histogram. More... | |
Public Member Functions | |
AggregatedHistogramSimple (AggregatedHistogramSimple &&x) | |
AggregatedHistogramSimple (FinalHistogramType &&x) | |
void | printHistogramCsv (std::ostream &stream, const std::string sep="\, const std::string linesep="\", const int precision=10) |
Produce a comma-separated-value (CSV) representation of the final aggregated histogram data. More... | |
Static Public Member Functions | |
template<typename ContainerType , typename ExtractHistogramFn > | |
static AggregatedHistogramSimple | aggregate (const HistogramParams ¶ms, const ContainerType &list, ExtractHistogramFn extract_histogram_fn) |
Aggregate a list of histograms. More... | |
Public Attributes | |
FinalHistogramType | final_histogram |
The final histogram, with error bars. | |
Histogram aggregator, if each histogram doesn't have error bars.
This class takes care of combining histograms together into a final, averaged histogram with error bars, using a AveragedHistogram. The error bars are simply determined from the standard deviation of the different histograms.
The only advantage of this class over using a AveragedHistogram directly is that you can aggregate a list of histograms in one call, see aggregate(). It also provides a very similar API to AggregatedHistogramWithErrorBars.
If you're using the Tomographer::MHRWTasks::ValueHistogramTools tools, note that you can directly get the right HistogramAggregator type by calling the method CDataBase::aggregateResultHistograms() using your MHRandomWalkCData class deriving from Tomographer::MHRWTasks::ValueHistogramTools::CDataBase.
Use the static aggregate() function to construct an object instance, aggregating histograms from a list.
Definition at line 1063 of file histogram.h.
typedef AveragedHistogram<HistogramType, CountRealType> Tomographer::AggregatedHistogramSimple< HistogramType_, CountRealType_ >::FinalHistogramType |
The type of the final resulting, averaged histogram.
Definition at line 1089 of file histogram.h.
typedef HistogramType_ Tomographer::AggregatedHistogramSimple< HistogramType_, CountRealType_ >::HistogramType |
The histogram type corresponding to the result of a task.
Definition at line 1073 of file histogram.h.
|
inlinestatic |
Aggregate a list of histograms.
Construct a AggregatedHistogramWithErrorBars by aggregating a list of histograms given as list. The list might contain more complicated objects from which the relevant histogram is to be extracted, the callable extract_histogram_fn is called to extract the histogram. For instance, list may be a list of run task results which contain a histogram (among other info).
params | The histogram parameters to initialize the final histogram with. |
list | The list of objects from which to extract a histogram. This should be some container type; the only requirement is that one should be able to iterate over it with a range-for loop with a "const auto&" item. |
extract_histogram_fn | A callable which is called for each item of the list; it is provided a single argument, the list item, and is expected to return the histogram which will be aggregated with the others. |
See also Tomographer::MHRWTasks::ValueHistogramTools::CDataBase::aggregateResultHistograms()
Definition at line 1132 of file histogram.h.
|
inline |
Produce a comma-separated-value (CSV) representation of the final aggregated histogram data.
The histogram data is written in CSV format on the C++ output stream stream. You may specify the cell separator sep (by default a TAB char), the line separator (by default a simple newline), and the precision used when exporting the values. Numbers are written in scientific format (e.g. 1.205115485e-01
).
Three columns are outputted. Titles are outputted on the first line ("Value", "Counts" and "Error"). The first column holds the values, i.e., the x-axis of the histogram; the second column holds the counts (normalized to the number of samples); the third column the error bar on the counts.
Definition at line 1163 of file histogram.h.