Mantid
|
#include <FunctionModel.h>
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 ¶mName) const override |
QString | getParameterDescription (const QString ¶mName) const override |
double | getParameterError (const QString ¶mName) 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 ¶mName) 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 ¶mName, 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 ¶mName, double value) override |
void | setParameterError (const QString ¶mName, 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 ¶mName, 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 ¶mName) const =0 |
virtual QString | getParameterDescription (const QString ¶mName) const =0 |
virtual double | getParameterError (const QString ¶mName) 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 ¶mName)=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 ¶mName, 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 ¶mName, double value)=0 |
virtual void | setParameterError (const QString ¶mName, 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< FunctionModelDataset > | m_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) |
Definition at line 23 of file FunctionModel.h.
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 463 of file FunctionModel.cpp.
References getCurrentFunction(), and MantidQt::MantidWidgets::getFunctionWithPrefix().
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.
datasetNames | :: Names of the workspaces to be added. |
Definition at line 299 of file FunctionModel.cpp.
References m_datasets, numberOfDomains(), and setNumberDomains().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 95 of file FunctionModel.cpp.
References MantidQt::MantidWidgets::IFunctionModel::getFunctionString(), MantidQt::MantidWidgets::getFunctionWithPrefix(), getSingleFunction(), hasFunction(), Mantid::Kernel::SingletonHolder< T >::Instance(), m_function, m_numberDomains, MantidQt::MantidWidgets::IFunctionModel::setFunctionString(), and updateGlobals().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 455 of file FunctionModel.cpp.
References m_currentDomainIndex, and setLocalParameterTie().
|
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().
|
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().
|
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().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 352 of file FunctionModel.cpp.
References m_currentDomainIndex.
Referenced by removeDatasets().
IFunction::Attribute MantidQt::MantidWidgets::FunctionModel::getAttribute | ( | const QString & | attrName | ) | const |
Definition at line 174 of file FunctionModel.cpp.
References getCurrentFunction().
QStringList MantidQt::MantidWidgets::FunctionModel::getAttributeNames | ( | ) | const |
Definition at line 216 of file FunctionModel.cpp.
References getCurrentFunction(), and hasFunction().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 235 of file FunctionModel.cpp.
References getSingleFunction(), and m_currentDomainIndex.
Referenced by addConstraint(), MantidQt::MantidWidgets::ConvolutionFunctionModel::findComponentPrefixes(), getAttribute(), getAttributeNames(), getParameter(), getParameterDescription(), getParameterError(), getParameterNames(), removeConstraint(), setAttribute(), setBackgroundA0(), setParameterError(), updateGlobals(), and updateParameters().
|
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.
|
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.
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 46 of file FunctionModel.cpp.
References getFitFunctionWithGlobals(), m_currentDomainIndex, and m_function.
|
private |
Definition at line 68 of file FunctionModel.cpp.
References index, m_function, and m_globalParameterNames.
Referenced by getFitFunction().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 472 of file FunctionModel.cpp.
References m_globalParameterNames.
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 380 of file FunctionModel.cpp.
References getSingleFunction().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 476 of file FunctionModel.cpp.
References getParameterNames(), and m_globalParameterNames.
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 369 of file FunctionModel.cpp.
References getSingleFunction().
Referenced by getParameterTie().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 359 of file FunctionModel.cpp.
References getSingleFunction().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 350 of file FunctionModel.cpp.
References m_numberDomains.
Referenced by checkIndex(), and setGlobalParameterValue().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 170 of file FunctionModel.cpp.
References getCurrentFunction().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 184 of file FunctionModel.cpp.
References getCurrentFunction(), and index.
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 178 of file FunctionModel.cpp.
References getCurrentFunction(), and index.
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 206 of file FunctionModel.cpp.
References getCurrentFunction(), and hasFunction().
Referenced by getLocalParameters().
QString MantidQt::MantidWidgets::FunctionModel::getParameterTie | ( | const QString & | parName | ) | const |
Definition at line 194 of file FunctionModel.cpp.
References getLocalParameterTie(), and m_currentDomainIndex.
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 227 of file FunctionModel.cpp.
References checkIndex(), hasFunction(), index, and m_function.
Referenced by addFunction(), getCurrentFunction(), getLocalParameterConstraint(), getLocalParameterTie(), getLocalParameterValue(), isLocalParameterFixed(), removeFunction(), setLocalParameterConstraint(), setLocalParameterFixed(), setLocalParameterTie(), and setLocalParameterValue().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 89 of file FunctionModel.cpp.
References m_function.
Referenced by addFunction(), getAttributeNames(), getParameterNames(), getSingleFunction(), setNumberDomains(), updateMultiDatasetAttributes(), updateMultiDatasetParameters(), and updateParameters().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 585 of file FunctionModel.cpp.
References m_globalParameterNames.
Referenced by setGlobalParameterValue(), and setParameter().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 363 of file FunctionModel.cpp.
References getSingleFunction().
Referenced by isParameterFixed().
bool MantidQt::MantidWidgets::FunctionModel::isParameterFixed | ( | const QString & | parName | ) | const |
Definition at line 190 of file FunctionModel.cpp.
References isLocalParameterFixed(), and m_currentDomainIndex.
|
private |
Definition at line 501 of file FunctionModel.cpp.
Referenced by addDatasets(), checkDatasets(), checkNumberOfDomains(), and removeDatasets().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 468 of file FunctionModel.cpp.
References getCurrentFunction().
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().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 119 of file FunctionModel.cpp.
References MantidQt::MantidWidgets::IFunctionModel::clear(), MantidQt::MantidWidgets::getFunctionWithPrefix(), getSingleFunction(), index, m_function, m_numberDomains, MantidQt::MantidWidgets::splitFunctionPrefix(), and updateGlobals().
void MantidQt::MantidWidgets::FunctionModel::setAttribute | ( | const QString & | attrName, |
const IFunction::Attribute & | val | ||
) |
Definition at line 154 of file FunctionModel.cpp.
References getCurrentFunction(), and value.
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 587 of file FunctionModel.cpp.
References getCurrentFunction(), Mantid::API::ParamFunction::hasParameter(), std::to_string(), and value.
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 354 of file FunctionModel.cpp.
References checkIndex(), index, and m_currentDomainIndex.
Referenced by removeDatasets().
|
overridevirtual |
Sets the datasets using a map of <workspace name, spectra list>.
This should be used when the workspaces being fitted have multiple spectra.
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.
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.
datasetNames | :: Names of the workspaces to be fitted. |
Definition at line 279 of file FunctionModel.cpp.
References setDatasets().
Referenced by setDatasets().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 28 of file FunctionModel.cpp.
References m_function, m_globalParameterNames, m_numberDomains, and setResolutionFromWorkspace().
Referenced by MantidQt::MantidWidgets::ConvolutionFunctionModel::setFunction().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 474 of file FunctionModel.cpp.
References m_globalParameterNames.
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 449 of file FunctionModel.cpp.
References getNumberDomains(), isGlobal(), setLocalParameterValue(), and value.
Referenced by setParameter().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 431 of file FunctionModel.cpp.
References Mantid::Kernel::Logger::error(), Mantid::API::g_log, MantidQt::MantidWidgets::getFunctionWithPrefix(), getSingleFunction(), MantidQt::MantidWidgets::splitConstraintString(), and MantidQt::MantidWidgets::splitParameterName().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 401 of file FunctionModel.cpp.
References getSingleFunction().
Referenced by setParameterFixed().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 411 of file FunctionModel.cpp.
References Mantid::Kernel::Logger::error(), Mantid::API::g_log, and getSingleFunction().
Referenced by changeTie(), and setParameterTie().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 388 of file FunctionModel.cpp.
References getSingleFunction(), and value.
Referenced by setGlobalParameterValue(), and setParameter().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 394 of file FunctionModel.cpp.
References error, getSingleFunction(), and value.
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 239 of file FunctionModel.cpp.
References hasFunction(), m_currentDomainIndex, m_function, and m_numberDomains.
Referenced by addDatasets(), and removeDatasets().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 147 of file FunctionModel.cpp.
References isGlobal(), m_currentDomainIndex, setGlobalParameterValue(), setLocalParameterValue(), and value.
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 164 of file FunctionModel.cpp.
References getCurrentFunction(), index, and value.
void MantidQt::MantidWidgets::FunctionModel::setParameterFixed | ( | const QString & | parName, |
bool | fixed | ||
) |
Definition at line 198 of file FunctionModel.cpp.
References m_currentDomainIndex, and setLocalParameterFixed().
void MantidQt::MantidWidgets::FunctionModel::setParameterTie | ( | const QString & | parName, |
const QString & | tie | ||
) |
Definition at line 202 of file FunctionModel.cpp.
References m_currentDomainIndex, and setLocalParameterTie().
|
private |
Definition at line 552 of file FunctionModel.cpp.
References index, Mantid::Kernel::SingletonHolder< T >::Instance(), n, and setResolutionFromWorkspace().
Referenced by setFunction(), and setResolutionFromWorkspace().
|
private |
Definition at line 569 of file FunctionModel.cpp.
References workspace.
|
private |
Definition at line 541 of file FunctionModel.cpp.
References getCurrentFunction(), and m_globalParameterNames.
Referenced by addFunction(), and removeFunction().
void MantidQt::MantidWidgets::FunctionModel::updateMultiDatasetAttributes | ( | const IFunction & | fun | ) |
Definition at line 524 of file FunctionModel.cpp.
References Mantid::API::IFunction::getAttribute(), Mantid::API::IFunction::getAttributeNames(), hasFunction(), m_function, and Mantid::API::IFunction::nAttributes().
Referenced by updateMultiDatasetParameters().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 517 of file FunctionModel.cpp.
References MantidQt::MantidWidgets::IFunctionModel::copyParametersAndErrors(), hasFunction(), m_function, and updateMultiDatasetAttributes().
|
overridevirtual |
Implements MantidQt::MantidWidgets::IFunctionModel.
Definition at line 534 of file FunctionModel.cpp.
References MantidQt::MantidWidgets::IFunctionModel::copyParametersAndErrors(), getCurrentFunction(), and hasFunction().
|
private |
Definition at line 91 of file FunctionModel.h.
Referenced by changeTie(), currentDomainIndex(), getCurrentFunction(), getFitFunction(), getParameterTie(), isParameterFixed(), setCurrentDomainIndex(), setNumberDomains(), setParameter(), setParameterFixed(), and setParameterTie().
|
mutableprivate |
Definition at line 94 of file FunctionModel.h.
Referenced by addDatasets(), checkDatasets(), getDatasetDomainNames(), getDatasetNames(), removeDatasets(), and setDatasets().
|
protected |
Definition at line 79 of file FunctionModel.h.
Referenced by addFunction(), getFitFunction(), getFitFunctionWithGlobals(), getSingleFunction(), hasFunction(), removeFunction(), setFunction(), setNumberDomains(), updateMultiDatasetAttributes(), and updateMultiDatasetParameters().
|
mutableprivate |
Definition at line 95 of file FunctionModel.h.
Referenced by getFitFunctionWithGlobals(), getGlobalParameters(), getLocalParameters(), isGlobal(), setFunction(), setGlobalParameters(), and updateGlobals().
|
protected |
Definition at line 78 of file FunctionModel.h.
Referenced by addFunction(), checkDatasets(), checkNumberOfDomains(), getNumberDomains(), removeFunction(), setFunction(), MantidQt::MantidWidgets::ConvolutionFunctionModel::setModel(), and setNumberDomains().