Mantid
|
A base class for domain creators taking 1D data from a spectrum of a matrix workspace. More...
#include <IMWDomainCreator.h>
Public Member Functions | |
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. More... | |
void | declareDatasetProperties (const std::string &suffix="", bool addProp=true) override |
Declare properties that specify the dataset within the workspace to fit to. More... | |
size_t | getDomainSize () const override |
Return the size of the domain to be created. More... | |
IMWDomainCreator (Kernel::IPropertyManager *fit, const std::string &workspacePropertyName, DomainType domainType=Simple) | |
Constructor. More... | |
void | initFunction (API::IFunction_sptr function) override |
Initialize the function. More... | |
void | setRange (double startX, double endX) |
Set the startX and endX. More... | |
void | setWorkspace (std::shared_ptr< API::MatrixWorkspace > ws) |
Set the workspace. More... | |
void | setWorkspaceIndex (size_t wi) |
Set the workspace index. More... | |
Public Member Functions inherited from Mantid::API::IDomainCreator | |
virtual void | createDomain (std::shared_ptr< API::FunctionDomain > &domain, std::shared_ptr< API::FunctionValues > &values, size_t i0=0)=0 |
Create a domain and values from the input workspace. More... | |
virtual 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="OutputWorkspace") |
Create an output workspace filled with data simulated with the fitting function. More... | |
virtual void | declareDatasetProperties (const std::string &suffix="", bool addProp=true) |
Declare properties that specify the dataset within the workspace to fit to. More... | |
virtual size_t | getDomainSize () const =0 |
Return the size of the domain to be created. More... | |
IDomainCreator (Kernel::IPropertyManager *manager, std::vector< std::string > workspacePropertyNames, DomainType domainType=Simple) | |
Constrcutor. More... | |
void | ignoreInvalidData (bool yes) |
Set to ignore invalid data. More... | |
virtual void | initFunction (API::IFunction_sptr function) |
Initialize the function. More... | |
virtual void | initialize (Kernel::IPropertyManager *, const std::string &, DomainType) |
Initialize. More... | |
void | separateCompositeMembersInOutput (const bool value, const bool conv=false) |
Toggle output of either just composite or composite + members. More... | |
virtual | ~IDomainCreator ()=default |
Virtual destructor. More... | |
Protected Member Functions | |
void | addFunctionValuesToWS (const API::IFunction_sptr &function, std::shared_ptr< API::MatrixWorkspace > &ws, const size_t wsIndex, const std::shared_ptr< API::FunctionDomain > &domain, const std::shared_ptr< API::FunctionValues > &resultValues) const |
Add the calculated function values to the workspace. More... | |
void | appendCompositeFunctionMembers (std::list< API::IFunction_sptr > &functionList, const API::IFunction_sptr &function) const |
void | appendConvolvedCompositeFunctionMembers (std::list< API::IFunction_sptr > &functionList, const API::IFunction_sptr &function) const |
If the fit function is Convolution and flag m_convolutionCompositeMembers is set and Convolution's second function (the model) is composite then use members of the model for the output. More... | |
std::shared_ptr< API::MatrixWorkspace > | createEmptyResultWS (const size_t nhistograms, const size_t nyvalues) |
Creates the blank output workspace of the correct size. More... | |
std::pair< size_t, size_t > | getXInterval () const |
Calculate size and starting iterator in the X array. More... | |
void | setInitialValues (API::IFunction &function) |
Set initial values for parameters with default values. More... | |
virtual void | setParameters () const |
Set all parameters. More... | |
Protected Member Functions inherited from Mantid::API::IDomainCreator | |
void | declareProperty (Kernel::Property *prop, const std::string &doc) |
Declare a property to the algorithm. More... | |
Protected Attributes | |
std::weak_ptr< API::FunctionDomain1D > | m_domain |
Store the created domain and values. More... | |
double | m_endX |
endX More... | |
std::string | m_endXPropertyName |
Store endX property name. More... | |
std::shared_ptr< API::MatrixWorkspace > | m_matrixWorkspace |
The input MareixWorkspace. More... | |
size_t | m_startIndex |
double | m_startX |
startX More... | |
std::string | m_startXPropertyName |
Store startX property name. More... | |
std::weak_ptr< API::FunctionValues > | m_values |
size_t | m_workspaceIndex |
The workspace index. More... | |
std::string | m_workspaceIndexPropertyName |
Store workspace index property name. More... | |
std::string | m_workspacePropertyName |
Store workspace property name. More... | |
Protected Attributes inherited from Mantid::API::IDomainCreator | |
bool | m_convolutionCompositeMembers |
Perform convolution of output composite components. More... | |
DomainType | m_domainType |
Domain type. More... | |
bool | m_ignoreInvalidData |
Flag to ignore nans, infinities and zero errors. More... | |
Kernel::IPropertyManager * | m_manager |
Pointer to a property manager. More... | |
bool | m_outputCompositeMembers |
Output separate composite function values. More... | |
std::vector< std::string > | m_workspacePropertyNames |
Property names for workspaces to get the data from. More... | |
Additional Inherited Members | |
Public Types inherited from Mantid::API::IDomainCreator | |
enum | DomainType { Simple = 0 , Sequential , Parallel } |
Type of domain to create. More... | |
A base class for domain creators taking 1D data from a spectrum of a matrix workspace.
Definition at line 34 of file IMWDomainCreator.h.
Mantid::CurveFitting::IMWDomainCreator::IMWDomainCreator | ( | Kernel::IPropertyManager * | fit, |
const std::string & | workspacePropertyName, | ||
IMWDomainCreator::DomainType | domainType = Simple |
||
) |
Constructor.
fit | :: Property manager with properties defining the domain to be created |
workspacePropertyName | :: Name of the workspace property. |
domainType | :: Type of the domain: Simple, Sequential, or Parallel. |
Definition at line 50 of file IMWDomainCreator.cpp.
References m_workspacePropertyName, and Mantid::API::IDomainCreator::m_workspacePropertyNames.
|
protected |
Add the calculated function values to the workspace.
Estimate an error for each calculated value.
function | The function to evaluate |
ws | A workspace to fill |
wsIndex | The index to store the values |
domain | The domain to calculate the values over |
resultValues | A presized values holder for the results |
Definition at line 379 of file IMWDomainCreator.cpp.
References Mantid::Geometry::d, Mantid::API::Jacobian::get(), sigma, and tmp.
Referenced by createOutputWorkspace().
|
protected |
functionList | The current list of functions to append to |
function | A function that may or not be composite |
Definition at line 314 of file IMWDomainCreator.cpp.
References appendCompositeFunctionMembers(), appendConvolvedCompositeFunctionMembers(), and Mantid::API::IDomainCreator::m_convolutionCompositeMembers.
Referenced by appendCompositeFunctionMembers(), and createOutputWorkspace().
|
protected |
If the fit function is Convolution and flag m_convolutionCompositeMembers is set and Convolution's second function (the model) is composite then use members of the model for the output.
functionList | :: A list of Convolutions constructed from the resolution of the fitting function (index 0) and members of the model. |
function | A Convolution function which model may or may not be a composite function. |
Definition at line 350 of file IMWDomainCreator.cpp.
Referenced by appendCompositeFunctionMembers().
|
protected |
Creates the blank output workspace of the correct size.
Creates a workspace to hold the results.
If the input workspace contains histogram data then so will this It assigns the X and input data values but no Y,E data for any functions
nhistograms | The number of histograms |
nyvalues | The number of y values to hold |
Definition at line 197 of file IMWDomainCreator.cpp.
References Mantid::Kernel::SingletonHolder< T >::Instance(), m_matrixWorkspace, m_startIndex, and m_workspaceIndex.
Referenced by createOutputWorkspace().
|
overridevirtual |
Create an output workspace.
Create an output workspace with the calculated values.
baseName | :: Specifies the name of the output workspace |
function | :: A Pointer to the fitting function |
domain | :: The domain containing x-values for the function |
values | :: A API::FunctionValues instance containing the fitting data |
outputWorkspacePropertyName | :: The property name |
Reimplemented from Mantid::API::IDomainCreator.
Definition at line 244 of file IMWDomainCreator.cpp.
References addFunctionValuesToWS(), appendCompositeFunctionMembers(), createEmptyResultWS(), Mantid::API::IDomainCreator::declareProperty(), Mantid::API::IDomainCreator::m_manager, m_matrixWorkspace, Mantid::API::IDomainCreator::m_outputCompositeMembers, Mantid::Kernel::Direction::Output, Mantid::API::TextAxis::setLabel(), Mantid::Kernel::IPropertyManager::setProperty(), and Mantid::Kernel::IPropertyManager::setPropertyValue().
Referenced by Mantid::CurveFitting::FitMW::createOutputWorkspace(), and Mantid::CurveFitting::HistogramDomainCreator::createOutputWorkspace().
|
overridevirtual |
Declare properties that specify the dataset within the workspace to fit to.
suffix | :: names the dataset |
addProp | :: allows for the declaration of certain properties of the dataset |
Reimplemented from Mantid::API::IDomainCreator.
Definition at line 87 of file IMWDomainCreator.cpp.
References Mantid::API::IDomainCreator::declareProperty(), Mantid::EMPTY_DBL(), Mantid::Kernel::IPropertyManager::existsProperty(), m_endXPropertyName, Mantid::API::IDomainCreator::m_manager, m_startXPropertyName, and m_workspaceIndexPropertyName.
Referenced by Mantid::CurveFitting::FitMW::declareDatasetProperties().
|
overridevirtual |
Return the size of the domain to be created.
Implements Mantid::API::IDomainCreator.
Definition at line 169 of file IMWDomainCreator.cpp.
References getXInterval(), and setParameters().
|
protected |
Calculate size and starting iterator in the X array.
Definition at line 112 of file IMWDomainCreator.cpp.
References Mantid::EMPTY_DBL(), m_endX, m_matrixWorkspace, m_startX, m_workspaceIndex, setParameters(), and Mantid::Geometry::X.
Referenced by Mantid::CurveFitting::FitMW::createDomain(), Mantid::CurveFitting::HistogramDomainCreator::createDomain(), and getDomainSize().
|
overridevirtual |
Initialize the function.
Initialize the function with the workspace.
function | :: Function to initialize. |
Reimplemented from Mantid::API::IDomainCreator.
Definition at line 180 of file IMWDomainCreator.cpp.
References m_endX, m_matrixWorkspace, m_startX, m_workspaceIndex, setInitialValues(), and setParameters().
|
protected |
Set initial values for parameters with default values.
function | : A function to set parameters for. |
Definition at line 228 of file IMWDomainCreator.cpp.
References Mantid::CurveFitting::ParameterEstimator::estimate(), m_domain, and m_values.
Referenced by initFunction().
|
protectedvirtual |
Set all parameters.
Reimplemented in Mantid::CurveFitting::FitMW.
Definition at line 63 of file IMWDomainCreator.cpp.
References Mantid::Kernel::IPropertyManager::getProperty(), index, m_endX, m_endXPropertyName, Mantid::API::IDomainCreator::m_manager, m_matrixWorkspace, m_startX, m_startXPropertyName, m_workspaceIndex, m_workspaceIndexPropertyName, and m_workspacePropertyName.
Referenced by Mantid::CurveFitting::HistogramDomainCreator::createDomain(), getDomainSize(), getXInterval(), initFunction(), and Mantid::CurveFitting::FitMW::setParameters().
|
inline |
Set the startX and endX.
startX | :: Start of the domain |
endX | :: End of the domain |
Definition at line 60 of file IMWDomainCreator.h.
|
inline |
Set the workspace.
ws | :: workspace to set. |
Definition at line 53 of file IMWDomainCreator.h.
Referenced by Mantid::CurveFitting::FitMW::createDomain().
|
inline |
Set the workspace index.
wi | :: workspace index to set. |
Definition at line 56 of file IMWDomainCreator.h.
|
mutableprotected |
Store the created domain and values.
Definition at line 106 of file IMWDomainCreator.h.
Referenced by Mantid::CurveFitting::FitMW::createDomain(), Mantid::CurveFitting::HistogramDomainCreator::createDomain(), and setInitialValues().
|
mutableprotected |
endX
Definition at line 104 of file IMWDomainCreator.h.
Referenced by getXInterval(), initFunction(), and setParameters().
|
protected |
Store endX property name.
Definition at line 95 of file IMWDomainCreator.h.
Referenced by declareDatasetProperties(), and setParameters().
|
mutableprotected |
The input MareixWorkspace.
Definition at line 98 of file IMWDomainCreator.h.
Referenced by Mantid::CurveFitting::FitMW::createDomain(), Mantid::CurveFitting::HistogramDomainCreator::createDomain(), createEmptyResultWS(), Mantid::CurveFitting::FitMW::createOutputWorkspace(), Mantid::CurveFitting::HistogramDomainCreator::createOutputWorkspace(), createOutputWorkspace(), getXInterval(), initFunction(), and setParameters().
|
protected |
Definition at line 108 of file IMWDomainCreator.h.
Referenced by Mantid::CurveFitting::FitMW::createDomain(), Mantid::CurveFitting::HistogramDomainCreator::createDomain(), and createEmptyResultWS().
|
mutableprotected |
startX
Definition at line 102 of file IMWDomainCreator.h.
Referenced by getXInterval(), initFunction(), and setParameters().
|
protected |
Store startX property name.
Definition at line 93 of file IMWDomainCreator.h.
Referenced by declareDatasetProperties(), and setParameters().
|
mutableprotected |
Definition at line 107 of file IMWDomainCreator.h.
Referenced by Mantid::CurveFitting::FitMW::createDomain(), Mantid::CurveFitting::HistogramDomainCreator::createDomain(), and setInitialValues().
|
mutableprotected |
The workspace index.
Definition at line 100 of file IMWDomainCreator.h.
Referenced by Mantid::CurveFitting::FitMW::createDomain(), Mantid::CurveFitting::HistogramDomainCreator::createDomain(), createEmptyResultWS(), getXInterval(), initFunction(), and setParameters().
|
protected |
Store workspace index property name.
Definition at line 91 of file IMWDomainCreator.h.
Referenced by declareDatasetProperties(), and setParameters().
|
protected |
Store workspace property name.
Definition at line 89 of file IMWDomainCreator.h.
Referenced by IMWDomainCreator(), and setParameters().