Tomographer
v4.0
Tomographer C++ Framework Documentation
|
Results collector, if no binning analysis is being used. More...
#include <tomographer/mhrw_valuehist_tasks.h>
Classes | |
struct | RunTaskResult |
Stores information about the result of a task run. More... | |
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 CDataBaseType::HistogramType | HistogramType |
The histogram type corresponding to the result of a task. More... | |
typedef CDataBaseType::HistogramParams | HistogramParams |
The parameters type used to describe our histogram range and number of bins. | |
typedef UniformBinsHistogram< typename HistogramType::Scalar, CountRealType > | ScaledHistogramType |
The type of the histogram resulting from a single task, but scaled so that each bin value corresponds to the fraction of data points in bin. | |
typedef AveragedHistogram< ScaledHistogramType, CountRealType > | FinalHistogramType |
typedef HistogramType | MHRWStatsCollectorResultType |
The result type of our ValueHistogramMHRWStatsCollector. | |
typedef std::vector< RunTaskResult * > | RunTaskResultList |
Public Member Functions | |
ResultsCollectorSimple (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 error bars. 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 — finalizes the results. More... | |
Results collector, if no 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 "raw" histogram, ie. without any error bars. If you have tasks which already provide some error bars from a binning analysis, then you should be using the class ResultsCollectorWithBinningAnalysis.
Note that you can directly get the right ResultsCollector type by querying the type "CDataBase::ResultsCollectorType<..>::Type".
Definition at line 135 of file mhrw_valuehist_tasks.h.
typedef AveragedHistogram<ScaledHistogramType, CountRealType> Tomographer::MHRWTasks::ValueHistogramTasks::ResultsCollectorSimple< CDataBaseType_, LoggerType_ >::FinalHistogramType |
The type of the final resulting, averaged histogram
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 scaling is the same as that used by the histogram produced using a binning analysis, see ValueHistogramWithBinningMHRWStatsCollectorResult.
Definition at line 174 of file mhrw_valuehist_tasks.h.
typedef CDataBaseType::HistogramType Tomographer::MHRWTasks::ValueHistogramTasks::ResultsCollectorSimple< CDataBaseType_, LoggerType_ >::HistogramType |
The histogram type corresponding to the result of a task.
Definition at line 159 of file mhrw_valuehist_tasks.h.
|
inline |
Constructor.
Messages will be logged to the given logger.
Definition at line 225 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.
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 298 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.
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 282 of file mhrw_valuehist_tasks.h.
|
inline |
The final histogram, with error bars.
The error bars are calculated from the standard devitation of the histogram values reported by the different tasks. 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().
Definition at line 259 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 247 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 269 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 343 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
).
Three columns are outputted. Titles are outputted 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 the error bar on the counts.
Definition at line 317 of file mhrw_valuehist_tasks.h.
|
inline |
In compliance with ResultsCollector Interface — finalizes the results.
After this function is called (which the task dispatcher does automatically), the results are finalized (isFinalized() now returns true) and the functions finalHistogram(), collectedRunTaskResults(), etc. may be called.
Definition at line 433 of file mhrw_valuehist_tasks.h.