|
Mantid
|
Class FitPropertyBrowser implements QtPropertyBrowser to display and control fitting function parameters and settings. More...
#include <FunctionBrowser.h>
Public Slots | |
| void | addDatasets (const std::vector< std::string > &names) |
| Add some datasets to those already set. | |
| void | removeDatasets (const QList< int > &indices) |
| Remove local parameter values for a number of datasets. | |
| void | resetLocalParameters () |
| void | setCurrentDataset (int i) override |
| Set current dataset. | |
| void | setDatasets (const QList< FunctionModelDataset > &datasets) override |
| Sets the datasets being fitted. | |
| void | setDatasets (const std::vector< std::string > &datasetNames) override |
| Sets the datasets being fitted. | |
| void | setNumberOfDatasets (int n) override |
| Set new number of the datasets. | |
Signals | |
| void | attributeChanged (std::string const &attributeName) |
| void | currentFunctionChanged () |
| User selects a different function (or one of it's sub-properties) | |
| void | functionStructureChanged () |
| void | globalsChanged () |
| void | localParameterButtonClicked (std::string const &parName) |
| In multi-dataset context a button value editor was clicked. | |
| void | parameterChanged (std::string const &funcIndex, std::string const ¶mName) |
Public Member Functions | |
| void | clear () override |
| Clear the contents. | |
| void | clearErrors () override |
| Clear all errors. | |
| std::optional< std::string > | currentFunctionIndex () |
| Return index of the current function, if one is selected. | |
| FunctionBrowser (QWidget *parent=nullptr, bool multi=false, const std::vector< std::string > &categories=std::vector< std::string >()) | |
| Constructor. | |
| int | getCurrentDataset () const override |
| Get the index of the current dataset. | |
| std::vector< std::string > | getDatasetDomainNames () const override |
| Get the names of the dataset domains. | |
| std::vector< std::string > | getDatasetNames () const override |
| Get the names of datasets. | |
| std::string | getFitFunctionString () const |
| IFunction_sptr | getFunction () |
| Return the function. | |
| IFunction_sptr | getFunctionByIndex (std::string const &index) |
| Return a function with specified index. | |
| std::string | getFunctionString () override |
| Return FunctionFactory function string. | |
| IFunction_sptr | getGlobalFunction () override |
| Return the multidomain function if number of datasets is greater than 1. | |
| std::vector< std::string > | getGlobalParameters () const |
| Get a list of names of global parameters. | |
| double | getLocalParameterError (std::string const ¶meterName, int i) const |
| Get error of a local parameter. | |
| std::vector< std::string > | getLocalParameters () const |
| Get a list of names of local parameters. | |
| std::string | getLocalParameterTie (std::string const ¶meterName, int i) const override |
| Get the tie for a local parameter. | |
| double | getLocalParameterValue (std::string const ¶meterName, int i) const override |
| Get value of a local parameter. | |
| int | getNumberOfDatasets () const override |
| Get the number of datasets. | |
| double | getParameter (std::string const ¶meterName) const |
| Get a value of a parameter. | |
| bool | hasFunction () const |
| Check if a function is set. | |
| void | hideGlobalCheckbox () |
| bool | isLocalParameterFixed (std::string const ¶meterName, int i) const override |
| Check if a local parameter is fixed. | |
| void | setBackgroundA0 (double value) |
| Set a parameter that is responsible for the background level. | |
| void | setColumnSizes (int s0, int s1, int s2=-1) |
| Resize the browser's columns. | |
| void | setErrorsEnabled (bool enabled) override |
| Set error display on/off. | |
| void | setFunction (IFunction_sptr fun) |
| Set the function in the browser. | |
| void | setFunction (std::string const &funStr) override |
| Set the function in the browser. | |
| void | setGlobalParameters (std::vector< std::string > const &globals) |
| void | setLocalParameterFixed (std::string const ¶meterName, int i, bool fixed) override |
| Fix/unfix local parameter. | |
| void | setLocalParameterTie (std::string const ¶meterName, int i, std::string const &tie) override |
| Set a tie for a local parameter. | |
| void | setLocalParameterValue (std::string const ¶meterName, int i, double value) override |
| Set value of a local parameter. | |
| void | setLocalParameterValue (std::string const ¶meterName, int i, double value, double error) |
| Set value and error of a local parameter. | |
| void | setParameter (std::string const ¶meterName, double value) |
| Update the function parameter value. | |
| void | setParameterError (std::string const ¶meterName, double error) |
| Update the function parameter error. | |
| void | setStretchLastColumn (bool stretch) |
| Set the last column to stretch. | |
| void | showGlobalCheckbox () |
| void | updateMultiDatasetAttributes (const IFunction &fun) |
| Update parameter values in the browser to match those of a function. | |
| void | updateMultiDatasetParameters (const IFunction &fun) override |
| Update parameter values in the browser to match those of a function. | |
| void | updateMultiDatasetParameters (const ITableWorkspace ¶mTable) override |
| Update parameter values in the browser to match those in a table workspace. | |
| void | updateParameters (const IFunction &fun) override |
| Update parameter values in the browser to match those of a function. | |
| FunctionTreeView * | view () const |
| virtual | ~FunctionBrowser () override |
| Destructor. | |
Public Member Functions inherited from MantidQt::MantidWidgets::IFunctionBrowser | |
| virtual void | setCurrentDataset (int i)=0 |
| virtual void | setDatasets (const QList< FunctionModelDataset > &datasets)=0 |
| virtual void | setDatasets (const std::vector< std::string > &datasetNames)=0 |
| virtual void | setNumberOfDatasets (int n)=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, and parameterChanged().
|
overridevirtualdefault |
Destructor.
|
slot |
Add some datasets to those already set.
| names | :: A list of names for the new datasets. |
Definition at line 190 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 289 of file FunctionBrowser.cpp.
References m_presenter.
|
signal |
User selects a different function (or one of it's sub-properties)
| std::optional< std::string > MantidQt::MantidWidgets::FunctionBrowser::currentFunctionIndex | ( | ) |
Return index of the current function, if one is selected.
Definition at line 299 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 266 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 139 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Get the names of datasets.
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 136 of file FunctionBrowser.cpp.
References m_presenter.
| std::string MantidQt::MantidWidgets::FunctionBrowser::getFitFunctionString | ( | ) | const |
Definition at line 303 of file FunctionBrowser.cpp.
References m_presenter.
| Mantid::API::IFunction_sptr MantidQt::MantidWidgets::FunctionBrowser::getFunction | ( | ) |
| IFunction_sptr MantidQt::MantidWidgets::FunctionBrowser::getFunctionByIndex | ( | std::string const & | 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 126 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 193 of file FunctionBrowser.cpp.
References m_presenter.
Referenced by MantidQt::MantidWidgets::MuonFitPropertyBrowser::doTFAsymmFit().
| std::vector< std::string > MantidQt::MantidWidgets::FunctionBrowser::getGlobalParameters | ( | ) | const |
Get a list of names of global parameters.
Definition at line 291 of file FunctionBrowser.cpp.
References m_presenter.
Referenced by updateMultiDatasetParameters().
| double MantidQt::MantidWidgets::FunctionBrowser::getLocalParameterError | ( | std::string const & | parameterName, |
| int | i | ||
| ) | const |
Get error of a local parameter.
Definition at line 175 of file FunctionBrowser.cpp.
References m_presenter.
| std::vector< std::string > MantidQt::MantidWidgets::FunctionBrowser::getLocalParameters | ( | ) | const |
Get a list of names of local parameters.
Definition at line 293 of file FunctionBrowser.cpp.
References m_presenter.
Referenced by updateMultiDatasetParameters().
|
overridevirtual |
Get the tie for a local parameter.
| parameterName | :: Parameter name |
| i | :: Index of a dataset. |
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 213 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Get value of a local parameter.
| parameterName | :: Name of a parameter. |
| i | :: Data set index. |
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 162 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Get the number of datasets.
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 133 of file FunctionBrowser.cpp.
References m_presenter.
| double MantidQt::MantidWidgets::FunctionBrowser::getParameter | ( | std::string const & | parameterName | ) | const |
Get a value of a parameter.
| parameterName | :: 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 130 of file FunctionBrowser.cpp.
References m_presenter.
| void MantidQt::MantidWidgets::FunctionBrowser::hideGlobalCheckbox | ( | ) |
Definition at line 307 of file FunctionBrowser.cpp.
References MantidQt::MantidWidgets::FunctionTreeView::hideGlobals(), and m_presenter.
|
overridevirtual |
Check if a local parameter is fixed.
| parameterName | :: Parameter name |
| i | :: Index of a dataset. |
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 206 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 186 of file FunctionBrowser.cpp.
References m_presenter.
|
slot |
Definition at line 179 of file FunctionBrowser.cpp.
| void MantidQt::MantidWidgets::FunctionBrowser::setBackgroundA0 | ( | double | value | ) |
Set a parameter that is responsible for the background level.
Definition at line 305 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 272 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 155 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 148 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 284 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.
|
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::setGlobalParameters | ( | std::vector< std::string > const & | globals | ) |
Definition at line 295 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Fix/unfix local parameter.
Fix/unfix a local parameter.
| parameterName | :: Parameter name |
| i | :: Index of a dataset. |
| fixed | :: Make it fixed (true) or free (false) |
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 199 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Set a tie for a local parameter.
| parameterName | :: Parameter name |
| i | :: Index of a dataset. |
| tie | :: A tie string. |
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 221 of file FunctionBrowser.cpp.
References m_presenter.
|
overridevirtual |
Set value of a local parameter.
Implements MantidQt::MantidWidgets::IFunctionBrowser.
Definition at line 166 of file FunctionBrowser.cpp.
References m_presenter, and value.
Referenced by updateMultiDatasetParameters().
| void MantidQt::MantidWidgets::FunctionBrowser::setLocalParameterValue | ( | std::string const & | parameterName, |
| int | i, | ||
| double | value, | ||
| double | error | ||
| ) |
Set value and error of a local parameter.
Definition at line 170 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 143 of file FunctionBrowser.cpp.
References m_presenter, and n.
| void MantidQt::MantidWidgets::FunctionBrowser::setParameter | ( | std::string const & | parameterName, |
| double | value | ||
| ) |
Update the function parameter value.
Updates the function parameter value.
| parameterName | :: 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 | ( | std::string const & | parameterName, |
| double | error | ||
| ) |
Update the function parameter error.
Updates the function parameter error.
| parameterName | :: 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 278 of file FunctionBrowser.cpp.
References m_presenter.
| void MantidQt::MantidWidgets::FunctionBrowser::showGlobalCheckbox | ( | ) |
Definition at line 309 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 233 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 227 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 237 of file FunctionBrowser.cpp.
References Mantid::API::ITableWorkspace::getColumn(), getCurrentDataset(), getGlobalParameters(), getLocalParameters(), name, 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 121 of file FunctionBrowser.cpp.
References m_presenter.
| FunctionTreeView * MantidQt::MantidWidgets::FunctionBrowser::view | ( | ) | const |
Definition at line 301 of file FunctionBrowser.cpp.
References m_presenter.
|
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(), setDatasets(), setErrorsEnabled(), setFunction(), setFunction(), setGlobalParameters(), setLocalParameterFixed(), setLocalParameterTie(), setLocalParameterValue(), setLocalParameterValue(), setNumberOfDatasets(), setParameter(), setParameterError(), setStretchLastColumn(), showGlobalCheckbox(), updateMultiDatasetAttributes(), updateMultiDatasetParameters(), updateParameters(), and view().