32#include "MantidQtWidgets/Common/QtPropertyBrowser/FilenameDialogEditor.h"
33#include "MantidQtWidgets/Common/QtPropertyBrowser/FormulaDialogEditor.h"
34#include "MantidQtWidgets/Common/QtPropertyBrowser/StringEditorFactory.h"
36#include "MantidQtWidgets/Common/QtPropertyBrowser/DoubleEditorFactory.h"
37#include "MantidQtWidgets/Common/QtPropertyBrowser/ParameterPropertyManager.h"
38#include "MantidQtWidgets/Common/QtPropertyBrowser/qteditorfactory.h"
39#include "MantidQtWidgets/Common/QtPropertyBrowser/qttreepropertybrowser.h"
41#include <Poco/ActiveResult.h>
43#include <QApplication>
46#include <QInputDialog>
52#include <QSignalMapper>
61using API::MantidDesktopServices;
63namespace MantidWidgets {
71 return static_cast<int>(
workspace->getNumberHistograms());
81 : QDockWidget(
"Fit Function", parent), m_workspaceIndex(nullptr), m_startX(nullptr), m_endX(nullptr),
82 m_output(nullptr), m_minimizer(nullptr), m_ignoreInvalidData(nullptr),
m_costFunction(nullptr),
83 m_maxIterations(nullptr), m_peakRadius(nullptr), m_plotDiff(nullptr), m_excludeRange(nullptr),
84 m_plotCompositeMembers(nullptr), m_convolveMembers(nullptr), m_rawData(nullptr), m_xColumn(nullptr),
85 m_yColumn(nullptr), m_errColumn(nullptr), m_showParamErrors(nullptr), m_evaluationType(nullptr),
86 m_compositeFunction(), m_browser(nullptr), m_fitActionUndoFit(nullptr), m_fitActionSeqFit(nullptr),
87 m_fitActionFit(nullptr), m_fitActionEvaluate(nullptr), m_functionsGroup(nullptr), m_settingsGroup(nullptr),
88 m_customSettingsGroup(nullptr), m_changeSlotsEnabled(false), m_guessOutputName(true),
89 m_updateObserver(*this, &
FitPropertyBrowser::handleFactoryUpdate), m_fitMapper(nullptr), m_fitMenu(nullptr),
90 m_displayActionPlotGuess(nullptr), m_displayActionQuality(nullptr), m_displayActionClearAll(nullptr),
91 m_setupActionCustomSetup(nullptr), m_setupActionRemove(nullptr), m_tip(nullptr), m_fitSelector(nullptr),
92 m_fitTree(nullptr), m_currentHandler(nullptr), m_defaultFunction(
"Gaussian"), m_defaultPeak(
"Gaussian"),
93 m_defaultBackground(
"LinearBackground"), m_peakToolOn(false), m_hideWsListWidget(false), m_auto_back(false),
95 QString::fromStdString(
Mantid::Kernel::
ConfigService::Instance().getString(
"curvefitting.autoBackground"))),
96 m_autoBackground(nullptr), m_decimals(-1), m_mantidui(mantidui), m_shouldBeNormalised(false),
97 m_fitAlgParameters(
""), m_oldWorkspaceIndex(-1) {
98 Mantid::API::FrameworkManager::Instance().loadPlugins();
101 if (!Mantid::API::FunctionFactory::Instance().exists(
"Gaussian")) {
102 throw std::runtime_error(
"FitPropertyBrowser: Unable to find Gaussian function\n"
103 "Has the CurveFitting plugin loaded?");
111 std::string def = Mantid::Kernel::ConfigService::Instance().getString(
"curvefitting.defaultPeak");
116 def = Mantid::Kernel::ConfigService::Instance().getString(
"curvefitting.autoBackground");
122 setObjectName(
"FitFunction");
123 setMinimumHeight(150);
124 setMinimumWidth(200);
126 QWidget *w =
new QWidget(
this);
150 QWidget *w =
new QWidget(
this);
153 settings.beginGroup(
"Mantid/FitBrowser");
156 QtProperty *functionsGroup =
m_groupManager->addProperty(
"Functions");
162 QtProperty *settingsGroup =
m_groupManager->addProperty(
"Settings");
170 <<
"Levenberg-MarquardtMD"
174 <<
"Conjugate gradient (Fletcher-Reeves imp.)"
175 <<
"Conjugate gradient (Polak-Ribiere imp.)"
177 <<
"Damped GaussNewton";
186 <<
"Unweighted least squares"
196 bool plotDiffSetting = settings.value(
"Plot Difference", QVariant(
true)).toBool();
200 m_excludeRange->setToolTip(
"A list of pairs of real numbers which define the region to exclude");
203 bool plotCompositeItems = settings.value(
m_plotCompositeMembers->propertyName(), QVariant(
false)).toBool();
207 bool convolveCompositeItems = settings.value(
m_plotCompositeMembers->propertyName(), QVariant(
false)).toBool();
211 bool showParamErrors = settings.value(
m_showParamErrors->propertyName(),
false).toBool();
216 m_evaluationType->setToolTip(
"Consider using Histogram fit which may produce more accurate results.");
220 int evaluationType = settings.value(
m_evaluationType->propertyName(), 0).toInt();
228 settingsGroup->addSubProperty(
m_startX);
229 settingsGroup->addSubProperty(
m_endX);
234 settingsGroup->addSubProperty(
m_output);
278 auto *btnFit =
new QPushButton(
"Fit");
279 m_tip =
new QLabel(
"", w);
310 connect(
m_fitActionFit, SIGNAL(triggered()), fitMapper, SLOT(map()));
318 fitMenu->addSeparator();
320 fitMenu->addSeparator();
333 btnFit->setObjectName(
"button_Fit");
335 connect(
this, SIGNAL(
changeWindowTitle(
const QString &)),
this, SLOT(setWindowTitle(
const QString &)));
353 auto *layout =
new QVBoxLayout(w);
354 layout->setObjectName(
"vlayout");
355 auto *buttonsLayout =
new QGridLayout();
357 auto *btnDisplay =
new QPushButton(
"Display");
358 btnDisplay->setObjectName(
"button_Display");
359 QMenu *displayMenu =
new QMenu(
this);
360 displayMenu->setObjectName(
"menu_Display");
368 QSignalMapper *displayMapper =
new QSignalMapper(
this);
369 displayMapper->setObjectName(
"mapper_Display");
377 connect(displayMapper, SIGNAL(mapped(
const QString &)),
this, SLOT(
executeDisplayMenu(
const QString &)));
381 btnDisplay->setMenu(displayMenu);
383 auto *btnSetup =
new QPushButton(
"Setup");
384 btnSetup->setObjectName(
"button_Setup");
385 QMenu *setupMenu =
new QMenu(
this);
386 setupMenu->setObjectName(
"menu_Setup");
389 QAction *setupActionManageSetup =
new QAction(
"Manage Setup",
this);
390 setupActionManageSetup->setObjectName(
"action_ManageSetup");
391 QAction *setupActionPeakFindingAlgs =
new QAction(
"Peak Finding Algorithms",
this);
392 setupActionPeakFindingAlgs->setObjectName(
"action_PeakFindingAlgs");
393 QAction *setupActionFindPeaks =
new QAction(
"Find Peaks",
this);
394 setupActionFindPeaks->setObjectName(
"action_FindPeaks");
395 QAction *setupActionFindPeaksConvolve =
new QAction(
"Find Peaks Convolve",
this);
396 setupActionFindPeaksConvolve->setObjectName(
"action_FindPeaksConvolve");
397 QAction *setupActionClearFit =
new QAction(
"Clear Model",
this);
398 setupActionClearFit->setObjectName(
"action_ClearModel");
400 QMenu *setupSubMenuCustom =
new QMenu(
this);
405 QMenu *setupSubMenuManage =
new QMenu(
this);
406 QAction *setupActionSave =
new QAction(
"Save Setup",
this);
408 QAction *setupActionClear =
new QAction(
"Clear Setups",
this);
409 setupActionClear->setObjectName(
"action_ClearSetups");
410 QAction *setupActionCopyToClipboard =
new QAction(
"Copy To Clipboard",
this);
411 setupActionCopyToClipboard->setObjectName(
"action_CopyToClipboard");
412 QAction *setupActionLoadFromString =
new QAction(
"Load From String",
this);
413 setupActionLoadFromString->setObjectName(
"action_LoadFromString");
414 QSignalMapper *setupManageMapper =
new QSignalMapper(
this);
415 setupManageMapper->setMapping(setupActionSave,
"SaveSetup");
416 setupManageMapper->setMapping(setupActionCopyToClipboard,
"CopyToClipboard");
417 setupManageMapper->setMapping(setupActionLoadFromString,
"LoadFromString");
418 setupManageMapper->setMapping(setupActionClear,
"ClearSetups");
419 connect(setupActionSave, SIGNAL(triggered()), setupManageMapper, SLOT(map()));
420 connect(setupActionCopyToClipboard, SIGNAL(triggered()), setupManageMapper, SLOT(map()));
421 connect(setupActionLoadFromString, SIGNAL(triggered()), setupManageMapper, SLOT(map()));
422 connect(setupActionClear, SIGNAL(triggered()), setupManageMapper, SLOT(map()));
423 connect(setupManageMapper, SIGNAL(mapped(
const QString &)),
this, SLOT(
executeSetupManageMenu(
const QString &)));
424 setupSubMenuManage->addAction(setupActionSave);
426 setupSubMenuManage->addAction(setupActionClear);
427 setupSubMenuManage->addAction(setupActionCopyToClipboard);
428 setupSubMenuManage->addAction(setupActionLoadFromString);
429 setupActionManageSetup->setMenu(setupSubMenuManage);
431 QMenu *setupSubMenuRemove =
new QMenu(
this);
436 QSignalMapper *PeakFindingAlgMapper =
new QSignalMapper(
this);
437 PeakFindingAlgMapper->setMapping(setupActionFindPeaks,
"FindPeaks");
438 PeakFindingAlgMapper->setMapping(setupActionFindPeaksConvolve,
"FindPeaksConvolve");
439 connect(setupActionFindPeaks, SIGNAL(triggered()), PeakFindingAlgMapper, SLOT(map()));
440 connect(setupActionFindPeaksConvolve, SIGNAL(triggered()), PeakFindingAlgMapper, SLOT(map()));
441 connect(PeakFindingAlgMapper, SIGNAL(mapped(
const QString &)),
this,
444 QSignalMapper *setupMapper =
new QSignalMapper(
this);
445 setupMapper->setMapping(setupActionClearFit,
"ClearFit");
446 connect(setupActionClearFit, SIGNAL(triggered()), setupMapper, SLOT(map()));
447 connect(setupMapper, SIGNAL(mapped(
const QString &)),
this, SLOT(
executeSetupMenu(
const QString &)));
449 QMenu *setupSubMenuPeakFindingAgls =
new QMenu(
this);
450 setupSubMenuPeakFindingAgls->addAction(setupActionFindPeaks);
451 setupSubMenuPeakFindingAgls->addAction(setupActionFindPeaksConvolve);
452 setupActionPeakFindingAlgs->setMenu(setupSubMenuPeakFindingAgls);
455 setupMenu->addAction(setupActionManageSetup);
456 setupMenu->addSeparator();
457 setupMenu->addAction(setupActionPeakFindingAlgs);
458 setupMenu->addSeparator();
459 setupMenu->addAction(setupActionClearFit);
460 btnSetup->setMenu(setupMenu);
464 buttonsLayout->addWidget(btnFit, 0, 0);
465 buttonsLayout->addWidget(btnDisplay, 0, 1);
466 buttonsLayout->addWidget(btnSetup, 0, 2);
468 m_status =
new QLabel(
"Status:", w);
471 Qt::QueuedConnection);
473 layout->addLayout(buttonsLayout);
474 layout->addWidget(
m_tip);
476 m_browser->setObjectName(
"tree_browser");
487 m_browser->setContextMenuPolicy(Qt::CustomContextMenu);
488 connect(
m_browser, SIGNAL(customContextMenuRequested(
const QPoint &)),
this, SLOT(
popupMenu(
const QPoint &)));
505 FunctionFactory::Instance().notificationCenter.addObserver(
m_updateObserver);
507 FunctionFactory::Instance().enableNotifications();
521 const std::vector<std::string> workspaceNames{outName +
"_NormalisedCovarianceMatrix", outName +
"_Parameters",
522 outName +
"_Workspace"};
524 for (
const auto &
name : workspaceNames) {
526 auto foundInList =
m_wsListWidget->findItems(QString::fromStdString(
name), Qt::MatchExactly);
527 if (foundInList.size() == 0 && AnalysisDataService::Instance().doesExist(
name)) {
542 auto wsName = item->text();
554 QtCheckBoxFactory *checkBoxFactory =
new QtCheckBoxFactory(w);
555 QtEnumEditorFactory *comboBoxFactory =
new QtEnumEditorFactory(w);
556 QtSpinBoxFactory *spinBoxFactory =
new QtSpinBoxFactory(w);
557 DoubleEditorFactory *doubleEditorFactory =
new DoubleEditorFactory(w);
558 StringEditorFactory *stringEditFactory =
new StringEditorFactory(w);
560 FormulaDialogEditorFactory *formulaDialogEditFactory =
new FormulaDialogEditorFactory(w);
585 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
586 QStringList names = settings.childKeys();
588 QSignalMapper *mapperLoad =
new QSignalMapper(
this);
589 QSignalMapper *mapperRemove =
new QSignalMapper(
this);
594 for (
int i = 0; i < names.size(); i++) {
595 QAction *itemLoad =
new QAction(names.at(i),
this);
596 QAction *itemRemove =
new QAction(names.at(i),
this);
597 mapperLoad->setMapping(itemLoad, names.at(i));
598 mapperRemove->setMapping(itemRemove, names.at(i));
599 connect(itemLoad, SIGNAL(triggered()), mapperLoad, SLOT(map()));
600 connect(itemRemove, SIGNAL(triggered()), mapperRemove, SLOT(map()));
601 menuLoad->addAction(itemLoad);
602 menuRemove->addAction(itemRemove);
604 connect(mapperLoad, SIGNAL(mapped(
const QString &)),
this, SLOT(
executeCustomSetupLoad(
const QString &)));
610 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
612 QString str = settings.value(
name).toString();
618 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
620 settings.remove(
name);
626 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
643 }
else if (item ==
"SeqFit") {
645 }
else if (item ==
"UndoFit") {
647 }
else if (item ==
"Evaluate") {
653 if (item ==
"PlotGuess") {
655 }
else if (item ==
"ClearAll") {
661 if (item ==
"FindPeaks")
662 findPeaks(std::make_unique<FindPeakDefaultStrategy>());
663 if (item ==
"FindPeaksConvolve")
664 findPeaks(std::make_unique<FindPeakConvolveStrategy>());
668 if (item ==
"ClearFit")
673 if (item ==
"SaveSetup")
675 if (item ==
"ClearSetups")
677 if (item ==
"CopyToClipboard")
679 if (item ==
"LoadFromString")
689 FunctionFactory::Instance().notificationCenter.removeObserver(
m_updateObserver);
728 QtBrowserItem *ci =
m_browser->currentItem();
743 QtBrowserItem *ci =
m_browser->currentItem();
748 if (function.isEmpty()) {
772 auto cf = std::dynamic_pointer_cast<Mantid::API::CompositeFunction>(func);
773 if (!cf || (cf->name() !=
"CompositeFunction" && cf->name() !=
"MultiBG" && cf->name() !=
"MultiDomainFunction")) {
814 return Mantid::API::FunctionFactory::Instance().createInitialized(str.toStdString());
815 }
catch (
const std::exception &ex) {
816 QMessageBox::critical(
this,
"Mantid - Error",
"Unexpected exception caught:\n\n" + QString(ex.what()));
822 QtBrowserItem *ci =
m_browser->currentItem();
825 QMenu *menu =
new QMenu(
this);
836 if (isFunctionsGroup) {
837 action =
new QAction(
"Add function",
this);
838 connect(action, SIGNAL(triggered()),
this, SLOT(
addFunction()));
839 menu->addAction(action);
842 Mantid::API::AnalysisDataService::Instance().doesExist(
workspaceName())) {
843 action =
new QAction(
"Setup multifit",
this);
844 connect(action, SIGNAL(triggered()),
this, SLOT(
setupMultifit()));
845 menu->addAction(action);
850 action =
new QAction(
"Remove plot",
this);
851 connect(action, SIGNAL(triggered()),
this, SLOT(
removeGuessAll()));
852 menu->addAction(action);
854 action =
new QAction(
"Plot",
this);
855 connect(action, SIGNAL(triggered()),
this, SLOT(
plotGuessAll()));
856 menu->addAction(action);
860 menu->addSeparator();
862 action =
new QAction(
"Save",
this);
863 connect(action, SIGNAL(triggered()),
this, SLOT(
saveFunction()));
864 menu->addAction(action);
866 action =
new QAction(
"Load",
this);
867 connect(action, SIGNAL(triggered()),
this, SLOT(
loadFunction()));
868 menu->addAction(action);
870 action =
new QAction(
"Copy To Clipboard",
this);
871 connect(action, SIGNAL(triggered()),
this, SLOT(
copy()));
872 menu->addAction(action);
874 menu->addSeparator();
876 action =
new QAction(
"Help",
this);
877 connect(action, SIGNAL(triggered()),
this, SLOT(
browserHelp()));
878 menu->addAction(action);
879 }
else if (isSettingsGroup || isASetting) {
881 action =
new QAction(
"Fit",
this);
882 connect(action, SIGNAL(triggered()),
this, SLOT(
fit()));
883 menu->addAction(action);
887 action =
new QAction(
"Undo Fit",
this);
888 connect(action, SIGNAL(triggered()),
this, SLOT(
undoFit()));
889 menu->addAction(action);
892 action =
new QAction(
"Clear all",
this);
893 connect(action, SIGNAL(triggered()),
this, SLOT(
clear()));
894 menu->addAction(action);
896 action =
new QAction(
"Help",
this);
897 connect(action, SIGNAL(triggered()),
this, SLOT(
browserHelp()));
898 menu->addAction(action);
900 }
else if (isFunction) {
901 if (isCompositeFunction) {
902 action =
new QAction(
"Add function",
this);
903 connect(action, SIGNAL(triggered()),
this, SLOT(
addFunction()));
904 menu->addAction(action);
907 action =
new QAction(
"Remove",
this);
908 connect(action, SIGNAL(triggered()),
this, SLOT(
deleteFunction()));
909 menu->addAction(action);
913 action =
new QAction(
"Remove plot",
this);
915 menu->addAction(action);
917 action =
new QAction(
"Plot",
this);
919 menu->addAction(action);
923 action =
new QAction(
"Help",
this);
924 connect(action, SIGNAL(triggered()),
this, SLOT(
functionHelp()));
925 menu->addAction(action);
927 menu->addSeparator();
930 bool isTie = !isParameter && ci->property()->propertyName() ==
"Tie";
931 bool isLowerBound = !isParameter && ci->property()->propertyName() ==
"Lower Bound";
932 bool isUpperBound = !isParameter && ci->property()->propertyName() ==
"Upper Bound";
933 bool isType = isParameter && ci->property()->propertyName() ==
"Type";
938 action =
new QAction(
"Remove",
this);
939 connect(action, SIGNAL(triggered()),
this, SLOT(
deleteTie()));
940 menu->addAction(action);
941 }
else if (isLowerBound || isUpperBound) {
942 action =
new QAction(
"Remove",
this);
943 connect(action, SIGNAL(triggered()),
this, SLOT(
removeBounds()));
944 menu->addAction(action);
945 }
else if (
count() > 0 && isParameter) {
951 if (!hasTies && !hasFixes) {
952 QMenu *constraintMenu = menu->addMenu(
"Constraint");
954 QMenu *detailMenu = constraintMenu->addMenu(
"Lower Bound");
956 action =
new QAction(
"10%",
this);
958 detailMenu->addAction(action);
960 action =
new QAction(
"50%",
this);
962 detailMenu->addAction(action);
964 action =
new QAction(
"Custom",
this);
965 connect(action, SIGNAL(triggered()),
this, SLOT(
addLowerBound()));
966 detailMenu->addAction(action);
967 detailMenu = constraintMenu->addMenu(
"Upper Bound");
969 action =
new QAction(
"10%",
this);
971 detailMenu->addAction(action);
973 action =
new QAction(
"50%",
this);
975 detailMenu->addAction(action);
977 action =
new QAction(
"Custom",
this);
978 connect(action, SIGNAL(triggered()),
this, SLOT(
addUpperBound()));
979 detailMenu->addAction(action);
980 detailMenu = constraintMenu->addMenu(
"Both Bounds");
982 action =
new QAction(
"10%",
this);
984 detailMenu->addAction(action);
986 action =
new QAction(
"50%",
this);
988 detailMenu->addAction(action);
990 action =
new QAction(
"Custom",
this);
991 connect(action, SIGNAL(triggered()),
this, SLOT(
addBothBounds()));
992 detailMenu->addAction(action);
996 action =
new QAction(
"Remove constraints",
this);
997 connect(action, SIGNAL(triggered()),
this, SLOT(
removeBounds()));
998 menu->addAction(action);
1001 if (!hasTies && !hasFixes && !hasBounds) {
1002 action =
new QAction(
"Fix",
this);
1003 connect(action, SIGNAL(triggered()),
this, SLOT(
addFixTie()));
1004 menu->addAction(action);
1007 action =
new QAction(
"Tie",
this);
1008 connect(action, SIGNAL(triggered()),
this, SLOT(
addTie()));
1009 menu->addAction(action);
1011 QMenu *detail = menu->addMenu(
"Tie");
1013 action =
new QAction(
"To function",
this);
1015 detail->addAction(action);
1017 action =
new QAction(
"Custom Tie",
this);
1018 connect(action, SIGNAL(triggered()),
this, SLOT(
addTie()));
1019 detail->addAction(action);
1021 }
else if (hasTies) {
1022 action =
new QAction(
"Remove tie",
this);
1023 connect(action, SIGNAL(triggered()),
this, SLOT(
deleteTie()));
1024 menu->addAction(action);
1025 }
else if (hasFixes) {
1026 action =
new QAction(
"Remove fix",
this);
1027 connect(action, SIGNAL(triggered()),
this, SLOT(
deleteTie()));
1028 menu->addAction(action);
1033 menu->popup(QCursor::pos());
1039 const QtBrowserItem *
const ci =
m_browser->currentItem();
1077 return std::shared_ptr<Mantid::API::Workspace>();
1079 return Mantid::API::AnalysisDataService::Instance().retrieve(wsName);
1081 return std::shared_ptr<Mantid::API::Workspace>();
1088 std::string res =
"";
1108 mws = std::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(
1109 Mantid::API::AnalysisDataService::Instance().retrieve(wsName.toStdString()));
1114 if (wi < mws->getNumberHistograms() && !mws->x(wi).empty()) {
1149 if (withProperties) {
1153 if (!
value.isEmpty()) {
1154 minimStr +=
"," + prop->propertyName() +
"=" +
value;
1157 minimStr +=
"," + prop->propertyName() +
"=";
1159 minimStr += QString::number(
m_intManager->value(prop));
1165 throw std::runtime_error(
"The fit browser doesn't support the type "
1166 "of minimizer's property " +
1167 prop->propertyName().toStdString());
1172 return minimStr.toStdString();
1214 const std::vector<std::string> names = Mantid::API::FunctionFactory::Instance().getFunctionNamesGUI();
1220 const auto &functionFactory = Mantid::API::FunctionFactory::Instance();
1221 for (
const auto &fnName : names) {
1222 if (fnName ==
"MultiBG")
1226 function = functionFactory.createFunction(fnName);
1227 }
catch (std::exception &exc) {
1228 g_log.
warning() <<
"Unable to create " << fnName <<
": " << exc.what() <<
"\n";
1231 QString qfnName = QString::fromStdString(fnName);
1250 bool storeSettings =
false;
1256 }
else if (prop->propertyName() ==
"Type") {
1273 storeSettings =
true;
1276 if (storeSettings) {
1278 settings.beginGroup(
"Mantid/FitBrowser");
1280 settings.setValue(prop->propertyName(), val);
1296 settings.beginGroup(
"Mantid/FitBrowser");
1297 settings.setValue(prop->propertyName(), val);
1322 if (allowedIndex != currentIndex) {
1327 }
else if (prop->propertyName() ==
"Workspace Index") {
1333 }
else if (prop->propertyName() ==
"WorkspaceIndex") {
1336 auto const index = prop->valueText().toInt();
1345 settings.beginGroup(
"Mantid/FitBrowser");
1347 settings.setValue(prop->propertyName(), val);
1375 }
else if (prop ==
m_endX) {
1390 if (prop->propertyName() ==
"LowerBound") {
1393 }
else if (prop->propertyName() ==
"UpperBound") {
1405 if (vectorAttribute) {
1411 std::stringstream err_str;
1412 err_str << prop->propertyName().toStdString() <<
" - " << ve.what();
1439 if (oName.find_first_not_of(
' ') == std::string::npos) {
1446 }
else if (prop->propertyName() ==
"Tie") {
1455 const QString parName = h->
functionPrefix() +
"." + parProp->propertyName();
1465 h->
addTie(parName +
"=" + exp);
1468 "Failed to update tie on " + parName.toStdString() +
". Expression " + exp.toStdString() +
" is invalid.";
1469 QMessageBox::critical(
this,
"Mantid - Error", msg.c_str());
1473 }
else if (
getHandler()->setAttribute(prop)) {
1490 }
catch (std::exception &) {
1495 const auto oldTieStr = oldTie->asString();
1496 oldExp = QString::fromStdString(oldTieStr.substr(oldTieStr.find(
"=") + 1));
1601 if (wsName.empty()) {
1602 QMessageBox::critical(
this,
"Mantid - Error",
"Workspace name is not set");
1622 alg->setProperty(
"EvaluationType",
"Histogram");
1624 alg->setProperty(
"Function", std::dynamic_pointer_cast<Mantid::API::IFunction>(
compositeFunction())->clone());
1625 alg->setProperty(
"InputWorkspace", ws);
1626 auto tbl = std::dynamic_pointer_cast<ITableWorkspace>(ws);
1630 alg->setPropertyValue(
"XColumn",
getXColumnName().toStdString());
1631 alg->setPropertyValue(
"YColumn",
getYColumnName().toStdString());
1635 alg->setProperty(
"StartX",
startX());
1636 alg->setProperty(
"EndX",
endX());
1637 alg->setPropertyValue(
"Output",
outputName());
1638 alg->setPropertyValue(
"Minimizer",
minimizer(
true));
1648 alg->setProperty(
"OutputCompositeMembers",
true);
1649 if (alg->existsProperty(
"ConvolveMembers")) {
1654 if (alg->getPropertyValue(
"EvaluationType") !=
"Histogram")
1657 g_log.
warning(
"Exclude property not avaliable when evaluating as a histogram.");
1662 while (!result.available()) {
1663 QCoreApplication::processEvents();
1666 if (!result.error().empty()) {
1669 }
catch (
const std::exception &e) {
1670 QString msg =
"Fit algorithm failed.\n\n" + QString(e.what()) +
"\n";
1671 QMessageBox::critical(
this,
"Mantid - Error", msg);
1698 QString
name(QString::fromStdString(alg->
getProperty(
"InputWorkspace")));
1699 if (
name.contains(
'_'))
1708 std::string out = alg->
getProperty(
"OutputWorkspace");
1717 double quality = alg->
getProperty(
"OutputChi2overDoF");
1718 std::string costFunctionStr = alg->
getProperty(
"CostFunction");
1719 std::shared_ptr<Mantid::API::ICostFunction> costfun =
1720 Mantid::API::CostFunctionFactory::Instance().create(costFunctionStr);
1721 status = (status ==
"success") ?
"success" :
"failed";
1722 emit
changeWindowTitle(QString(
"Fit Function (") + costfun->shortName().c_str() +
" = " + QString::number(quality) +
1723 ", " + status +
")");
1733 return function->asString();
1740 text.replace(
"\n",
"<br>");
1741 QString color(
"green");
1742 if (status !=
"success") {
1746 m_status->setText(QString(
"Status: <span style='color:%2'>%1</span>").arg(text, color));
1761 QStringList allowedNames;
1762 auto wsList = Mantid::API::AnalysisDataService::Instance().getObjectNames();
1763 for (
const auto &wsName : wsList) {
1764 auto const &
name = QString::fromStdString(wsName);
1766 allowedNames <<
name;
1770 for (
const auto &
name : allowedNames) {
1811 auto const qName = QString::fromStdString(wsName);
1818 bool initialSignalsBlocked =
m_enumManager->signalsBlocked();
1849 bool initialSignalsBlocked =
m_enumManager->signalsBlocked();
1851 if (QString::fromStdString(wsName) != oldName) {
1866 if (item->text().toStdString() == wsName) {
1878 QString oldNameQ = QString::fromStdString(oldName);
1879 QString newNameQ = QString::fromStdString(newName);
1887 if (iWorkspace >= 0) {
1895 if (item->text().toStdString() == oldName) {
1949 auto tbl = std::dynamic_pointer_cast<ITableWorkspace>(ws);
1950 auto mws = std::dynamic_pointer_cast<MatrixWorkspace>(ws);
1951 QVector<double> range;
1954 std::vector<double> xColumnData;
1955 auto col = tbl->getColumn(xColumnIndex);
1957 for (
size_t i = 0; i < tbl->rowCount(); ++i) {
1958 xColumnData.emplace_back(col->toDouble(i));
1960 }
catch (std::invalid_argument &err) {
1961 QMessageBox::critical(
this,
"Mantid - Error",
"The X column is not a number");
1962 throw std::invalid_argument(err);
1964 std::sort(xColumnData.begin(), xColumnData.end());
1965 range.push_back(xColumnData.front());
1966 range.push_back(xColumnData.back());
1969 range.push_back(xData.front());
1970 range.push_back(xData.back());
1977 auto tbl = std::dynamic_pointer_cast<ITableWorkspace>(ws);
1978 QString columnName =
"";
1980 auto columns = tbl->getColumnNames();
1982 if (xIndex >=
static_cast<int>(columns.size())) {
1983 QMessageBox::critical(
nullptr,
"Mantid - Error",
"X column was not found.");
1985 columnName = QString::fromStdString(columns[xIndex]);
1992 auto tbl = std::dynamic_pointer_cast<ITableWorkspace>(ws);
1993 QString columnName =
"";
1995 auto columns = tbl->getColumnNames();
1997 if (yIndex >=
static_cast<int>(columns.size())) {
1998 QMessageBox::critical(
nullptr,
"Mantid - Error",
"Y column was not found.");
2000 columnName = QString::fromStdString(columns[yIndex]);
2007 auto tbl = std::dynamic_pointer_cast<ITableWorkspace>(ws);
2008 QString columnName =
"";
2010 auto columns = tbl->getColumnNames();
2013 if (errIndex >=
static_cast<int>(columns.size())) {
2014 QMessageBox::warning(
nullptr,
"Mantid - Warning",
"Error column was not found.");
2015 }
else if (errIndex != -1) {
2016 columnName = QString::fromStdString(columns[errIndex]);
2025 QtBrowserItem *res =
nullptr;
2026 for (
auto &child : children) {
2027 if (child->property() == prop) {
2031 if (grand_children.size() > 0)
2095 foreach (QtProperty *prop, props) {
2102 for (
auto paramIndex = 0u; paramIndex < finalFunction->nParams(); ++paramIndex) {
2103 compositeFunction()->setParameter(paramIndex, finalFunction->getParameter(paramIndex));
2150 QtBrowserItem *ci =
m_browser->currentItem();
2151 QtProperty *paramProp = ci->property();
2163 QString tieStr = QInputDialog::getText(
this,
"Mantid - Fit",
"Enter tie expression", QLineEdit::Normal,
"", &ok);
2165 tieStr = tieStr.trimmed();
2166 if (!tieStr.contains(
'=')) {
2167 tieStr = h->
functionPrefix() +
"." + paramProp->propertyName() +
"=" + tieStr;
2178 QtBrowserItem *ci =
m_browser->currentItem();
2179 QtProperty *paramProp = ci->property();
2185 std::string parName = paramProp->propertyName().toStdString();
2186 QStringList fnNames;
2195 if (iPar == -1 && fun == h->
function().get())
2204 if (fnNames.empty() || iPar < 0) {
2205 QMessageBox::information(
this,
"Mantid - information",
"Cannot tie this parameter to any function");
2210 QString tieName = QInputDialog::getItem(
this,
"Mantid - Fit",
"Select function", fnNames, 0,
false, &ok);
2215 QString tieExpr = QString::fromStdString(
m_compositeFunction->parameterName(iPar)) +
"=" + tieName;
2224 QtBrowserItem *ci =
m_browser->currentItem();
2225 QtProperty *paramProp = ci->property();
2231 h->
fix(paramProp->propertyName());
2238 QtBrowserItem *ci =
m_browser->currentItem();
2239 QtProperty *paramProp = ci->property();
2244 if (paramProp->propertyName() !=
"Tie") {
2245 auto parameterMap = h->
getTies();
2246 auto match = parameterMap.find(paramProp->propertyName());
2247 if (match != parameterMap.end()) {
2248 paramProp = match.value();
2251 if (paramProp->propertyName() ==
"Tie") {
2253 QString qParName = ties.key(paramProp,
"");
2254 std::string parName = qParName.toStdString();
2255 QStringList functionNames;
2257 int ithParameter = -1;
2263 if (ithParameter == -1 && function == h->
function().get())
2266 ithParameter =
static_cast<int>(i);
2273 if (functionNames.empty() && ithParameter < 0) {
2274 QMessageBox::information(
this,
"Mantid - information",
"Cannot find a parameter with this tie");
2276 QString tieExpr = QString::fromStdString(
m_compositeFunction->parameterName(ithParameter));
2277 h->
removeTie(paramProp, tieExpr.toStdString());
2280 h->
removeTie(ci->property()->propertyName());
2295 for (
const auto *sub : subs) {
2296 const auto propName = sub->propertyName();
2297 if (propName ==
"Tie") {
2299 }
else if (propName ==
"Fix") {
2301 }
else if (propName ==
"LowerBound") {
2303 }
else if (propName ==
"UpperBound") {
2315 std::find_if(std::cbegin(subs), std::cend(subs), [](
const auto x) {
return (*x).propertyName() ==
"Tie"; });
2316 sub != std::cend(subs)) {
2343 QtBrowserItem *ci =
m_browser->currentItem();
2344 QtProperty *parProp = ci->property();
2349 double x = parProp->valueText().toDouble();
2350 double loBound =
x * (1 - 0.01 * f);
2351 double upBound =
x * (1 + 0.01 * f);
2407 QtBrowserItem *ci =
m_browser->currentItem();
2408 QtProperty *parProp = ci->property();
2453 if (manager ==
nullptr)
2455 QtProperty *prop = manager->addProperty(
name);
2457 manager->setRange(prop, -DBL_MAX, DBL_MAX);
2468 QString propName =
name.toLower();
2469 if (propName ==
"filename") {
2471 }
else if (propName ==
"formula") {
2488 const std::vector<std::string> &allowed_values)
const {
2489 QStringList qAllowedValues;
2492 for (
const auto &values : allowed_values) {
2493 qAllowedValues << QString::fromStdString(values);
2506 auto *manager =
dynamic_cast<QtStringPropertyManager *
>(prop->propertyManager());
2508 manager->setValue(prop,
value);
2513 const auto *
const manager =
dynamic_cast<QtStringPropertyManager *
>(prop->propertyManager());
2515 return manager->value(prop);
2535 auto const allowedIndices =
2537 auto const firstIndex =
m_allowedSpectra.empty() ? 0 : allowedIndices.front();
2540 auto allowedIndex = currentIndex;
2541 if (currentIndex < firstIndex) {
2542 allowedIndex = firstIndex;
2543 }
else if (currentIndex > lastIndex) {
2544 allowedIndex = lastIndex;
2545 }
else if (!
m_allowedSpectra.empty() && !allowedIndices.contains(currentIndex)) {
2550 if (i >= 0 && i < allowedIndices.size()) {
2551 allowedIndex = allowedIndices[i];
2555 return allowedIndex;
2560 QString fnName = QInputDialog::getText(
this, tr(
"Mantid - Input"), tr(
"Please select a name for the function"),
2561 QLineEdit::Normal,
"", &ok);
2562 if (ok && !fnName.isEmpty()) {
2569 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
2570 QStringList names = settings.childKeys();
2571 if (names.contains(fnName) && QMessageBox::question(
this,
"Mantid - Question",
2572 "Function with this name already exists.\n"
2573 "Would you like to replace it?",
2574 QMessageBox::Yes) != QMessageBox::Yes) {
2577 settings.setValue(fnName, QString::fromStdString(
theFunction()->asString()));
2583 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
2584 QStringList names = settings.childKeys();
2585 if (names.isEmpty()) {
2586 QMessageBox::information(
this,
"Mantid - Information",
"There are no saved functions");
2589 QString
name = QInputDialog::getItem(
this,
"Mantid - Input",
"Please select a function to load", names, 0,
false);
2590 if (!
name.isEmpty()) {
2591 QString str = settings.value(
name).toString();
2598 QString str = QInputDialog::getText(
this,
"Mantid - Input",
"Specify fit function string");
2600 if (!str.isEmpty()) {
2608 bool isAutoBGset =
false;
2624 QClipboard *clipboard = QApplication::clipboard();
2625 clipboard->setText(QString::fromStdString(
theFunction()->asString()));
2629 QClipboard *clipboard = QApplication::clipboard();
2630 QString str = clipboard->text();
2635 QString str = QString::fromStdString(
theFunction()->asString());
2643 if (!wsName.empty()) {
2645 auto ws = Mantid::API::AnalysisDataService::Instance().retrieve(wsName);
2646 auto mws = std::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(ws);
2650 function->setWorkspace(ws);
2660 bool hasPlot =
false;
2676 foreach (
const QString &att, attList) {
2677 QStringList name_value = att.split(
'=');
2678 if (name_value.size() == 2) {
2679 QString
name = name_value[0].trimmed();
2680 QString
value = name_value[1].trimmed();
2713 QStringList nameList = aName.split(
' ');
2714 if (nameList.isEmpty())
2716 QString
name = nameList[0];
2717 std::shared_ptr<Mantid::API::IFunction> f = std::shared_ptr<Mantid::API::IFunction>(
2718 Mantid::API::FunctionFactory::Instance().createFunction(
name.toStdString()));
2721 if (nameList.size() > 1) {
2722 nameList.removeFirst();
2725 Mantid::Kernel::ConfigService::Instance().setString(
"curvefitting.autoBackground", aName.toStdString());
2734 if (!wsName.empty() && dlg->addWorkspaces(QStringList(QString::fromStdString(wsName)))) {
2741 if (wsName.empty()) {
2742 QMessageBox::critical(
this,
"Mantid - Error",
"Workspace name is not set");
2746 std::string peakListName = wsName +
"_PeakList_tmp";
2748 QString::fromStdString(Mantid::Kernel::ConfigService::Instance().getString(
"curvefitting.findPeaksFWHM"));
2749 int FWHM{setting.isEmpty() ? 7 : setting.toInt()};
2752 findPeakStrategy->initialise(wsName,
workspaceIndex(), peakListName, FWHM, &obs);
2754 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
2757 Mantid::API::AnalysisDataService::Instance().retrieve(
workspaceName()));
2760 findPeakStrategy->execute();
2762 for (
size_t i = 0; i < findPeakStrategy->peakNumber(); ++i) {
2763 if (findPeakStrategy->getPeakCentre(i) <
startX() || findPeakStrategy->getPeakCentre(i) >
endX()) {
2771 QApplication::restoreOverrideCursor();
2775 QApplication::restoreOverrideCursor();
2789 settings.beginGroup(
"Mantid/FitBrowser");
2790 m_decimals = settings.value(
"decimals", 6).toInt();
2793 foreach (QtProperty *prop, props) {
2801 settings.beginGroup(
"Mantid/FitBrowser");
2802 settings.setValue(
"decimals",
d);
2838 QStringList ties = dlg->getParameterTies();
2840 if (!ties.isEmpty()) {
2843 Mantid::API::AnalysisDataService::Instance().retrieve(
workspaceName()));
2846 QString fun1Ini = QString::fromStdString(fun->asString());
2847 QString funIni =
"composite=MultiBG;" + fun1Ini +
",Workspace=" + wsName +
",WSParam=(WorkspaceIndex=0);";
2849 for (
size_t i = 1; i < mws->getNumberHistograms(); ++i) {
2850 QString comma = i > 1 ?
"," :
"";
2851 QString fi = comma +
"f" + QString::number(i) +
".";
2852 for (
int j = 0; j < static_cast<int>(fun->nParams()); ++j) {
2853 if (!ties[j].isEmpty()) {
2854 tieStr += fi + QString::fromStdString(fun->parameterName(j)) +
"=" + ties[j];
2857 QString wsParam =
",WSParam=(WorkspaceIndex=" + QString::number(i);
2858 wsParam +=
",StartX=" + QString::number(
startX()) +
",EndX=" + QString::number(
endX()) +
")";
2859 funIni += fun1Ini +
",Workspace=" + wsName + wsParam +
";";
2861 if (!tieStr.isEmpty()) {
2862 funIni +=
"ties=(" + tieStr +
")";
2878 QStringList parNames;
2881 throw std::runtime_error(
"IFunction expected but func function of another type");
2883 for (
size_t i = 0; i < fun0->nParams(); ++i) {
2884 parNames << QString::fromStdString(fun0->parameterName(i));
2890 throw std::runtime_error(
"IFunction expected but func function of another type");
2892 for (
size_t j = 0; j < fun->nParams(); ++j) {
2893 if (parNames.indexOf(QString::fromStdString(fun->parameterName(j))) < 0) {
2900 QApplication::setOverrideCursor(Qt::WaitCursor);
2904 table->addColumn(
"int",
"Index");
2905 foreach (
const QString &par, parNames) {
2906 table->addColumn(
"double", par.toStdString());
2928 Mantid::API::AnalysisDataService::Instance().addOrReplace(
workspaceName() +
"_Param_series", table);
2931 group->setProperty(
"InputWorkspaces", worspaceNames);
2936 QApplication::restoreOverrideCursor();
2958 ws = Mantid::API::AnalysisDataService::Instance().retrieve(
workspaceName());
2975 auto mws = std::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(ws);
2978 auto isHistogram = mws->isHistogramData();
2988 auto tws = std::dynamic_pointer_cast<Mantid::API::ITableWorkspace>(ws);
3000 auto names = tws->getColumnNames();
3001 QStringList columns;
3002 for (
const auto &
name : names) {
3003 columns << QString::fromStdString(
name);
3004 auto col = tws->getColumn(
name);
3005 if (xName.isEmpty() && col->getPlotType() == 1 ) {
3006 xName = QString::fromStdString(
name);
3008 if (yName.isEmpty() && col->getPlotType() == 2 ) {
3009 yName = QString::fromStdString(
name);
3011 if (errName.isEmpty() && col->getPlotType() == 5 ) {
3012 errName = QString::fromStdString(
name);
3018 if (!xName.isEmpty()) {
3021 if (
auto name = std::find_if(std::cbegin(columns), std::cend(columns), [&](
const auto x) {
return x != yName; });
3022 name != std::cend(columns)) {
3026 if (!yName.isEmpty()) {
3029 if (
auto name = std::find_if(std::cbegin(columns), std::cend(columns), [&](
const auto x) {
return x != xName; });
3030 name != std::cend(columns)) {
3034 columns.prepend(
"");
3036 if (!errName.isEmpty()) {
3076 for (
auto &prop : props) {
3077 if (propsToRemove.contains(prop->propertyName())) {
3093 auto ws = Mantid::API::AnalysisDataService::Instance().retrieve(
workspaceName());
3094 auto tws = std::dynamic_pointer_cast<Mantid::API::ITableWorkspace>(ws);
3098 if (i < 0 || i >=
static_cast<int>(tws->rowCount()) || tws->rowCount() == 0)
3100 auto col = tws->getColumn(
static_cast<size_t>(i));
3101 const double startXVal = col->toDouble(0);
3102 const double endXVal = col->toDouble(tws->rowCount() - 1);
3121 auto minzer = Mantid::API::FuncMinimizerFactory::Instance().createMinimizer(this->
minimizer());
3122 const auto &properties = minzer->getProperties();
3123 for (
auto property : properties) {
3124 QString propName = QString::fromStdString((*property).name());
3125 QtProperty *prop =
nullptr;
3144 QString val = QString::fromStdString(prp->value());
3148 m_stringManager->setValue(prop, QString::fromStdString((*property).value()));
3150 QMessageBox::warning(
this,
"Mantid - Error",
3151 "Type of minimizer's property " + propName +
" is not yet supported by the browser.");
3158 QString toolTip = QString::fromStdString((*property).documentation());
3159 if (!toolTip.isEmpty()) {
3160 prop->setToolTip(toolTip);
3172 size_t np = fun->nParams();
3174 for (
size_t i = 0; i < np; ++i) {
3175 const double parValue = fun->getParameter(i);
3176 out.append(parValue);
3186 size_t np = fun->nParams();
3188 for (
size_t i = 0; i < np; ++i) {
3189 std::string parName = fun->parameterName(i);
3190 out.append(QString::fromStdString(parName));
3245 return m_functionsGroup->children().size();
3249 auto const name = wsName.toStdString();
3253 indices.reserve(wsSpectra.size());
3254 std::transform(wsSpectra.cbegin(), wsSpectra.cend(), std::back_inserter(indices),
3255 [&ws](
const auto i) { return static_cast<int>(ws->getIndexFromSpectrumNumber(i)); });
3268 throw std::runtime_error(
"Workspace " +
name +
" is not a MatrixWorkspace");
3275 QString qWsName = QString::fromStdString(wsName);
3280 auto const name = wsName.toStdString();
3285 throw std::runtime_error(
"Workspace " +
name +
" is not a TableWorkspace");
3298 return addFunction(fnName.toStdString())->functionPrefix();
3302 const std::unique_ptr<FindPeakStrategyGeneric> &findPeakStrategy) {
3303 bool validFn =
false;
3304 auto f = std::dynamic_pointer_cast<Mantid::API::IPeakFunction>(
3305 Mantid::API::FunctionFactory::Instance().createFunction(
defaultPeakType()));
3309 f->setCentre(findPeakStrategy->getPeakCentre(peakIndex));
3310 f->setFwhm(findPeakStrategy->getPeakWidth(peakIndex));
3311 f->setHeight(findPeakStrategy->getPeakHeight(peakIndex));
3318 if (prefix.isEmpty())
3319 throw std::runtime_error(
"Peak function prefix cannot be empty");
3320 auto const indexList = prefix.split(
".");
3321 auto const n = indexList.size() - 1;
3323 for (
int i = 0; i <
n; ++i) {
3324 auto const index = indexList[i].mid(1).toInt();
3325 handler = handler->getHandler(
index);
3327 return handler->getHandler(indexList[
n].mid(1).toInt());
3332 handler->setCentre(
value);
3333 handler->updateParameters();
3338 return handler->centre();
3343 handler->setHeight(
value);
3344 handler->updateParameters();
3349 return handler->height();
3354 handler->setFwhm(
value);
3355 handler->updateParameters();
3360 return handler->fwhm();
3365 return handler->getWidthParameterName();
3370 return handler->getCentreParameterName();
3375 return handler->isParameterExplicitlySet(param);
3381 const auto nFunctions = parentHandler->cfun()->nFunctions();
3382 for (
size_t i = 0; i < nFunctions; ++i) {
3383 const auto *handler = parentHandler->getHandler(i);
3384 if (handler->pfun()) {
3385 peaks << handler->functionPrefix();
CostFunctions::CostFuncFitting & m_costFunction
The cost function.
double value
The value of the point.
IPeaksWorkspace_sptr workspace
std::map< DeltaEMode::Type, std::string > index
static void showPage(const std::string &url=std::string())
static void showFitFunction(const std::string &name=std::string())
void observeAdd(bool on=true)
Observe additions.
void observePostDelete(bool on=true)
Observe workspace deletes.
void observeRename(bool on=true)
Observe renaming.
void observeFinish(const IAlgorithm_const_sptr &alg)
Connect to algorithm alg and observe its finish notification.
A composite function is a function containing other functions.
IFunction_sptr function() const
Return the handled function.
IAlgorithm is the interface implemented by the Algorithm base class.
An interface to a background function.
This is an interface to a fitting function - a semi-abstarct class.
virtual std::string parameterName(size_t i) const =0
Returns the name of parameter i.
An interface to a peak function, which extend the interface of IFunctionWithLocation by adding method...
ITableWorkspace is an implementation of Workspace in which the data are organised in columns of same ...
An interface that is implemented by WorkspaceProperty.
Base MatrixWorkspace Abstract Class.
A reference to a parameter in a function.
std::size_t getLocalIndex() const
Return parameter index in the local function.
IFunction * getLocalFunction() const
Return pointer to the local function.
Exception for when an item is not found in a collection.
virtual bool existsProperty(const std::string &name) const =0
Checks whether the named property is already in the list of managed property.
virtual TypedValue getProperty(const std::string &name) const =0
Get the value of a property.
virtual std::string getPropertyValue(const std::string &name) const =0
Get the value of a property as a string.
The Logger class is in charge of the publishing messages from the framework through various channels.
void warning(const std::string &msg)
Logs at warning level.
The concrete, templated class for properties.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...
std::shared_ptr< IAlgorithm > IAlgorithm_sptr
shared pointer to Mantid::API::IAlgorithm
const Poco::AutoPtr< FunctionFactoryUpdateNotification > & FunctionFactoryUpdateNotification_ptr
Convenient typedef for an UpdateNotification AutoPtr.
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
Kernel::Logger g_log("ExperimentInfo")
static logger object
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
Mantid::Kernel::SingletonHolder< FunctionFactoryImpl > FunctionFactory
std::shared_ptr< const IFunction > IFunction_const_sptr
shared pointer to the function base class (const version)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< CompositeFunction > CompositeFunction_sptr
shared pointer to the composite function base class
Mantid::Kernel::SingletonHolder< ConfigServiceImpl > ConfigService
Helper class which provides the Collimation Length for SANS instruments.
Simple Exception Struct to differentiate validation error from other exceptions.