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

Class FitPropertyBrowser implements QtPropertyBrowser to display and control fitting function parameters and settings. More...

#include <FunctionBrowser.h>

Inheritance diagram for MantidQt::MantidWidgets::FunctionBrowser:
MantidQt::MantidWidgets::IFunctionBrowser MantidQt::MantidWidgets::MuonFunctionBrowser

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 &paramName)
 

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 &paramName) 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 &paramName, double value)
 Update the function parameter value. More...
 
void setParameterError (const QString &paramName, 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 &paramTable) 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...
 
FunctionTreeViewview () 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 &paramTable)=0
 
virtual void updateParameters (const Mantid::API::IFunction &fun)=0
 
virtual ~IFunctionBrowser ()=default
 

Protected Attributes

std::unique_ptr< FunctionMultiDomainPresenterm_presenter
 

Detailed Description

Class FitPropertyBrowser implements QtPropertyBrowser to display and control fitting function parameters and settings.

Definition at line 40 of file FunctionBrowser.h.

Constructor & Destructor Documentation

◆ FunctionBrowser()

MantidQt::MantidWidgets::FunctionBrowser::FunctionBrowser ( QWidget *  parent = nullptr,
bool  multi = false,
const std::vector< std::string > &  categories = std::vector<std::string>() 
)

Constructor.

Parameters
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().

◆ ~FunctionBrowser()

MantidQt::MantidWidgets::FunctionBrowser::~FunctionBrowser ( )
overridevirtualdefault

Destructor.

Member Function Documentation

◆ addDatasets

void MantidQt::MantidWidgets::FunctionBrowser::addDatasets ( const QStringList &  names)
slot

Add some datasets to those already set.

Parameters
names:: A list of names for the new datasets.

Definition at line 186 of file FunctionBrowser.cpp.

References m_presenter.

◆ attributeChanged

void MantidQt::MantidWidgets::FunctionBrowser::attributeChanged ( const QString &  attributeName)
signal

Referenced by FunctionBrowser().

◆ clear()

void MantidQt::MantidWidgets::FunctionBrowser::clear ( )
overridevirtual

Clear the contents.

Implements MantidQt::MantidWidgets::IFunctionBrowser.

Definition at line 68 of file FunctionBrowser.cpp.

References m_presenter.

◆ clearErrors()

void MantidQt::MantidWidgets::FunctionBrowser::clearErrors ( )
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.

◆ currentFunctionChanged

void MantidQt::MantidWidgets::FunctionBrowser::currentFunctionChanged ( )
signal

User selects a different function (or one of it's sub-properties)

◆ currentFunctionIndex()

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.

◆ functionStructureChanged

void MantidQt::MantidWidgets::FunctionBrowser::functionStructureChanged ( )
signal

Referenced by FunctionBrowser().

◆ getCurrentDataset()

int MantidQt::MantidWidgets::FunctionBrowser::getCurrentDataset ( ) const
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().

◆ getDatasetDomainNames()

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

Get the names of the dataset domains.

Implements MantidQt::MantidWidgets::IFunctionBrowser.

Definition at line 137 of file FunctionBrowser.cpp.

References m_presenter.

◆ getDatasetNames()

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

Get the names of datasets.

Implements MantidQt::MantidWidgets::IFunctionBrowser.

Definition at line 134 of file FunctionBrowser.cpp.

References m_presenter.

◆ getFitFunctionString()

QString MantidQt::MantidWidgets::FunctionBrowser::getFitFunctionString ( ) const

Definition at line 297 of file FunctionBrowser.cpp.

References m_presenter.

◆ getFunction()

Mantid::API::IFunction_sptr MantidQt::MantidWidgets::FunctionBrowser::getFunction ( )

Return the function.

Definition at line 126 of file FunctionBrowser.cpp.

References m_presenter.

◆ getFunctionByIndex()

IFunction_sptr MantidQt::MantidWidgets::FunctionBrowser::getFunctionByIndex ( const QString &  index)

Return a function with specified index.

Return function at specified function index (e.g.

f0.)

Parameters
index:: Index of the function, or empty string for top-level function
Returns
Function at index, or null pointer if not found

Definition at line 87 of file FunctionBrowser.cpp.

References index, and m_presenter.

◆ getFunctionString()

QString MantidQt::MantidWidgets::FunctionBrowser::getFunctionString ( )
overridevirtual

Return FunctionFactory function string.

Implements MantidQt::MantidWidgets::IFunctionBrowser.

Definition at line 124 of file FunctionBrowser.cpp.

References m_presenter.

◆ getGlobalFunction()

IFunction_sptr MantidQt::MantidWidgets::FunctionBrowser::getGlobalFunction ( )
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().

◆ getGlobalParameters()

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().

◆ getLocalParameterError()

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.

◆ getLocalParameters()

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().

◆ getLocalParameterTie()

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

Get the tie for a local parameter.

Parameters
parName:: Parameter name
i:: Index of a dataset.

Implements MantidQt::MantidWidgets::IFunctionBrowser.

Definition at line 209 of file FunctionBrowser.cpp.

References m_presenter.

◆ getLocalParameterValue()

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

Get value of a local parameter.

Parameters
parName:: Name of a parameter.
i:: Data set index.

Implements MantidQt::MantidWidgets::IFunctionBrowser.

Definition at line 158 of file FunctionBrowser.cpp.

References m_presenter.

◆ getNumberOfDatasets()

int MantidQt::MantidWidgets::FunctionBrowser::getNumberOfDatasets ( ) const
overridevirtual

Get the number of datasets.

Implements MantidQt::MantidWidgets::IFunctionBrowser.

Definition at line 131 of file FunctionBrowser.cpp.

References m_presenter.

◆ getParameter()

double MantidQt::MantidWidgets::FunctionBrowser::getParameter ( const QString &  paramName) const

Get a value of a parameter.

Parameters
paramName:: Fully qualified parameter name (includes function index)

Definition at line 112 of file FunctionBrowser.cpp.

References m_presenter.

◆ globalsChanged

void MantidQt::MantidWidgets::FunctionBrowser::globalsChanged ( )
signal

◆ hasFunction()

bool MantidQt::MantidWidgets::FunctionBrowser::hasFunction ( ) const

Check if a function is set.

Definition at line 128 of file FunctionBrowser.cpp.

References m_presenter.

◆ hideGlobalCheckbox()

void MantidQt::MantidWidgets::FunctionBrowser::hideGlobalCheckbox ( )

Definition at line 301 of file FunctionBrowser.cpp.

References m_presenter.

◆ isLocalParameterFixed()

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

Check if a local parameter is fixed.

Parameters
parName:: Parameter name
i:: Index of a dataset.

Implements MantidQt::MantidWidgets::IFunctionBrowser.

Definition at line 202 of file FunctionBrowser.cpp.

References m_presenter.

◆ localParameterButtonClicked

void MantidQt::MantidWidgets::FunctionBrowser::localParameterButtonClicked ( const QString &  parName)
signal

In multi-dataset context a button value editor was clicked.

◆ parameterChanged

void MantidQt::MantidWidgets::FunctionBrowser::parameterChanged ( const QString &  funcIndex,
const QString &  paramName 
)
signal

Referenced by FunctionBrowser().

◆ removeDatasets

void MantidQt::MantidWidgets::FunctionBrowser::removeDatasets ( const QList< int > &  indices)
slot

Remove local parameter values for a number of datasets.

Parameters
indices:: A list of indices of datasets to remove.

Definition at line 182 of file FunctionBrowser.cpp.

References m_presenter.

◆ resetLocalParameters

void MantidQt::MantidWidgets::FunctionBrowser::resetLocalParameters ( )
slot

Definition at line 175 of file FunctionBrowser.cpp.

◆ setBackgroundA0()

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.

◆ setColumnSizes()

void MantidQt::MantidWidgets::FunctionBrowser::setColumnSizes ( int  s0,
int  s1,
int  s2 = -1 
)

Resize the browser's columns.

Parameters
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.

◆ setCurrentDataset

void MantidQt::MantidWidgets::FunctionBrowser::setCurrentDataset ( int  i)
overrideslot

Set current dataset.

Definition at line 178 of file FunctionBrowser.cpp.

References m_presenter.

◆ setDatasets [1/2]

void MantidQt::MantidWidgets::FunctionBrowser::setDatasets ( const QList< FunctionModelDataset > &  datasets)
overrideslot

Sets the datasets being fitted.

They will be displayed by the local parameter editing dialog.

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

Definition at line 151 of file FunctionBrowser.cpp.

References m_presenter.

◆ setDatasets [2/2]

void MantidQt::MantidWidgets::FunctionBrowser::setDatasets ( const QStringList &  datasetNames)
overrideslot

Sets the datasets being fitted.

They will be displayed by the local parameter editing dialog.

Parameters
datasetNames:: Names of the datasets

Definition at line 146 of file FunctionBrowser.cpp.

References m_presenter.

◆ setErrorsEnabled()

void MantidQt::MantidWidgets::FunctionBrowser::setErrorsEnabled ( bool  enabled)
overridevirtual

Set error display on/off.

Set display of parameter errors on/off.

Parameters
enabled:: [input] On/off display of errors

Implements MantidQt::MantidWidgets::IFunctionBrowser.

Definition at line 280 of file FunctionBrowser.cpp.

References m_presenter.

◆ setFunction() [1/2]

void MantidQt::MantidWidgets::FunctionBrowser::setFunction ( const QString &  funStr)
overridevirtual

Set the function in the browser.

Parameters
funStr:: FunctionFactory function creation string

Implements MantidQt::MantidWidgets::IFunctionBrowser.

Definition at line 74 of file FunctionBrowser.cpp.

References m_presenter.

◆ setFunction() [2/2]

void MantidQt::MantidWidgets::FunctionBrowser::setFunction ( IFunction_sptr  fun)

Set the function in the browser.

Parameters
fun:: A function

Definition at line 80 of file FunctionBrowser.cpp.

References m_presenter.

◆ setGlobalParameters()

void MantidQt::MantidWidgets::FunctionBrowser::setGlobalParameters ( const QStringList &  globals)

Definition at line 291 of file FunctionBrowser.cpp.

References m_presenter.

◆ setLocalParameterFixed()

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

Fix/unfix local parameter.

Fix/unfix a local parameter.

Parameters
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.

◆ setLocalParameterTie()

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

Set a tie for a local parameter.

Parameters
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.

◆ setLocalParameterValue() [1/2]

void MantidQt::MantidWidgets::FunctionBrowser::setLocalParameterValue ( const QString &  parName,
int  i,
double  value 
)
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().

◆ setLocalParameterValue() [2/2]

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.

◆ setNumberOfDatasets

void MantidQt::MantidWidgets::FunctionBrowser::setNumberOfDatasets ( int  n)
overrideslot

Set new number of the datasets.

Parameters
n:: New value for the number of datasets.

Definition at line 141 of file FunctionBrowser.cpp.

References m_presenter, and n.

◆ setParameter()

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

Update the function parameter value.

Updates the function parameter value.

Parameters
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().

◆ setParameterError()

void MantidQt::MantidWidgets::FunctionBrowser::setParameterError ( const QString &  paramName,
double  error 
)

Update the function parameter error.

Updates the function parameter error.

Parameters
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().

◆ setStretchLastColumn()

void MantidQt::MantidWidgets::FunctionBrowser::setStretchLastColumn ( bool  stretch)

Set the last column to stretch.

This avoids a vertical scroll bar.

Parameters
stretch:: A bool whether or not to stretch the last column.

Definition at line 274 of file FunctionBrowser.cpp.

References m_presenter.

◆ showGlobalCheckbox()

void MantidQt::MantidWidgets::FunctionBrowser::showGlobalCheckbox ( )

Definition at line 303 of file FunctionBrowser.cpp.

References m_presenter.

◆ updateMultiDatasetAttributes()

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.

Parameters
fun:: A function to get attribute values from.

Definition at line 229 of file FunctionBrowser.cpp.

References m_presenter.

◆ updateMultiDatasetParameters() [1/2]

void MantidQt::MantidWidgets::FunctionBrowser::updateMultiDatasetParameters ( const IFunction fun)
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.

Parameters
fun:: A function to get parameter values from.

Implements MantidQt::MantidWidgets::IFunctionBrowser.

Definition at line 223 of file FunctionBrowser.cpp.

References m_presenter.

◆ updateMultiDatasetParameters() [2/2]

void MantidQt::MantidWidgets::FunctionBrowser::updateMultiDatasetParameters ( const ITableWorkspace paramTable)
overridevirtual

◆ updateParameters()

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

Update parameter values in the browser to match those of a function.

Parameters
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.

◆ view()

FunctionTreeView * MantidQt::MantidWidgets::FunctionBrowser::view ( ) const

Definition at line 295 of file FunctionBrowser.cpp.

References m_presenter.

Referenced by FunctionBrowser().

Member Data Documentation

◆ m_presenter

std::unique_ptr<FunctionMultiDomainPresenter> MantidQt::MantidWidgets::FunctionBrowser::m_presenter
protected

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