Mantid
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Mantid::Kernel::EqualBinsChecker Class Reference

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 MantidVecm_xData
 

Detailed Description

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.

Member Enumeration Documentation

◆ ErrorType

Type of errors to check.

Enumerator
Cumulative 
Individual 

Definition at line 27 of file EqualBinsChecker.h.

◆ ReferenceBin

Type of bin to compare others to.

Enumerator
Average 
First 

Definition at line 25 of file EqualBinsChecker.h.

Constructor & Destructor Documentation

◆ EqualBinsChecker()

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.

Parameters
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.

◆ ~EqualBinsChecker()

virtual Mantid::Kernel::EqualBinsChecker::~EqualBinsChecker ( )
virtualdefault

Member Function Documentation

◆ getDifference()

double Mantid::Kernel::EqualBinsChecker::getDifference ( const size_t  bin,
const double  dx 
) const
protectedvirtual

Returns the error (simple or cumulative) at the given point.

Parameters
bin:: [input] which bin to get the error for
dx:: [input] bin width to compare to
Returns
:: error, simple or cumulative depending on options
Exceptions
std::invalid_argumentif 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().

◆ getReferenceDx()

double Mantid::Kernel::EqualBinsChecker::getReferenceDx ( ) const
protectedvirtual

Returns the bin width to compare against: either the average or the first depending on options.

Returns
:: bin width to compare against
Exceptions
std::runtime_errorif input X data was empty

Definition at line 95 of file EqualBinsChecker.cpp.

References Average, m_refBinType, and m_xData.

Referenced by validate().

◆ setErrorType()

void Mantid::Kernel::EqualBinsChecker::setErrorType ( const ErrorType errorType)
virtual

Set whether to use cumulative errors or compare each in turn.

Used for FFT without "AcceptXRoundingErrors" - compatibility with previous behaviour.

Parameters
errorType:: [input] Either cumulative or individual errors

Definition at line 50 of file EqualBinsChecker.cpp.

References m_errorType.

Referenced by Mantid::Algorithms::FFT::areBinWidthsUneven().

◆ setReferenceBin()

void Mantid::Kernel::EqualBinsChecker::setReferenceBin ( const ReferenceBin refBinType)
virtual

Set whether to compare each bin to the first bin width or the average.

Used for FFT without "AcceptXRoundingErrors" - compatibility with previous behaviour.

Parameters
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().

◆ validate()

std::string Mantid::Kernel::EqualBinsChecker::validate ( ) const
virtual

Member Data Documentation

◆ m_errorLevel

const double Mantid::Kernel::EqualBinsChecker::m_errorLevel
private

Definition at line 40 of file EqualBinsChecker.h.

Referenced by validate().

◆ m_errorType

ErrorType Mantid::Kernel::EqualBinsChecker::m_errorType
private

Definition at line 44 of file EqualBinsChecker.h.

Referenced by getDifference(), and setErrorType().

◆ m_refBinType

ReferenceBin Mantid::Kernel::EqualBinsChecker::m_refBinType
private

Definition at line 43 of file EqualBinsChecker.h.

Referenced by getReferenceDx(), and setReferenceBin().

◆ m_warn

const bool Mantid::Kernel::EqualBinsChecker::m_warn
private

Definition at line 41 of file EqualBinsChecker.h.

Referenced by validate().

◆ m_warningLevel

const double Mantid::Kernel::EqualBinsChecker::m_warningLevel
private

Definition at line 42 of file EqualBinsChecker.h.

Referenced by validate().

◆ m_xData

const MantidVec& Mantid::Kernel::EqualBinsChecker::m_xData
private

Definition at line 39 of file EqualBinsChecker.h.

Referenced by getDifference(), getReferenceDx(), and validate().


The documentation for this class was generated from the following files: