Mantid
Loading...
Searching...
No Matches
EqualBinSizesValidator.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
10
11namespace Mantid::API {
12
16EqualBinSizesValidator::EqualBinSizesValidator(const double errorLevel) : m_errorLevel(errorLevel) {}
17
20 return std::make_shared<EqualBinSizesValidator>(*this);
21}
22
28 if (!value)
29 return "Enter an existing workspace";
30 if (!value->isCommonBins())
31 return "The workspace must have common bin boundaries for all histograms";
32 if (value->getNumberHistograms() == 0 || value->blocksize() == 0)
33 return "Enter a workspace with some data in it";
34
35 Kernel::EqualBinsChecker checker(value->readX(0), m_errorLevel, -1);
36 return checker.validate();
37}
38
39} // namespace Mantid::API
double value
The value of the point.
Definition: FitMW.cpp:51
const double m_errorLevel
Error threshold.
std::string checkValidity(const MatrixWorkspace_sptr &value) const override
Check for validity.
Kernel::IValidator_sptr clone() const override
Clone the current state.
EqualBinSizesValidator(const double errorLevel)
Constructor: sets properties.
EqualBinsChecker : Checks for evenly spaced bins.
virtual std::string validate() const
Perform validation of the given X array.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< IValidator > IValidator_sptr
A shared_ptr to an IValidator.
Definition: IValidator.h:26