Tomographer
v4.0
Tomographer C++ Framework Documentation
|
Results collector, if binning analysis is being used. More...
#include <tomographer/mhrw_valuehist_tasks.h>
Public Types | |
typedef CDataBaseType_ | CDataBaseType |
The structure which hold the constant shared data describing what we have to do. | |
typedef CDataBaseType::ValueCalculator | ValueCalculator |
The class which calculates the value we are collecting a histogram of (ValueCalculator Interface compliant) | |
typedef CDataBaseType::CountRealType | CountRealType |
The real type which serves to average histogram counts (typically double ) | |
typedef CDataBaseType::IterCountIntType | IterCountIntType |
The integer type which serves to count the number of iterations (see MHRWParams) | |
typedef CDataBaseType::StepRealType | StepRealType |
The real type which serves to describe the step size of the random walk (typically double ) | |
typedef LoggerType_ | LoggerType |
The logger type we can send messages to. | |
typedef tomo_internal::histogram_types< CDataBaseType_, true >::BinningMHRWStatsCollectorParams | BinningMHRWStatsCollectorParams |
The parameters for the relevant ValueHistogramWithBinningMHRWStatsCollector. More... | |
typedef BinningMHRWStatsCollectorParams::BinningAnalysisParamsType | BinningAnalysisParamsType |
The parameters for the corresponding BinningAnalysis type. More... | |
typedef BinningMHRWStatsCollectorParams::Result | MHRWStatsCollectorResultType |
The result type of our stats collector. More... | |
typedef CDataBaseType::HistogramType | HistogramType |
The histogram type reported by each task. More... | |
typedef CDataBaseType::HistogramParams | HistogramParams |
The histogram parameters type reported by each task. More... | |
typedef AveragedHistogram< HistogramType, CountRealType > | FinalHistogramType |
The final histogram, properly averaged. | |
typedef UniformBinsHistogram< typename HistogramType::Scalar, CountRealType > | SimpleScaledHistogramType |
The "simple" histogram, as if without binning analysis. More... | |
typedef AveragedHistogram< SimpleScaledHistogramType, double > | SimpleFinalHistogramType |
Properly averaged "simple" histogram, with naive statistical standard deviation error bars from the several task runs. | |
typedef MHRandomWalkTaskResult< MHRWStatsCollectorResultType, IterCountIntType, StepRealType > | RunTaskResult |
Stores information about the result of a task run. More... | |
typedef std::vector< RunTaskResult * > | RunTaskResultList |
A list which will store the result of each task. | |
Public Member Functions | |
ResultsCollectorWithBinningAnalysis (LoggerType &logger_) | |
Constructor. More... | |
bool | isFinalized () const |
Returns TRUE after all runs have finished and results processed. More... | |
FinalHistogramType | finalHistogram () const |
The final histogram, with all the error bars combined. More... | |
SimpleFinalHistogramType | simpleFinalHistogram () const |
The final histogram, with naive error bars ignoring the binning analysis. More... | |
std::size_t | numTasks () const |
Return the number of tasks that were run. More... | |
const RunTaskResultList & | collectedRunTaskResults () const |
Return a list of the resulting report of each run task. More... | |
const RunTaskResult * | collectedRunTaskResult (std::size_t task_no) const |
Return a list of the resulting report of one specific run task. More... | |
template<typename RealType = double> | |
void | printHistogramCsv (std::ostream &stream, std::string sep="\, std::string linesep="\", int precision=10) |
Produce a comma-separated-value (CSV) representation of the final histogram. More... | |
void | printFinalReport (std::ostream &str, const CDataBaseType &cdata, int max_width=0, bool print_histogram=true) |
Produce a final, human-readable report of the whole procedure. More... | |
template<typename Cnt , typename CData > | |
void | init (Cnt num_total_runs, Cnt, const CData *pcdata) |
In compliance with ResultsCollector Interface. | |
template<typename Cnt , typename TaskResultType , typename CData > | |
void | collectResult (Cnt task_no, TaskResultType &&taskresult, const CData *) |
In compliance with ResultsCollector Interface. | |
template<typename Cnt , typename CData > | |
void | runsFinished (Cnt, const CData *) |
In compliance with ResultsCollector Interface. | |
Results collector, if binning analysis is being used.
This class takes care of collecting the results of the executed random walk tasks, and merges them together to provide a final, averaged histogram with error bars.
This class complies with the ResultsCollector Interface.
This class is to be used in conjunction with Tomographer::MHRWTasks::MHRandomWalkTask and a const-shared-data structure inheriting from Tomographer::MHRWTasks::ValueHistogramTasks::CData and complying with the MHRandomWalkTaskCData Interface.
This results collector should only be used if each task provides a histogram with error bars which come from a binning analysis (with ValueHistogramWithBinningMHRWStatsCollector). If you have tasks which give you "raw" histogram without any error bars, you should use the class ResultsCollectorSimple.
In fact, we provide two final histograms. One has the error bars from the binning analyses combined together from ech task, providing reliable error bars if the error analysis converged in each task. For the other histogram, we simply average the "raw" histograms from each task, ignoring the binning analysis completely, and determining error bars as the standard deviation from the different runs, as for the simple case with ResultsCollectorSimple. This allows to compare the error bars from the binning analysis to the naive statistical error bars resulting from many trials. You do need enough tasks, though, to have a reliable "naive" estimate of the error bars.
Note that you can directly get the right ResultsCollector type by querying the type "CDataBase::ResultsCollectorType<..>::Type".
Definition at line 479 of file mhrw_valuehist_tasks.h.
typedef BinningMHRWStatsCollectorParams::BinningAnalysisParamsType Tomographer::MHRWTasks::ValueHistogramTasks::ResultsCollectorWithBinningAnalysis< CDataBaseType_, LoggerType_ >::BinningAnalysisParamsType |
The parameters for the corresponding BinningAnalysis type.
This is a BinningAnalysisParams type.
Definition at line 510 of file mhrw_valuehist_tasks.h.
typedef tomo_internal::histogram_types<CDataBaseType_,true>::BinningMHRWStatsCollectorParams Tomographer::MHRWTasks::ValueHistogramTasks::ResultsCollectorWithBinningAnalysis< CDataBaseType_, LoggerType_ >::BinningMHRWStatsCollectorParams |
The parameters for the relevant ValueHistogramWithBinningMHRWStatsCollector.
This is a ValueHistogramWithBinningMHRWStatsCollectorParams type.
Definition at line 504 of file mhrw_valuehist_tasks.h.
typedef CDataBaseType::HistogramParams Tomographer::MHRWTasks::ValueHistogramTasks::ResultsCollectorWithBinningAnalysis< CDataBaseType_, LoggerType_ >::HistogramParams |
The histogram parameters type reported by each task.
This is ValueHistogramWithBinningMHRWStatsCollectorParams::HistogramParams.
Definition at line 529 of file mhrw_valuehist_tasks.h.
typedef CDataBaseType::HistogramType Tomographer::MHRWTasks::ValueHistogramTasks::ResultsCollectorWithBinningAnalysis< CDataBaseType_, LoggerType_ >::HistogramType |
The histogram type reported by each task.
This is ValueHistogramWithBinningMHRWStatsCollectorParams::HistogramType.
Definition at line 524 of file mhrw_valuehist_tasks.h.
typedef BinningMHRWStatsCollectorParams::Result Tomographer::MHRWTasks::ValueHistogramTasks::ResultsCollectorWithBinningAnalysis< CDataBaseType_, LoggerType_ >::MHRWStatsCollectorResultType |
The result type of our stats collector.
This is a structure containing a histogram with error bars, along with a convergence analysis of the errors. It is a ValueHistogramWithBinningMHRWStatsCollectorResult type.
Definition at line 518 of file mhrw_valuehist_tasks.h.
typedef MHRandomWalkTaskResult<MHRWStatsCollectorResultType,IterCountIntType,StepRealType> Tomographer::MHRWTasks::ValueHistogramTasks::ResultsCollectorWithBinningAnalysis< CDataBaseType_, LoggerType_ >::RunTaskResult |
Stores information about the result of a task run.
This structure is precisely the type that the task itself returns; see MHRandomWalkTaskResult.
Definition at line 551 of file mhrw_valuehist_tasks.h.
typedef UniformBinsHistogram<typename HistogramType::Scalar, CountRealType> Tomographer::MHRWTasks::ValueHistogramTasks::ResultsCollectorWithBinningAnalysis< CDataBaseType_, LoggerType_ >::SimpleScaledHistogramType |
The "simple" histogram, as if without binning analysis.
Note we need a real (e.g. double) counting type, because the histograms we'll be recording are scaled.
Definition at line 539 of file mhrw_valuehist_tasks.h.
|
inline |
Constructor.
Messages will be logged to the given logger.
Definition at line 562 of file mhrw_valuehist_tasks.h.
|
inline |
Return a list of the resulting report of one specific run task.
The result (i.e. the individual task's final report) is stored in a RunTaskResult structure, which is simply a MHRandomWalkTaskResult type.
task_no | must be an index such that task_no >= 0 && task_no < numTasks() . |
You may only call this function after the results have been finalized (see isFinalized()), i.e. after the task dispatcher has finished executing all tasks.
Definition at line 652 of file mhrw_valuehist_tasks.h.
|
inline |
Return a list of the resulting report of each run task.
The result (i.e. the individual task's final report) is stored in a RunTaskResult structure, which is simply a MHRandomWalkTaskResult type.
You may only call this function after the results have been finalized (see isFinalized()), i.e. after the task dispatcher has finished executing all tasks.
Definition at line 636 of file mhrw_valuehist_tasks.h.
|
inline |
The final histogram, with all the error bars combined.
The error bars are calculated by combining the error bars obtained via a binning analysis for each task. See the page Averaged Histogram for how this is calculated.
The scale of the histogram is chosen such that each bin value corresponds to the fraction of data points observed in this bin. To normalize the histogram to a unit probability density, use UniformBinsHistogram::normalized().
Definition at line 596 of file mhrw_valuehist_tasks.h.
|
inline |
Returns TRUE
after all runs have finished and results processed.
Note that it is the task of the multiprocessing task dispatcher (e.g. MultiProc::OMP::TaskDispatcher::run) to finalize the results, as required by the Multiprocessing Task Interfaces API).
Definition at line 584 of file mhrw_valuehist_tasks.h.
|
inline |
Return the number of tasks that were run.
You may only call this function after the results have been finalized (see isFinalized()), i.e. after the task dispatcher has finished executing all tasks.
Definition at line 623 of file mhrw_valuehist_tasks.h.
|
inline |
Produce a final, human-readable report of the whole procedure.
The report is written in the C++ stream str. You should provide the shared constant data structure cdata used for the random walk, so that the random walk parameters can be displayed.
You may specify the maximum width of your terminal in max_width, in which case we try very hard not make lines longer than that, and to fill all available horizontal space.
If print_histogram is true
, then the histogram is also printed in a human readable form, using UniformBinsHistogramWithErrorBars::prettyPrint().
Definition at line 700 of file mhrw_valuehist_tasks.h.
|
inline |
Produce a comma-separated-value (CSV) representation of the final histogram.
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
).
The output consists of four columns. Titles are printed on the first line. 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 holds the error bar on the counts (reliable error bar from binning analysis), and the fourth column holds the naive error bar obtained when we ignore the binning analysis.
Definition at line 673 of file mhrw_valuehist_tasks.h.
|
inline |
The final histogram, with naive error bars ignoring the binning analysis.
The error bars are calculated from the standard devitation of the histogram values reported by the different tasks, exactly as for ResultsCollectorSimple. Make sure enough tasks have been run in order for the error bars to be meaningful.
The scale of the histogram is chosen such that each bin value corresponds to the fraction of data points observed in this bin. To normalize the histogram to a unit probability density, use UniformBinsHistogram::normalized(). This scale is chosen because it coincides with that used by the histograms reported by the binning analysis.
Definition at line 613 of file mhrw_valuehist_tasks.h.