Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Mantid::CurveFitting::SeqDomainSpectrumCreator Class Reference

SeqDomainSpectrumCreator : More...

#include <SeqDomainSpectrumCreator.h>

Inheritance diagram for Mantid::CurveFitting::SeqDomainSpectrumCreator:
Mantid::API::IDomainCreator

Public Member Functions

void createDomain (std::shared_ptr< API::FunctionDomain > &domain, std::shared_ptr< API::FunctionValues > &values, size_t i0=0) override
 Creates a sequential domain corresponding to the assigned MatrixWorkspace. More...
 
API::Workspace_sptr 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") override
 Creates an output workspace using the given function and domain. More...
 
size_t getDomainSize () const override
 Returns the domain size. More...
 
 SeqDomainSpectrumCreator (Kernel::IPropertyManager *manager, const std::string &workspacePropertyName)
 Constructor. 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::WorkspacecreateOutputWorkspace (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

bool histogramIsUsable (size_t i) const
 Determines whether a spectrum is masked, in case there is no instrument this always returns true. More...
 
void setMatrixWorkspace (const API::MatrixWorkspace_sptr &matrixWorkspace)
 Sets the MatrixWorkspace the created domain is based on. More...
 
void setParametersFromPropertyManager ()
 Tries to extract a workspace from the assigned property manager. 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

API::MatrixWorkspace_sptr m_matrixWorkspace
 
std::string m_workspacePropertyName
 
- 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::IPropertyManagerm_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...
 

Detailed Description

SeqDomainSpectrumCreator :

SeqDomainSpectrumCreator creates a special type of SeqDomain, which contains one FunctionDomain1DSpectrum for each histogram of the Workspace2D this domain refers to. It can be used for functions that involve several histograms at once.

Author
Michael Wedel, Paul Scherrer Institut - SINQ
Date
28/05/2014

Definition at line 31 of file SeqDomainSpectrumCreator.h.

Constructor & Destructor Documentation

◆ SeqDomainSpectrumCreator()

Mantid::CurveFitting::SeqDomainSpectrumCreator::SeqDomainSpectrumCreator ( Kernel::IPropertyManager manager,
const std::string &  workspacePropertyName 
)

Constructor.

Manager can be a null-pointer if required in a context where no PropertyManager is available. The same for the second argument, it can be an empty string if the functionality is not required.

Parameters
manager:: Pointer to IPropertyManager instance.
workspacePropertyName:: Name of the output property for a created workspace in case a PropertyManager is used.

Definition at line 34 of file SeqDomainSpectrumCreator.cpp.

Member Function Documentation

◆ createDomain()

void Mantid::CurveFitting::SeqDomainSpectrumCreator::createDomain ( std::shared_ptr< API::FunctionDomain > &  domain,
std::shared_ptr< API::FunctionValues > &  values,
size_t  i0 = 0 
)
overridevirtual

Creates a sequential domain corresponding to the assigned MatrixWorkspace.

For each spectrum in the workspace, a FunctionDomain1DSpectrumCreator is constructed and added to a SeqDomain. This way each spectrum of the workspace is represented by its own, independent domain.

Parameters
domain:: Pointer to outgoing FunctionDomain instance.
values:: Pointer to outgoing FunctionValues object.
i0:: Size offset for values object if it already contains data.

Implements Mantid::API::IDomainCreator.

Definition at line 50 of file SeqDomainSpectrumCreator.cpp.

References Mantid::CurveFitting::SeqDomain::addCreator(), Mantid::CurveFitting::SeqDomain::create(), histogramIsUsable(), Mantid::API::IDomainCreator::m_domainType, m_matrixWorkspace, Mantid::CurveFitting::FunctionDomain1DSpectrumCreator::setMatrixWorkspace(), and setParametersFromPropertyManager().

◆ createOutputWorkspace()

Workspace_sptr Mantid::CurveFitting::SeqDomainSpectrumCreator::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" 
)
overridevirtual

Creates an output workspace using the given function and domain.

This method creates a MatrixWorkspace with the same dimensions as the input workspace that was assigned before or throws std::invalid_argument if no valid workspace is present. The method also checks that the provided domain is a SeqDomain. The function needs to be able to handle a FunctionDomain1D-domain. If all requirements are met, an output workspace is created and populated with the calculated values.

Parameters
baseName:: Basename for output workspace.
function:: Function that can handle a FunctionDomain1D-domain.
domain:: Pointer to SeqDomain instance.
values:: Pointer to FunctionValues instance, currently not used.
outputWorkspacePropertyName:: Name of output workspace property, if used.
Returns
MatrixWorkspace with calculated values.

Reimplemented from Mantid::API::IDomainCreator.

Definition at line 100 of file SeqDomainSpectrumCreator.cpp.

References Mantid::DataObjects::create(), Mantid::API::IDomainCreator::declareProperty(), Mantid::Kernel::SingletonHolder< T >::Instance(), Mantid::API::IDomainCreator::m_manager, m_matrixWorkspace, Mantid::Kernel::Direction::Output, Mantid::Kernel::IPropertyManager::setProperty(), Mantid::Kernel::IPropertyManager::setPropertyValue(), and UNUSED_ARG.

◆ getDomainSize()

size_t Mantid::CurveFitting::SeqDomainSpectrumCreator::getDomainSize ( ) const
overridevirtual

Returns the domain size.

Throws if no MatrixWorkspace has been set.

Returns
Total domain size.

Implements Mantid::API::IDomainCreator.

Definition at line 172 of file SeqDomainSpectrumCreator.cpp.

References m_matrixWorkspace.

◆ histogramIsUsable()

bool Mantid::CurveFitting::SeqDomainSpectrumCreator::histogramIsUsable ( size_t  i) const
protected

Determines whether a spectrum is masked, in case there is no instrument this always returns true.

Definition at line 207 of file SeqDomainSpectrumCreator.cpp.

References m_matrixWorkspace.

Referenced by createDomain().

◆ setMatrixWorkspace()

void Mantid::CurveFitting::SeqDomainSpectrumCreator::setMatrixWorkspace ( const API::MatrixWorkspace_sptr matrixWorkspace)
protected

Sets the MatrixWorkspace the created domain is based on.

Definition at line 197 of file SeqDomainSpectrumCreator.cpp.

References m_matrixWorkspace.

Referenced by setParametersFromPropertyManager().

◆ setParametersFromPropertyManager()

void Mantid::CurveFitting::SeqDomainSpectrumCreator::setParametersFromPropertyManager ( )
protected

Tries to extract a workspace from the assigned property manager.

Definition at line 188 of file SeqDomainSpectrumCreator.cpp.

References Mantid::Kernel::IPropertyManager::getProperty(), Mantid::API::IDomainCreator::m_manager, m_workspacePropertyName, setMatrixWorkspace(), and workspace.

Referenced by createDomain().

Member Data Documentation

◆ m_matrixWorkspace

API::MatrixWorkspace_sptr Mantid::CurveFitting::SeqDomainSpectrumCreator::m_matrixWorkspace
protected

◆ m_workspacePropertyName

std::string Mantid::CurveFitting::SeqDomainSpectrumCreator::m_workspacePropertyName
protected

Definition at line 50 of file SeqDomainSpectrumCreator.h.

Referenced by setParametersFromPropertyManager().


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