24 const std::string &workspacePropertyName)
35 std::shared_ptr<FunctionValues> &values,
size_t i0) {
40 throw std::runtime_error(
"Cannot create a histogram domain from point data.");
44 throw std::runtime_error(
"Cannot create non-simple domain for histogram fitting.");
53 auto toX =
X.begin() + endIndex + 1;
61 values->expand(i0 + domain->size());
67 if (endIndex >
Y.size()) {
68 throw std::runtime_error(
"FitMW: Inconsistent MatrixWorkspace");
77 if (!std::isfinite(
y))
80 throw std::runtime_error(
"Infinte number or NaN found in input data.");
82 }
else if (!std::isfinite(
error))
85 throw std::runtime_error(
"Infinte number or NaN found in input data.");
86 }
else if (
error <= 0) {
93 values->setFitData(j,
y);
94 values->setFitWeight(j, weight);
96 m_domain = std::dynamic_pointer_cast<API::FunctionDomain1D>(domain);
109 const std::string &baseName,
API::IFunction_sptr function, std::shared_ptr<API::FunctionDomain> domain,
110 std::shared_ptr<API::FunctionValues> values,
const std::string &outputWorkspacePropertyName) {
117 for (
size_t iSpec = 1; iSpec < mws.getNumberHistograms(); ++iSpec) {
122 auto &
y = mws.mutableY(iSpec);
123 auto &e = mws.mutableE(iSpec);
124 double left = bins.leftBoundary();
125 for (
size_t i = 0; i < bins.size(); ++i) {
126 double right = bins[i];
Implements FunctionDomain1D as a set of bins for a histogram.
A class to store values calculated by a function.
bool m_ignoreInvalidData
Flag to ignore nans, infinities and zero errors.
DomainType m_domainType
Domain type.
Base MatrixWorkspace Abstract Class.
std::shared_ptr< API::Workspace > createOutputWorkspace(const std::string &baseName, API::IFunction_sptr function, std::shared_ptr< API::FunctionDomain > domain, std::shared_ptr< API::FunctionValues > values, const std::string &outputWorkspacePropertyName) override
Create an output workspace with the calculated values.
void createDomain(std::shared_ptr< API::FunctionDomain > &domain, std::shared_ptr< API::FunctionValues > &values, size_t i0=0) override
Creates a domain corresponding to the assigned MatrixWorkspace.
HistogramDomainCreator(Kernel::IPropertyManager &manager, const std::string &workspacePropertyName)
Constructor.
A base class for domain creators taking 1D data from a spectrum of a matrix workspace.
std::weak_ptr< API::FunctionDomain1D > m_domain
Store the created domain and values.
std::pair< size_t, size_t > getXInterval() const
Calculate size and starting iterator in the X array.
std::shared_ptr< API::MatrixWorkspace > m_matrixWorkspace
The input MareixWorkspace.
std::weak_ptr< API::FunctionValues > m_values
virtual void setParameters() const
Set all parameters.
size_t m_workspaceIndex
The workspace index.
std::shared_ptr< API::Workspace > createOutputWorkspace(const std::string &baseName, API::IFunction_sptr function, std::shared_ptr< API::FunctionDomain > domain, std::shared_ptr< API::FunctionValues > values, const std::string &outputWorkspacePropertyName) override
Create an output workspace.
Interface to PropertyManager.
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class