Mantid
|
Class FitPropertyBrowser implements QtPropertyBrowser to display and control fitting function parameters and settings. More...
#include <FunctionBrowser.h>
Public Slots | |
void | addDatasets (const QStringList &names) |
Add some datasets to those already set. More... | |
void | removeDatasets (const QList< int > &indices) |
Remove local parameter values for a number of datasets. More... | |
void | resetLocalParameters () |
void | setCurrentDataset (int i) override |
Set current dataset. More... | |
void | setDatasets (const QList< FunctionModelDataset > &datasets) override |
Sets the datasets being fitted. More... | |
void | setDatasets (const QStringList &datasetNames) override |
Sets the datasets being fitted. More... | |
void | setNumberOfDatasets (int n) override |
Set new number of the datasets. More... | |
Signals | |
void | attributeChanged (const QString &attributeName) |
void | currentFunctionChanged () |
User selects a different function (or one of it's sub-properties) More... | |
void | functionStructureChanged () |
void | globalsChanged () |
void | localParameterButtonClicked (const QString &parName) |
In multi-dataset context a button value editor was clicked. More... | |
void | parameterChanged (const QString &funcIndex, const QString ¶mName) |
Public Member Functions | |
void | clear () override |
Clear the contents. More... | |
void | clearErrors () override |
Clear all errors. More... | |
boost::optional< QString > | currentFunctionIndex () |
Return index of the current function, if one is selected. More... | |
FunctionBrowser (QWidget *parent=nullptr, bool multi=false, const std::vector< std::string > &categories=std::vector< std::string >()) | |
Constructor. More... | |
int | getCurrentDataset () const override |
Get the index of the current dataset. More... | |
QStringList | getDatasetDomainNames () const override |
Get the names of the dataset domains. More... | |
QStringList | getDatasetNames () const override |
Get the names of datasets. More... | |
QString | getFitFunctionString () const |
IFunction_sptr | getFunction () |
Return the function. More... | |
IFunction_sptr | getFunctionByIndex (const QString &index) |
Return a function with specified index. More... | |
QString | getFunctionString () override |
Return FunctionFactory function string. More... | |
IFunction_sptr | getGlobalFunction () override |
Return the multidomain function if number of datasets is greater than 1. More... | |
QStringList | getGlobalParameters () const |
Get a list of names of global parameters. More... | |
double | getLocalParameterError (const QString &parName, int i) const |
Get error of a local parameter. More... | |
QStringList | getLocalParameters () const |
Get a list of names of local parameters. More... | |
QString | getLocalParameterTie (const QString &parName, int i) const override |
Get the tie for a local parameter. More... | |
double | getLocalParameterValue (const QString &parName, int i) const override |
Get value of a local parameter. More... | |
int | getNumberOfDatasets () const override |
Get the number of datasets. More... | |
double | getParameter (const QString ¶mName) const |
Get a value of a parameter. More... | |
bool | hasFunction () const |
Check if a function is set. More... | |
void | hideGlobalCheckbox () |
bool | isLocalParameterFixed (const QString &parName, int i) const override |
Check if a local parameter is fixed. More... | |
void | setBackgroundA0 (double value) |
Set a parameter that is responsible for the background level. More... | |
void | setColumnSizes (int s0, int s1, int s2=-1) |
Resize the browser's columns. More... | |
void | setErrorsEnabled (bool enabled) override |
Set error display on/off. More... | |
void | setFunction (const QString &funStr) override |
Set the function in the browser. More... | |
void | setFunction (IFunction_sptr fun) |
Set the function in the browser. More... | |
void | setGlobalParameters (const QStringList &globals) |
void | setLocalParameterFixed (const QString &parName, int i, bool fixed) override |
Fix/unfix local parameter. More... | |
void | setLocalParameterTie (const QString &parName, int i, QString tie) override |
Set a tie for a local parameter. More... | |
void | setLocalParameterValue (const QString &parName, int i, double value) override |
Set value of a local parameter. More... | |
void | setLocalParameterValue (const QString &parName, int i, double value, double error) |
Set value and error of a local parameter. More... | |
void | setParameter (const QString ¶mName, double value) |
Update the function parameter value. More... | |
void | setParameterError (const QString ¶mName, double error) |
Update the function parameter error. More... | |
void | setStretchLastColumn (bool stretch) |
Set the last column to stretch. More... | |
void | showGlobalCheckbox () |
void | updateMultiDatasetAttributes (const IFunction &fun) |
Update parameter values in the browser to match those of a function. More... | |
void | updateMultiDatasetParameters (const IFunction &fun) override |
Update parameter values in the browser to match those of a function. More... | |
void | updateMultiDatasetParameters (const ITableWorkspace ¶mTable) override |
Update parameter values in the browser to match those in a table workspace. More... | |
void | updateParameters (const IFunction &fun) override |
Update parameter values in the browser to match those of a function. More... | |
FunctionTreeView * | view () const |
virtual | ~FunctionBrowser () override |
Destructor. More... | |
Public Member Functions inherited from MantidQt::MantidWidgets::IFunctionBrowser | |
virtual void | clear ()=0 |
virtual void | clearErrors ()=0 |
virtual int | getCurrentDataset () const =0 |
virtual QStringList | getDatasetDomainNames () const =0 |
virtual QStringList | getDatasetNames () const =0 |
virtual QString | getFunctionString ()=0 |
virtual Mantid::API::IFunction_sptr | getGlobalFunction ()=0 |
virtual QString | getLocalParameterTie (const QString &parName, int i) const =0 |
virtual double | getLocalParameterValue (const QString &parName, int i) const =0 |
virtual int | getNumberOfDatasets () const =0 |
virtual bool | isLocalParameterFixed (const QString &parName, int i) const =0 |
virtual void | setCurrentDataset (int i)=0 |
virtual void | setDatasets (const QList< FunctionModelDataset > &datasets)=0 |
virtual void | setDatasets (const QStringList &datasetNames)=0 |
virtual void | setErrorsEnabled (bool enabled)=0 |
virtual void | setFunction (const QString &funStr)=0 |
virtual void | setLocalParameterFixed (const QString &parName, int i, bool fixed)=0 |
virtual void | setLocalParameterTie (const QString &parName, int i, QString tie)=0 |
virtual void | setLocalParameterValue (const QString &parName, int i, double value)=0 |
virtual void | setNumberOfDatasets (int n)=0 |
virtual void | updateMultiDatasetParameters (const Mantid::API::IFunction &fun)=0 |
virtual void | updateMultiDatasetParameters (const Mantid::API::ITableWorkspace ¶mTable)=0 |
virtual void | updateParameters (const Mantid::API::IFunction &fun)=0 |
virtual | ~IFunctionBrowser ()=default |
Protected Attributes | |
std::unique_ptr< FunctionMultiDomainPresenter > | m_presenter |
Class FitPropertyBrowser implements QtPropertyBrowser to display and control fitting function parameters and settings.
Definition at line 40 of file FunctionBrowser.h.
MantidQt::MantidWidgets::FunctionBrowser::FunctionBrowser | ( | QWidget * | parent = nullptr , |
bool | multi = false , |
||
const std::vector< std::string > & | categories = std::vector<std::string>() |
||
) |
Constructor.
parent | :: The parent widget. |
multi | :: Option to use the browser for multi-dataset fitting. |
categories | :: Function categories to be included to the Add Function dialog. An empty vector means include all available categories. |
Definition at line 46 of file FunctionBrowser.cpp.
References attributeChanged(), functionStructureChanged(), m_presenter, parameterChanged(), and view().
|
overridevirtualdefault |
Destructor.
|
slot |
Add some datasets to those already set.
names | :: A list of names for the new datasets. |
Definition at line 186 of file FunctionBrowser.cpp.
References m_presenter.
|
signal |
Referenced by FunctionBrowser().
|
overridevirtual |
Clear the contents.
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 68 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Clear all errors.
Clear all errors, if they are set.
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 285 of file FunctionBrowser.cpp.
References m_presenter.
|
signal |
User selects a different function (or one of it's sub-properties)
boost::optional< QString > MantidQt::MantidWidgets::FunctionBrowser::currentFunctionIndex | ( | ) |
Return index of the current function, if one is selected.
Definition at line 293 of file FunctionBrowser.cpp.
References m_presenter.
|
signal |
Referenced by FunctionBrowser().
|
overridevirtual |
Get the index of the current dataset.
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 262 of file FunctionBrowser.cpp.
References m_presenter.
Referenced by updateMultiDatasetParameters().
|
overridevirtual |
Get the names of the dataset domains.
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 137 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Get the names of datasets.
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 134 of file FunctionBrowser.cpp.
References m_presenter.
QString MantidQt::MantidWidgets::FunctionBrowser::getFitFunctionString | ( | ) | const |
Definition at line 297 of file FunctionBrowser.cpp.
References m_presenter.
Mantid::API::IFunction_sptr MantidQt::MantidWidgets::FunctionBrowser::getFunction | ( | ) |
IFunction_sptr MantidQt::MantidWidgets::FunctionBrowser::getFunctionByIndex | ( | const QString & | index | ) |
Return a function with specified index.
Return function at specified function index (e.g.
f0.)
index | :: Index of the function, or empty string for top-level function |
Definition at line 87 of file FunctionBrowser.cpp.
References index, and m_presenter.
|
overridevirtual |
Return FunctionFactory function string.
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 124 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Return the multidomain function if number of datasets is greater than 1.
Return the multidomain function for multi-dataset fitting.
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 189 of file FunctionBrowser.cpp.
References m_presenter.
Referenced by MantidQt::MantidWidgets::MuonFitPropertyBrowser::doTFAsymmFit().
QStringList MantidQt::MantidWidgets::FunctionBrowser::getGlobalParameters | ( | ) | const |
Get a list of names of global parameters.
Definition at line 287 of file FunctionBrowser.cpp.
References m_presenter.
Referenced by updateMultiDatasetParameters().
double MantidQt::MantidWidgets::FunctionBrowser::getLocalParameterError | ( | const QString & | parName, |
int | i | ||
) | const |
Get error of a local parameter.
Definition at line 171 of file FunctionBrowser.cpp.
References m_presenter.
QStringList MantidQt::MantidWidgets::FunctionBrowser::getLocalParameters | ( | ) | const |
Get a list of names of local parameters.
Definition at line 289 of file FunctionBrowser.cpp.
References m_presenter.
Referenced by updateMultiDatasetParameters().
|
overridevirtual |
Get the tie for a local parameter.
parName | :: Parameter name |
i | :: Index of a dataset. |
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 209 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Get value of a local parameter.
parName | :: Name of a parameter. |
i | :: Data set index. |
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 158 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Get the number of datasets.
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 131 of file FunctionBrowser.cpp.
References m_presenter.
double MantidQt::MantidWidgets::FunctionBrowser::getParameter | ( | const QString & | paramName | ) | const |
Get a value of a parameter.
paramName | :: Fully qualified parameter name (includes function index) |
Definition at line 112 of file FunctionBrowser.cpp.
References m_presenter.
|
signal |
bool MantidQt::MantidWidgets::FunctionBrowser::hasFunction | ( | ) | const |
Check if a function is set.
Definition at line 128 of file FunctionBrowser.cpp.
References m_presenter.
void MantidQt::MantidWidgets::FunctionBrowser::hideGlobalCheckbox | ( | ) |
Definition at line 301 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Check if a local parameter is fixed.
parName | :: Parameter name |
i | :: Index of a dataset. |
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 202 of file FunctionBrowser.cpp.
References m_presenter.
|
signal |
In multi-dataset context a button value editor was clicked.
|
signal |
Referenced by FunctionBrowser().
|
slot |
Remove local parameter values for a number of datasets.
indices | :: A list of indices of datasets to remove. |
Definition at line 182 of file FunctionBrowser.cpp.
References m_presenter.
|
slot |
Definition at line 175 of file FunctionBrowser.cpp.
void MantidQt::MantidWidgets::FunctionBrowser::setBackgroundA0 | ( | double | value | ) |
Set a parameter that is responsible for the background level.
Definition at line 299 of file FunctionBrowser.cpp.
References m_presenter, and value.
void MantidQt::MantidWidgets::FunctionBrowser::setColumnSizes | ( | int | s0, |
int | s1, | ||
int | s2 = -1 |
||
) |
Resize the browser's columns.
s0 | :: New size for the first column (Parameter). |
s1 | :: New size for the second column (Value). |
s2 | :: New size for the third optional column (Global). |
Definition at line 268 of file FunctionBrowser.cpp.
References m_presenter.
|
overrideslot |
|
overrideslot |
Sets the datasets being fitted.
They will be displayed by the local parameter editing dialog.
datasets | :: Names of workspaces to be fitted maped to a spectra list. |
Definition at line 151 of file FunctionBrowser.cpp.
References m_presenter.
|
overrideslot |
Sets the datasets being fitted.
They will be displayed by the local parameter editing dialog.
datasetNames | :: Names of the datasets |
Definition at line 146 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Set error display on/off.
Set display of parameter errors on/off.
enabled | :: [input] On/off display of errors |
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 280 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Set the function in the browser.
funStr | :: FunctionFactory function creation string |
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 74 of file FunctionBrowser.cpp.
References m_presenter.
void MantidQt::MantidWidgets::FunctionBrowser::setFunction | ( | IFunction_sptr | fun | ) |
Set the function in the browser.
fun | :: A function |
Definition at line 80 of file FunctionBrowser.cpp.
References m_presenter.
void MantidQt::MantidWidgets::FunctionBrowser::setGlobalParameters | ( | const QStringList & | globals | ) |
Definition at line 291 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Fix/unfix local parameter.
Fix/unfix a local parameter.
parName | :: Parameter name |
i | :: Index of a dataset. |
fixed | :: Make it fixed (true) or free (false) |
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 195 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Set a tie for a local parameter.
parName | :: Parameter name |
i | :: Index of a dataset. |
tie | :: A tie string. |
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 217 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Set value of a local parameter.
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 162 of file FunctionBrowser.cpp.
References m_presenter, and value.
Referenced by updateMultiDatasetParameters().
void MantidQt::MantidWidgets::FunctionBrowser::setLocalParameterValue | ( | const QString & | parName, |
int | i, | ||
double | value, | ||
double | error | ||
) |
Set value and error of a local parameter.
Definition at line 166 of file FunctionBrowser.cpp.
References error, m_presenter, and value.
|
overrideslot |
Set new number of the datasets.
n | :: New value for the number of datasets. |
Definition at line 141 of file FunctionBrowser.cpp.
References m_presenter, and n.
void MantidQt::MantidWidgets::FunctionBrowser::setParameter | ( | const QString & | paramName, |
double | value | ||
) |
Update the function parameter value.
Updates the function parameter value.
paramName | :: Fully qualified parameter name (includes function index) |
value | :: New value |
Definition at line 95 of file FunctionBrowser.cpp.
References m_presenter, and value.
Referenced by updateMultiDatasetParameters().
void MantidQt::MantidWidgets::FunctionBrowser::setParameterError | ( | const QString & | paramName, |
double | error | ||
) |
Update the function parameter error.
Updates the function parameter error.
paramName | :: Fully qualified parameter name (includes function index) |
error | :: New error |
Definition at line 104 of file FunctionBrowser.cpp.
References error, and m_presenter.
Referenced by updateMultiDatasetParameters().
void MantidQt::MantidWidgets::FunctionBrowser::setStretchLastColumn | ( | bool | stretch | ) |
Set the last column to stretch.
This avoids a vertical scroll bar.
stretch | :: A bool whether or not to stretch the last column. |
Definition at line 274 of file FunctionBrowser.cpp.
References m_presenter.
void MantidQt::MantidWidgets::FunctionBrowser::showGlobalCheckbox | ( | ) |
Definition at line 303 of file FunctionBrowser.cpp.
References m_presenter.
void MantidQt::MantidWidgets::FunctionBrowser::updateMultiDatasetAttributes | ( | const IFunction & | fun | ) |
Update parameter values in the browser to match those of a function.
Update the interface to have the same attribute values as in a function.
fun | :: A function to get attribute values from. |
Definition at line 229 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Update parameter values in the browser to match those of a function.
Update the interface to have the same parameter values as in a function.
fun | :: A function to get parameter values from. |
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 223 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Update parameter values in the browser to match those in a table workspace.
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 233 of file FunctionBrowser.cpp.
References Mantid::API::ITableWorkspace::getColumn(), getCurrentDataset(), getGlobalParameters(), getLocalParameters(), Mantid::API::ITableWorkspace::rowCount(), setLocalParameterValue(), setParameter(), and setParameterError().
|
overridevirtual |
Update parameter values in the browser to match those of a function.
fun | :: A function to copy the values from. It must have the same type (composition) as the function in the browser. |
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 119 of file FunctionBrowser.cpp.
References m_presenter.
FunctionTreeView * MantidQt::MantidWidgets::FunctionBrowser::view | ( | ) | const |
Definition at line 295 of file FunctionBrowser.cpp.
References m_presenter.
Referenced by FunctionBrowser().
|
protected |
Definition at line 148 of file FunctionBrowser.h.
Referenced by addDatasets(), clear(), clearErrors(), currentFunctionIndex(), FunctionBrowser(), getCurrentDataset(), getDatasetDomainNames(), getDatasetNames(), getFitFunctionString(), getFunction(), getFunctionByIndex(), getFunctionString(), getGlobalFunction(), getGlobalParameters(), getLocalParameterError(), getLocalParameters(), getLocalParameterTie(), getLocalParameterValue(), getNumberOfDatasets(), getParameter(), hasFunction(), hideGlobalCheckbox(), isLocalParameterFixed(), removeDatasets(), setBackgroundA0(), setColumnSizes(), setCurrentDataset(), setDatasets(), setErrorsEnabled(), setFunction(), setGlobalParameters(), setLocalParameterFixed(), setLocalParameterTie(), setLocalParameterValue(), setNumberOfDatasets(), setParameter(), setParameterError(), setStretchLastColumn(), showGlobalCheckbox(), updateMultiDatasetAttributes(), updateMultiDatasetParameters(), updateParameters(), and view().