33 : m_xData(xData), m_errorLevel(errorLevel), m_warn(warningLevel > 0), m_warningLevel(warningLevel),
58 const auto xSize = xData.size();
61 return "Input workspace must not be empty";
68 bool printWarning =
false;
69 for (
size_t bin = 0; bin < xSize - 2; bin++) {
72 std::stringstream errorStr;
73 errorStr <<
"X axis must be linear (all bins must have the same width) ";
74 errorStr <<
"dx=" << xData[bin + 1] - xData[bin] <<
" reference dx=" << dx <<
" bin number=" << bin;
75 return errorStr.str();
97 throw std::runtime_error(
"No bins in input X data");
102 const auto xSize =
m_xData.size();
103 return (
m_xData[xSize - 1] -
m_xData[0]) /
static_cast<double>(xSize - 1);
118 if (bin >
m_xData.size() - 2) {
119 throw std::invalid_argument(
"Not enough bins in input X data");
126 return std::fabs((
m_xData[bin + 1] -
m_xData[0] -
static_cast<double>(bin + 1) * dx) / dx);
virtual double getDifference(const size_t bin, const double dx) const
Returns the error (simple or cumulative) at the given point.
virtual double getReferenceDx() const
Returns the bin width to compare against: either the average or the first depending on options.
const double m_warningLevel
EqualBinsChecker(const MantidVec &xData, const double errorLevel, const double warningLevel=-1)
Constructor, setting data and thresholds for errors and warnings.
const MantidVec & m_xData
virtual std::string validate() const
Perform validation of the given X array.
const double m_errorLevel
virtual void setErrorType(const ErrorType &errorType)
Set whether to use cumulative errors or compare each in turn.
ErrorType
Type of errors to check.
ReferenceBin
Type of bin to compare others to.
ReferenceBin m_refBinType
virtual void setReferenceBin(const ReferenceBin &refBinType)
Set whether to compare each bin to the first bin width or the average.
The Logger class is in charge of the publishing messages from the framework through various channels.
void warning(const std::string &msg)
Logs at warning level.
Kernel::Logger g_log("ExperimentInfo")
static logger object
Logger g_log("DateAndTime")
std::vector< double > MantidVec
typedef for the data storage used in Mantid matrix workspaces