Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
MantidQt::MantidWidgets::FunctionModel Class Reference

#include <FunctionModel.h>

Inheritance diagram for MantidQt::MantidWidgets::FunctionModel:
MantidQt::MantidWidgets::IFunctionModel MantidQt::MantidWidgets::ConvolutionFunctionModel

Public Member Functions

void addConstraint (const QString &functionIndex, const QString &constraint) override
 
void addDatasets (const QStringList &datasetNames)
 Adds datasets based on their workspace names. More...
 
void addFunction (const QString &prefix, const QString &funStr) override
 
void changeTie (const QString &parName, const QString &tie) override
 
int currentDomainIndex () const override
 
IFunction::Attribute getAttribute (const QString &attrName) const
 
QStringList getAttributeNames () const
 
IFunction_sptr getCurrentFunction () const override
 
QStringList getDatasetDomainNames () const override
 Returns names for the domains of each dataset. More...
 
QStringList getDatasetNames () const override
 Returns the workspace names of the datasets. More...
 
IFunction_sptr getFitFunction () const override
 
QStringList getGlobalParameters () const override
 
QString getLocalParameterConstraint (const QString &parName, int i) const override
 
QStringList getLocalParameters () const override
 
QString getLocalParameterTie (const QString &parName, int i) const override
 
double getLocalParameterValue (const QString &parName, int i) const override
 
int getNumberDomains () const override
 
double getParameter (const QString &paramName) const override
 
QString getParameterDescription (const QString &paramName) const override
 
double getParameterError (const QString &paramName) const override
 
QStringList getParameterNames () const override
 
QString getParameterTie (const QString &parName) const
 
IFunction_sptr getSingleFunction (int index) const override
 
bool hasFunction () const override
 
bool isGlobal (const QString &parName) const override
 
bool isLocalParameterFixed (const QString &parName, int i) const override
 
bool isParameterFixed (const QString &parName) const
 
void removeConstraint (const QString &paramName) override
 
void removeDatasets (QList< int > &indices)
 Removes datasets (i.e. More...
 
void removeFunction (const QString &functionIndex) override
 
void setAttribute (const QString &attrName, const IFunction::Attribute &val)
 
QString setBackgroundA0 (double value) override
 
void setCurrentDomainIndex (int) override
 
void setDatasets (const QList< FunctionModelDataset > &datasets) override
 Sets the datasets using a map of <workspace name, spectra list>. More...
 
void setDatasets (const QStringList &datasetNames)
 Sets the datasets based on their workspace names. More...
 
void setFunction (IFunction_sptr) override
 
void setGlobalParameters (const QStringList &globals) override
 
void setGlobalParameterValue (const QString &paramName, double value) override
 
void setLocalParameterConstraint (const QString &parName, int i, const QString &constraint) override
 
void setLocalParameterFixed (const QString &parName, int i, bool fixed) override
 
void setLocalParameterTie (const QString &parName, int i, const QString &tie) override
 
void setLocalParameterValue (const QString &parName, int i, double value) override
 
void setLocalParameterValue (const QString &parName, int i, double value, double error) override
 
void setNumberDomains (int) override
 
void setParameter (const QString &paramName, double value) override
 
void setParameterError (const QString &paramName, double value) override
 
void setParameterFixed (const QString &parName, bool fixed)
 
void setParameterTie (const QString &parName, const QString &tie)
 
void updateMultiDatasetAttributes (const IFunction &fun)
 
void updateMultiDatasetParameters (const IFunction &fun) override
 
void updateParameters (const IFunction &fun) override
 
- Public Member Functions inherited from MantidQt::MantidWidgets::IFunctionModel
virtual void addConstraint (const QString &functionIndex, const QString &constraint)=0
 
virtual void addFunction (const QString &prefix, const QString &funStr)=0
 
virtual void changeTie (const QString &paramName, const QString &tie)=0
 
void clear ()
 
virtual int currentDomainIndex () const =0
 
virtual IFunction_sptr getCurrentFunction () const =0
 
virtual QStringList getDatasetDomainNames () const =0
 
virtual QStringList getDatasetNames () const =0
 
virtual IFunction_sptr getFitFunction () const =0
 
QString getFitFunctionString () const
 
QString getFunctionString () const
 
virtual QStringList getGlobalParameters () const =0
 
virtual QString getLocalParameterConstraint (const QString &parName, int i) const =0
 
virtual QStringList getLocalParameters () const =0
 
virtual QString getLocalParameterTie (const QString &parName, int i) const =0
 
virtual double getLocalParameterValue (const QString &parName, int i) const =0
 
virtual int getNumberDomains () const =0
 
int getNumberLocalFunctions () const
 
virtual double getParameter (const QString &paramName) const =0
 
virtual QString getParameterDescription (const QString &paramName) const =0
 
virtual double getParameterError (const QString &paramName) const =0
 
virtual QStringList getParameterNames () const =0
 
virtual IFunction_sptr getSingleFunction (int index) const =0
 
virtual bool hasFunction () const =0
 
virtual bool isGlobal (const QString &parName) const =0
 
virtual bool isLocalParameterFixed (const QString &parName, int i) const =0
 
virtual void removeConstraint (const QString &paramName)=0
 
virtual void removeFunction (const QString &functionIndex)=0
 
virtual QString setBackgroundA0 (double value)=0
 
virtual void setCurrentDomainIndex (int)=0
 
virtual void setDatasets (const QList< FunctionModelDataset > &datasets)=0
 
virtual void setFunction (IFunction_sptr fun)=0
 
void setFunctionString (const QString &funStr)
 
virtual void setGlobalParameters (const QStringList &globals)=0
 
virtual void setGlobalParameterValue (const QString &paramName, double value)=0
 
virtual void setLocalParameterConstraint (const QString &parName, int i, const QString &constraint)=0
 
virtual void setLocalParameterFixed (const QString &parName, int i, bool fixed)=0
 
virtual void setLocalParameterTie (const QString &parName, int i, const QString &tie)=0
 
virtual void setLocalParameterValue (const QString &parName, int i, double value)=0
 
virtual void setLocalParameterValue (const QString &parName, int i, double value, double error)=0
 
virtual void setNumberDomains (int)=0
 
virtual void setParameter (const QString &paramName, double value)=0
 
virtual void setParameterError (const QString &paramName, double value)=0
 
virtual void updateMultiDatasetParameters (const IFunction &fun)=0
 
virtual void updateParameters (const IFunction &fun)=0
 
virtual ~IFunctionModel ()=default
 

Protected Attributes

MultiDomainFunction_sptr m_function
 
size_t m_numberDomains = 0
 

Private Member Functions

void checkDatasets ()
 Check that the number of domains is correct for m_datasets. More...
 
void checkIndex (int) const
 Check a domain/function index to be in range. More...
 
void checkNumberOfDomains (const QList< FunctionModelDataset > &datasets) const
 Check that the datasets supplied have the expected total number of domains. More...
 
IFunction_sptr getFitFunctionWithGlobals (std::size_t const &index) const
 
int numberOfDomains (const QList< FunctionModelDataset > &datasets) const
 
void setResolutionFromWorkspace (const IFunction_sptr &fun)
 
void setResolutionFromWorkspace (const IFunction_sptr &fun, const MatrixWorkspace_sptr &workspace)
 
void updateGlobals ()
 

Private Attributes

size_t m_currentDomainIndex = 0
 
QList< FunctionModelDatasetm_datasets
 
QStringList m_globalParameterNames
 

Additional Inherited Members

- Protected Member Functions inherited from MantidQt::MantidWidgets::IFunctionModel
void copyParametersAndErrorsToAllLocalFunctions (const IFunction &fun)
 
- Static Protected Member Functions inherited from MantidQt::MantidWidgets::IFunctionModel
static void copyParametersAndErrors (const IFunction &funFrom, IFunction &funTo)
 

Detailed Description

Definition at line 23 of file FunctionModel.h.

Member Function Documentation

◆ addConstraint()

void MantidQt::MantidWidgets::FunctionModel::addConstraint ( const QString &  functionIndex,
const QString &  constraint 
)
overridevirtual

◆ addDatasets()

void MantidQt::MantidWidgets::FunctionModel::addDatasets ( const QStringList &  datasetNames)

Adds datasets based on their workspace names.

This assumes there is only a single spectrum in the added workspaces.

Parameters
datasetNames:: Names of the workspaces to be added.

Definition at line 299 of file FunctionModel.cpp.

References m_datasets, numberOfDomains(), and setNumberDomains().

◆ addFunction()

void MantidQt::MantidWidgets::FunctionModel::addFunction ( const QString &  prefix,
const QString &  funStr 
)
overridevirtual

◆ changeTie()

void MantidQt::MantidWidgets::FunctionModel::changeTie ( const QString &  parName,
const QString &  tie 
)
overridevirtual

◆ checkDatasets()

void MantidQt::MantidWidgets::FunctionModel::checkDatasets ( )
private

Check that the number of domains is correct for m_datasets.

Definition at line 486 of file FunctionModel.cpp.

References m_datasets, m_numberDomains, and numberOfDomains().

Referenced by removeDatasets().

◆ checkIndex()

void MantidQt::MantidWidgets::FunctionModel::checkIndex ( int  index) const
private

Check a domain/function index to be in range.

Definition at line 508 of file FunctionModel.cpp.

References getNumberDomains(), index, and std::to_string().

Referenced by getSingleFunction(), and setCurrentDomainIndex().

◆ checkNumberOfDomains()

void MantidQt::MantidWidgets::FunctionModel::checkNumberOfDomains ( const QList< FunctionModelDataset > &  datasets) const
private

Check that the datasets supplied have the expected total number of domains.

Definition at line 495 of file FunctionModel.cpp.

References m_numberDomains, and numberOfDomains().

Referenced by setDatasets().

◆ currentDomainIndex()

int MantidQt::MantidWidgets::FunctionModel::currentDomainIndex ( ) const
overridevirtual

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 352 of file FunctionModel.cpp.

References m_currentDomainIndex.

Referenced by removeDatasets().

◆ getAttribute()

IFunction::Attribute MantidQt::MantidWidgets::FunctionModel::getAttribute ( const QString &  attrName) const

Definition at line 174 of file FunctionModel.cpp.

References getCurrentFunction().

◆ getAttributeNames()

QStringList MantidQt::MantidWidgets::FunctionModel::getAttributeNames ( ) const

Definition at line 216 of file FunctionModel.cpp.

References getCurrentFunction(), and hasFunction().

◆ getCurrentFunction()

IFunction_sptr MantidQt::MantidWidgets::FunctionModel::getCurrentFunction ( ) const
overridevirtual

◆ getDatasetDomainNames()

QStringList MantidQt::MantidWidgets::FunctionModel::getDatasetDomainNames ( ) const
overridevirtual

Returns names for the domains of each dataset.

If a dataset has multiple spectra, then a domain name will include the spectrum number of a domain in a workspace. This is required for EditLocalParameterDialog.

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 343 of file FunctionModel.cpp.

References m_datasets.

◆ getDatasetNames()

QStringList MantidQt::MantidWidgets::FunctionModel::getDatasetNames ( ) const
overridevirtual

Returns the workspace names of the datasets.

If a dataset has N spectra, then the workspace name is multiplied by N. This is required for EditLocalParameterDialog.

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 330 of file FunctionModel.cpp.

References m_datasets, and UNUSED_ARG.

◆ getFitFunction()

IFunction_sptr MantidQt::MantidWidgets::FunctionModel::getFitFunction ( ) const
overridevirtual

◆ getFitFunctionWithGlobals()

IFunction_sptr MantidQt::MantidWidgets::FunctionModel::getFitFunctionWithGlobals ( std::size_t const &  index) const
private

Definition at line 68 of file FunctionModel.cpp.

References index, m_function, and m_globalParameterNames.

Referenced by getFitFunction().

◆ getGlobalParameters()

QStringList MantidQt::MantidWidgets::FunctionModel::getGlobalParameters ( ) const
overridevirtual

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 472 of file FunctionModel.cpp.

References m_globalParameterNames.

◆ getLocalParameterConstraint()

QString MantidQt::MantidWidgets::FunctionModel::getLocalParameterConstraint ( const QString &  parName,
int  i 
) const
overridevirtual

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 380 of file FunctionModel.cpp.

References getSingleFunction().

◆ getLocalParameters()

QStringList MantidQt::MantidWidgets::FunctionModel::getLocalParameters ( ) const
overridevirtual

◆ getLocalParameterTie()

QString MantidQt::MantidWidgets::FunctionModel::getLocalParameterTie ( const QString &  parName,
int  i 
) const
overridevirtual

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 369 of file FunctionModel.cpp.

References getSingleFunction().

Referenced by getParameterTie().

◆ getLocalParameterValue()

double MantidQt::MantidWidgets::FunctionModel::getLocalParameterValue ( const QString &  parName,
int  i 
) const
overridevirtual

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 359 of file FunctionModel.cpp.

References getSingleFunction().

◆ getNumberDomains()

int MantidQt::MantidWidgets::FunctionModel::getNumberDomains ( ) const
overridevirtual

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 350 of file FunctionModel.cpp.

References m_numberDomains.

Referenced by checkIndex(), and setGlobalParameterValue().

◆ getParameter()

double MantidQt::MantidWidgets::FunctionModel::getParameter ( const QString &  paramName) const
overridevirtual

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 170 of file FunctionModel.cpp.

References getCurrentFunction().

◆ getParameterDescription()

QString MantidQt::MantidWidgets::FunctionModel::getParameterDescription ( const QString &  paramName) const
overridevirtual

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 184 of file FunctionModel.cpp.

References getCurrentFunction(), and index.

◆ getParameterError()

double MantidQt::MantidWidgets::FunctionModel::getParameterError ( const QString &  paramName) const
overridevirtual

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 178 of file FunctionModel.cpp.

References getCurrentFunction(), and index.

◆ getParameterNames()

QStringList MantidQt::MantidWidgets::FunctionModel::getParameterNames ( ) const
overridevirtual

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 206 of file FunctionModel.cpp.

References getCurrentFunction(), and hasFunction().

Referenced by getLocalParameters().

◆ getParameterTie()

QString MantidQt::MantidWidgets::FunctionModel::getParameterTie ( const QString &  parName) const

Definition at line 194 of file FunctionModel.cpp.

References getLocalParameterTie(), and m_currentDomainIndex.

◆ getSingleFunction()

IFunction_sptr MantidQt::MantidWidgets::FunctionModel::getSingleFunction ( int  index) const
overridevirtual

◆ hasFunction()

bool MantidQt::MantidWidgets::FunctionModel::hasFunction ( ) const
overridevirtual

◆ isGlobal()

bool MantidQt::MantidWidgets::FunctionModel::isGlobal ( const QString &  parName) const
overridevirtual

◆ isLocalParameterFixed()

bool MantidQt::MantidWidgets::FunctionModel::isLocalParameterFixed ( const QString &  parName,
int  i 
) const
overridevirtual

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 363 of file FunctionModel.cpp.

References getSingleFunction().

Referenced by isParameterFixed().

◆ isParameterFixed()

bool MantidQt::MantidWidgets::FunctionModel::isParameterFixed ( const QString &  parName) const

Definition at line 190 of file FunctionModel.cpp.

References isLocalParameterFixed(), and m_currentDomainIndex.

◆ numberOfDomains()

int MantidQt::MantidWidgets::FunctionModel::numberOfDomains ( const QList< FunctionModelDataset > &  datasets) const
private

◆ removeConstraint()

void MantidQt::MantidWidgets::FunctionModel::removeConstraint ( const QString &  paramName)
overridevirtual

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 468 of file FunctionModel.cpp.

References getCurrentFunction().

◆ removeDatasets()

void MantidQt::MantidWidgets::FunctionModel::removeDatasets ( QList< int > &  indices)

Removes datasets (i.e.

workspaces) from the Function model based on the index of the dataset in the QList.

Definition at line 308 of file FunctionModel.cpp.

References checkDatasets(), currentDomainIndex(), m_datasets, numberOfDomains(), setCurrentDomainIndex(), and setNumberDomains().

◆ removeFunction()

void MantidQt::MantidWidgets::FunctionModel::removeFunction ( const QString &  functionIndex)
overridevirtual

◆ setAttribute()

void MantidQt::MantidWidgets::FunctionModel::setAttribute ( const QString &  attrName,
const IFunction::Attribute val 
)

Definition at line 154 of file FunctionModel.cpp.

References getCurrentFunction(), and value.

◆ setBackgroundA0()

QString MantidQt::MantidWidgets::FunctionModel::setBackgroundA0 ( double  value)
overridevirtual

◆ setCurrentDomainIndex()

void MantidQt::MantidWidgets::FunctionModel::setCurrentDomainIndex ( int  index)
overridevirtual

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 354 of file FunctionModel.cpp.

References checkIndex(), index, and m_currentDomainIndex.

Referenced by removeDatasets().

◆ setDatasets() [1/2]

void MantidQt::MantidWidgets::FunctionModel::setDatasets ( const QList< FunctionModelDataset > &  datasets)
overridevirtual

Sets the datasets using a map of <workspace name, spectra list>.

This should be used when the workspaces being fitted have multiple spectra.

Parameters
datasets:: Names of workspaces to be fitted paired to a spectra list.

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 291 of file FunctionModel.cpp.

References checkNumberOfDomains(), and m_datasets.

◆ setDatasets() [2/2]

void MantidQt::MantidWidgets::FunctionModel::setDatasets ( const QStringList &  datasetNames)

Sets the datasets based on their workspace names.

This assumes there is only a single spectrum in the workspaces being fitted.

Parameters
datasetNames:: Names of the workspaces to be fitted.

Definition at line 279 of file FunctionModel.cpp.

References setDatasets().

Referenced by setDatasets().

◆ setFunction()

void MantidQt::MantidWidgets::FunctionModel::setFunction ( IFunction_sptr  fun)
overridevirtual

◆ setGlobalParameters()

void MantidQt::MantidWidgets::FunctionModel::setGlobalParameters ( const QStringList &  globals)
overridevirtual

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 474 of file FunctionModel.cpp.

References m_globalParameterNames.

◆ setGlobalParameterValue()

void MantidQt::MantidWidgets::FunctionModel::setGlobalParameterValue ( const QString &  paramName,
double  value 
)
overridevirtual

◆ setLocalParameterConstraint()

void MantidQt::MantidWidgets::FunctionModel::setLocalParameterConstraint ( const QString &  parName,
int  i,
const QString &  constraint 
)
overridevirtual

◆ setLocalParameterFixed()

void MantidQt::MantidWidgets::FunctionModel::setLocalParameterFixed ( const QString &  parName,
int  i,
bool  fixed 
)
overridevirtual

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 401 of file FunctionModel.cpp.

References getSingleFunction().

Referenced by setParameterFixed().

◆ setLocalParameterTie()

void MantidQt::MantidWidgets::FunctionModel::setLocalParameterTie ( const QString &  parName,
int  i,
const QString &  tie 
)
overridevirtual

◆ setLocalParameterValue() [1/2]

void MantidQt::MantidWidgets::FunctionModel::setLocalParameterValue ( const QString &  parName,
int  i,
double  value 
)
overridevirtual

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 388 of file FunctionModel.cpp.

References getSingleFunction(), and value.

Referenced by setGlobalParameterValue(), and setParameter().

◆ setLocalParameterValue() [2/2]

void MantidQt::MantidWidgets::FunctionModel::setLocalParameterValue ( const QString &  parName,
int  i,
double  value,
double  error 
)
overridevirtual

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 394 of file FunctionModel.cpp.

References error, getSingleFunction(), and value.

◆ setNumberDomains()

void MantidQt::MantidWidgets::FunctionModel::setNumberDomains ( int  nDomains)
overridevirtual

◆ setParameter()

void MantidQt::MantidWidgets::FunctionModel::setParameter ( const QString &  paramName,
double  value 
)
overridevirtual

◆ setParameterError()

void MantidQt::MantidWidgets::FunctionModel::setParameterError ( const QString &  paramName,
double  value 
)
overridevirtual

Implements MantidQt::MantidWidgets::IFunctionModel.

Definition at line 164 of file FunctionModel.cpp.

References getCurrentFunction(), index, and value.

◆ setParameterFixed()

void MantidQt::MantidWidgets::FunctionModel::setParameterFixed ( const QString &  parName,
bool  fixed 
)

Definition at line 198 of file FunctionModel.cpp.

References m_currentDomainIndex, and setLocalParameterFixed().

◆ setParameterTie()

void MantidQt::MantidWidgets::FunctionModel::setParameterTie ( const QString &  parName,
const QString &  tie 
)

Definition at line 202 of file FunctionModel.cpp.

References m_currentDomainIndex, and setLocalParameterTie().

◆ setResolutionFromWorkspace() [1/2]

void MantidQt::MantidWidgets::FunctionModel::setResolutionFromWorkspace ( const IFunction_sptr fun)
private

◆ setResolutionFromWorkspace() [2/2]

void MantidQt::MantidWidgets::FunctionModel::setResolutionFromWorkspace ( const IFunction_sptr fun,
const MatrixWorkspace_sptr workspace 
)
private

Definition at line 569 of file FunctionModel.cpp.

References workspace.

◆ updateGlobals()

void MantidQt::MantidWidgets::FunctionModel::updateGlobals ( )
private

Definition at line 541 of file FunctionModel.cpp.

References getCurrentFunction(), and m_globalParameterNames.

Referenced by addFunction(), and removeFunction().

◆ updateMultiDatasetAttributes()

void MantidQt::MantidWidgets::FunctionModel::updateMultiDatasetAttributes ( const IFunction fun)

◆ updateMultiDatasetParameters()

void MantidQt::MantidWidgets::FunctionModel::updateMultiDatasetParameters ( const IFunction fun)
overridevirtual

◆ updateParameters()

void MantidQt::MantidWidgets::FunctionModel::updateParameters ( const IFunction fun)
overridevirtual

Member Data Documentation

◆ m_currentDomainIndex

size_t MantidQt::MantidWidgets::FunctionModel::m_currentDomainIndex = 0
private

◆ m_datasets

QList<FunctionModelDataset> MantidQt::MantidWidgets::FunctionModel::m_datasets
mutableprivate

◆ m_function

MultiDomainFunction_sptr MantidQt::MantidWidgets::FunctionModel::m_function
protected

◆ m_globalParameterNames

QStringList MantidQt::MantidWidgets::FunctionModel::m_globalParameterNames
mutableprivate

◆ m_numberDomains

size_t MantidQt::MantidWidgets::FunctionModel::m_numberDomains = 0
protected

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