Mantid
|
EqualBinsChecker : Checks for evenly spaced bins. More...
#include <EqualBinsChecker.h>
Public Types | |
enum class | ErrorType { Cumulative , Individual } |
Type of errors to check. More... | |
enum class | ReferenceBin { Average , First } |
Type of bin to compare others to. More... | |
Public Member Functions | |
EqualBinsChecker (const MantidVec &xData, const double errorLevel, const double warningLevel=-1) | |
Constructor, setting data and thresholds for errors and warnings. More... | |
virtual void | setErrorType (const ErrorType &errorType) |
Set whether to use cumulative errors or compare each in turn. More... | |
virtual void | setReferenceBin (const ReferenceBin &refBinType) |
Set whether to compare each bin to the first bin width or the average. More... | |
virtual std::string | validate () const |
Perform validation of the given X array. More... | |
virtual | ~EqualBinsChecker ()=default |
Protected Member Functions | |
virtual double | getDifference (const size_t bin, const double dx) const |
Returns the error (simple or cumulative) at the given point. More... | |
virtual double | getReferenceDx () const |
Returns the bin width to compare against: either the average or the first depending on options. More... | |
Private Attributes | |
const double | m_errorLevel |
ErrorType | m_errorType |
ReferenceBin | m_refBinType |
const bool | m_warn |
const double | m_warningLevel |
const MantidVec & | m_xData |
EqualBinsChecker : Checks for evenly spaced bins.
This class works on x data from a workspace and checks that the bins are equally spaced. The tolerance thresholds for rejecting the bins and warning the user are both adjustable.
Definition at line 22 of file EqualBinsChecker.h.
|
strong |
Type of errors to check.
Enumerator | |
---|---|
Cumulative | |
Individual |
Definition at line 27 of file EqualBinsChecker.h.
|
strong |
Type of bin to compare others to.
Enumerator | |
---|---|
Average | |
First |
Definition at line 25 of file EqualBinsChecker.h.
Mantid::Kernel::EqualBinsChecker::EqualBinsChecker | ( | const MantidVec & | xData, |
const double | errorLevel, | ||
const double | warningLevel = -1 |
||
) |
Constructor, setting data and thresholds for errors and warnings.
By default, checks against average bin width and uses cumulative errors.
xData | :: [input] Reference to bins to check |
errorLevel | :: [input] Threshold for error. If bin differences are larger than this, check fails. |
warningLevel | :: [input] Threshold for warning. If bin difference are larger than this, the user is warned but the check doesn't necessarily fail. If set negative, warnings are off and only error level is used (default). |
Definition at line 32 of file EqualBinsChecker.cpp.
|
virtualdefault |
|
protectedvirtual |
Returns the error (simple or cumulative) at the given point.
bin | :: [input] which bin to get the error for |
dx | :: [input] bin width to compare to |
std::invalid_argument | if there is no such bin in the data |
Definition at line 117 of file EqualBinsChecker.cpp.
References Individual, m_errorType, and m_xData.
Referenced by validate().
|
protectedvirtual |
Returns the bin width to compare against: either the average or the first depending on options.
std::runtime_error | if input X data was empty |
Definition at line 95 of file EqualBinsChecker.cpp.
References Average, m_refBinType, and m_xData.
Referenced by validate().
|
virtual |
Set whether to use cumulative errors or compare each in turn.
Used for FFT without "AcceptXRoundingErrors" - compatibility with previous behaviour.
errorType | :: [input] Either cumulative or individual errors |
Definition at line 50 of file EqualBinsChecker.cpp.
References m_errorType.
Referenced by Mantid::Algorithms::FFT::areBinWidthsUneven().
|
virtual |
Set whether to compare each bin to the first bin width or the average.
Used for FFT without "AcceptXRoundingErrors" - compatibility with previous behaviour.
refBinType | :: [input] Either average bin or first bin |
Definition at line 42 of file EqualBinsChecker.cpp.
References m_refBinType.
Referenced by Mantid::Algorithms::FFT::areBinWidthsUneven().
|
virtual |
Perform validation of the given X array.
Definition at line 56 of file EqualBinsChecker.cpp.
References Mantid::Kernel::DateAndTimeHelpers::g_log, getDifference(), getReferenceDx(), m_errorLevel, m_warn, m_warningLevel, m_xData, and Mantid::Kernel::Logger::warning().
Referenced by Mantid::Algorithms::FFT::areBinWidthsUneven(), Mantid::API::EqualBinSizesValidator::checkValidity(), Mantid::Algorithms::MaxEnt::validateBinEdges(), and Mantid::Algorithms::DiscusMultipleScatteringCorrection::validateInputs().
|
private |
Definition at line 40 of file EqualBinsChecker.h.
Referenced by validate().
|
private |
Definition at line 44 of file EqualBinsChecker.h.
Referenced by getDifference(), and setErrorType().
|
private |
Definition at line 43 of file EqualBinsChecker.h.
Referenced by getReferenceDx(), and setReferenceBin().
|
private |
Definition at line 41 of file EqualBinsChecker.h.
Referenced by validate().
|
private |
Definition at line 42 of file EqualBinsChecker.h.
Referenced by validate().
|
private |
Definition at line 39 of file EqualBinsChecker.h.
Referenced by getDifference(), getReferenceDx(), and validate().