Skip to content

Commit

Permalink
Refs #6616. Set error values only when actual fit was done
Browse files Browse the repository at this point in the history
  • Loading branch information
arturbekasov committed Mar 10, 2014
1 parent ab078bf commit 41b954d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
Expand Up @@ -90,7 +90,7 @@ class EXPORT_OPT_MANTIDQT_MANTIDWIDGETS FitPropertyBrowser: public QDockWidget,
/// Get the current function
boost::shared_ptr<const Mantid::API::IFunction> theFunction()const;
/// Update the function parameters
void updateParameters();
void updateParameters(bool setErrors = false);
/// Get function parameter values
QList<double> getParameterValues() const;
/// Get function parameter names
Expand Down
Expand Up @@ -127,10 +127,8 @@ class EXPORT_OPT_MANTIDQT_MANTIDWIDGETS PropertyHandler:public QObject, public M
/// Set function vector attribute value
void setVectorAttribute(QtProperty* prop);

/**
* Update the parameter properties
*/
void updateParameters();
/// Update the parameter properties
void updateParameters(bool setErrors = false);

// Get property for function parameter parName
QtProperty* getParameterProperty(const QString& parName)const;
Expand Down
10 changes: 6 additions & 4 deletions Code/Mantid/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp
Expand Up @@ -1834,11 +1834,13 @@ void FitPropertyBrowser::vectorDoubleChanged(QtProperty *prop)
h->setVectorAttribute(prop);
}

/** Update the function parameter properties.
/**
* Update the function parameter properties. If isFitDone is true, set parameter errors as well.
* @param setErrors :: Whether errors should be set as well
*/
void FitPropertyBrowser::updateParameters()
void FitPropertyBrowser::updateParameters(bool setErrors)
{
getHandler()->updateParameters();
getHandler()->updateParameters(setErrors);
}

/**
Expand Down Expand Up @@ -1897,7 +1899,7 @@ void FitPropertyBrowser::getFitResults()
}
}
while(row.next());
updateParameters();
updateParameters(true);
}
}

Expand Down
16 changes: 10 additions & 6 deletions Code/Mantid/MantidQt/MantidWidgets/src/PropertyHandler.cpp
Expand Up @@ -921,9 +921,10 @@ void PropertyHandler::setVectorAttribute(QtProperty *prop)
}

/**
* Update the parameter properties
*/
void PropertyHandler::updateParameters()
* Update the parameter properties. If isFitDone is true, parameter errors are set as well.
* @param setErrors :: Whether errors should be set
*/
void PropertyHandler::updateParameters(bool setErrors)
{
for(int i=0;i<m_parameters.size();i++)
{
Expand All @@ -934,14 +935,17 @@ void PropertyHandler::updateParameters()
double parValue = function()->getParameter(parIndex);
m_browser->m_parameterManager->setValue(prop, parValue);

double parError = function()->getError(parIndex);
m_browser->m_parameterManager->setError(prop, parError);
if (setErrors)
{
double parError = function()->getError(parIndex);
m_browser->m_parameterManager->setError(prop, parError);
}
}
if (m_cf)
{
for(size_t i=0;i<m_cf->nFunctions();i++)
{
getHandler(i)->updateParameters();
getHandler(i)->updateParameters(setErrors);
}
}
}
Expand Down

0 comments on commit 41b954d

Please sign in to comment.