33#include "MantidQtWidgets/Common/QtPropertyBrowser/FilenameDialogEditor.h"
34#include "MantidQtWidgets/Common/QtPropertyBrowser/FormulaDialogEditor.h"
35#include "MantidQtWidgets/Common/QtPropertyBrowser/StringEditorFactory.h"
37#include "MantidQtWidgets/Common/QtPropertyBrowser/DoubleEditorFactory.h"
38#include "MantidQtWidgets/Common/QtPropertyBrowser/ParameterPropertyManager.h"
39#include "MantidQtWidgets/Common/QtPropertyBrowser/qteditorfactory.h"
40#include "MantidQtWidgets/Common/QtPropertyBrowser/qttreepropertybrowser.h"
42#include <Poco/ActiveResult.h>
44#include <QApplication>
47#include <QInputDialog>
53#include <QSignalMapper>
62using API::MantidDesktopServices;
64namespace MantidWidgets {
72 return static_cast<int>(
workspace->getNumberHistograms());
82 : QDockWidget(
"Fit Function", parent), m_workspaceIndex(nullptr), m_startX(nullptr), m_endX(nullptr),
83 m_output(nullptr), m_minimizer(nullptr), m_ignoreInvalidData(nullptr),
m_costFunction(nullptr),
84 m_maxIterations(nullptr), m_peakRadius(nullptr), m_plotDiff(nullptr), m_excludeRange(nullptr),
85 m_plotCompositeMembers(nullptr), m_convolveMembers(nullptr), m_rawData(nullptr), m_xColumn(nullptr),
86 m_yColumn(nullptr), m_errColumn(nullptr), m_showParamErrors(nullptr), m_evaluationType(nullptr),
87 m_compositeFunction(), m_browser(nullptr), m_fitActionUndoFit(nullptr), m_fitActionSeqFit(nullptr),
88 m_fitActionFit(nullptr), m_fitActionEvaluate(nullptr), m_functionsGroup(nullptr), m_settingsGroup(nullptr),
89 m_customSettingsGroup(nullptr), m_changeSlotsEnabled(false), m_guessOutputName(true),
90 m_updateObserver(*this, &
FitPropertyBrowser::handleFactoryUpdate), m_fitMapper(nullptr), m_fitMenu(nullptr),
91 m_displayActionPlotGuess(nullptr), m_displayActionQuality(nullptr), m_displayActionClearAll(nullptr),
92 m_setupActionCustomSetup(nullptr), m_setupActionRemove(nullptr), m_tip(nullptr), m_fitSelector(nullptr),
93 m_fitTree(nullptr), m_currentHandler(nullptr), m_defaultFunction(
"Gaussian"), m_defaultPeak(
"Gaussian"),
94 m_defaultBackground(
"LinearBackground"), m_peakToolOn(false), m_hideWsListWidget(false), m_auto_back(false),
96 QString::fromStdString(
Mantid::Kernel::
ConfigService::Instance().getString(
"curvefitting.autoBackground"))),
97 m_autoBackground(nullptr), m_decimals(-1), m_mantidui(mantidui), m_shouldBeNormalised(false),
98 m_fitAlgParameters(
""), m_oldWorkspaceIndex(-1) {
99 Mantid::API::FrameworkManager::Instance().loadPlugins();
102 if (!Mantid::API::FunctionFactory::Instance().exists(
"Gaussian")) {
103 throw std::runtime_error(
"FitPropertyBrowser: Unable to find Gaussian function\n"
104 "Has the CurveFitting plugin loaded?");
112 std::string def = Mantid::Kernel::ConfigService::Instance().getString(
"curvefitting.defaultPeak");
117 def = Mantid::Kernel::ConfigService::Instance().getString(
"curvefitting.autoBackground");
123 setObjectName(
"FitFunction");
124 setMinimumHeight(150);
125 setMinimumWidth(200);
127 QWidget *w =
new QWidget(
this);
151 QWidget *w =
new QWidget(
this);
154 settings.beginGroup(
"Mantid/FitBrowser");
157 QtProperty *functionsGroup =
m_groupManager->addProperty(
"Functions");
163 QtProperty *settingsGroup =
m_groupManager->addProperty(
"Settings");
171 <<
"Levenberg-MarquardtMD"
175 <<
"Conjugate gradient (Fletcher-Reeves imp.)"
176 <<
"Conjugate gradient (Polak-Ribiere imp.)"
178 <<
"Damped GaussNewton";
187 <<
"Unweighted least squares"
197 bool plotDiffSetting = settings.value(
"Plot Difference", QVariant(
true)).toBool();
201 m_excludeRange->setToolTip(
"A list of pairs of real numbers which define the region to exclude");
204 bool plotCompositeItems = settings.value(
m_plotCompositeMembers->propertyName(), QVariant(
false)).toBool();
208 bool convolveCompositeItems = settings.value(
m_plotCompositeMembers->propertyName(), QVariant(
false)).toBool();
212 bool showParamErrors = settings.value(
m_showParamErrors->propertyName(),
false).toBool();
217 m_evaluationType->setToolTip(
"Consider using Histogram fit which may produce more accurate results.");
221 int evaluationType = settings.value(
m_evaluationType->propertyName(), 0).toInt();
229 settingsGroup->addSubProperty(
m_startX);
230 settingsGroup->addSubProperty(
m_endX);
235 settingsGroup->addSubProperty(
m_output);
279 auto *btnFit =
new QPushButton(
"Fit");
280 m_tip =
new QLabel(
"", w);
311 connect(
m_fitActionFit, SIGNAL(triggered()), fitMapper, SLOT(map()));
319 fitMenu->addSeparator();
321 fitMenu->addSeparator();
334 btnFit->setObjectName(
"button_Fit");
336 connect(
this, SIGNAL(
changeWindowTitle(
const QString &)),
this, SLOT(setWindowTitle(
const QString &)));
354 auto *layout =
new QVBoxLayout(w);
355 layout->setObjectName(
"vlayout");
356 auto *buttonsLayout =
new QGridLayout();
358 auto *btnDisplay =
new QPushButton(
"Display");
359 btnDisplay->setObjectName(
"button_Display");
360 QMenu *displayMenu =
new QMenu(
this);
361 displayMenu->setObjectName(
"menu_Display");
369 QSignalMapper *displayMapper =
new QSignalMapper(
this);
370 displayMapper->setObjectName(
"mapper_Display");
378 connect(displayMapper, SIGNAL(mappedString(
const QString &)),
this, SLOT(
executeDisplayMenu(
const QString &)));
382 btnDisplay->setMenu(displayMenu);
384 auto *btnSetup =
new QPushButton(
"Setup");
385 btnSetup->setObjectName(
"button_Setup");
386 QMenu *setupMenu =
new QMenu(
this);
387 setupMenu->setObjectName(
"menu_Setup");
390 QAction *setupActionManageSetup =
new QAction(
"Manage Setup",
this);
391 setupActionManageSetup->setObjectName(
"action_ManageSetup");
392 QAction *setupActionPeakFindingAlgs =
new QAction(
"Peak Finding Algorithms",
this);
393 setupActionPeakFindingAlgs->setObjectName(
"action_PeakFindingAlgs");
394 QAction *setupActionFindPeaks =
new QAction(
"Find Peaks",
this);
395 setupActionFindPeaks->setObjectName(
"action_FindPeaks");
396 QAction *setupActionFindPeaksConvolve =
new QAction(
"Find Peaks Convolve",
this);
397 setupActionFindPeaksConvolve->setObjectName(
"action_FindPeaksConvolve");
398 QAction *setupActionClearFit =
new QAction(
"Clear Model",
this);
399 setupActionClearFit->setObjectName(
"action_ClearModel");
401 QMenu *setupSubMenuCustom =
new QMenu(
this);
406 QMenu *setupSubMenuManage =
new QMenu(
this);
407 QAction *setupActionSave =
new QAction(
"Save Setup",
this);
409 QAction *setupActionClear =
new QAction(
"Clear Setups",
this);
410 setupActionClear->setObjectName(
"action_ClearSetups");
411 QAction *setupActionCopyToClipboard =
new QAction(
"Copy To Clipboard",
this);
412 setupActionCopyToClipboard->setObjectName(
"action_CopyToClipboard");
413 QAction *setupActionLoadFromString =
new QAction(
"Load From String",
this);
414 setupActionLoadFromString->setObjectName(
"action_LoadFromString");
415 QSignalMapper *setupManageMapper =
new QSignalMapper(
this);
416 setupManageMapper->setMapping(setupActionSave,
"SaveSetup");
417 setupManageMapper->setMapping(setupActionCopyToClipboard,
"CopyToClipboard");
418 setupManageMapper->setMapping(setupActionLoadFromString,
"LoadFromString");
419 setupManageMapper->setMapping(setupActionClear,
"ClearSetups");
420 connect(setupActionSave, SIGNAL(triggered()), setupManageMapper, SLOT(map()));
421 connect(setupActionCopyToClipboard, SIGNAL(triggered()), setupManageMapper, SLOT(map()));
422 connect(setupActionLoadFromString, SIGNAL(triggered()), setupManageMapper, SLOT(map()));
423 connect(setupActionClear, SIGNAL(triggered()), setupManageMapper, SLOT(map()));
424 connect(setupManageMapper, SIGNAL(mappedString(
const QString &)),
this,
426 setupSubMenuManage->addAction(setupActionSave);
428 setupSubMenuManage->addAction(setupActionClear);
429 setupSubMenuManage->addAction(setupActionCopyToClipboard);
430 setupSubMenuManage->addAction(setupActionLoadFromString);
431 setupActionManageSetup->setMenu(setupSubMenuManage);
433 QMenu *setupSubMenuRemove =
new QMenu(
this);
438 QSignalMapper *PeakFindingAlgMapper =
new QSignalMapper(
this);
439 PeakFindingAlgMapper->setMapping(setupActionFindPeaks,
"FindPeaks");
440 PeakFindingAlgMapper->setMapping(setupActionFindPeaksConvolve,
"FindPeaksConvolve");
441 connect(setupActionFindPeaks, SIGNAL(triggered()), PeakFindingAlgMapper, SLOT(map()));
442 connect(setupActionFindPeaksConvolve, SIGNAL(triggered()), PeakFindingAlgMapper, SLOT(map()));
443 connect(PeakFindingAlgMapper, SIGNAL(mappedString(
const QString &)),
this,
446 QSignalMapper *setupMapper =
new QSignalMapper(
this);
447 setupMapper->setMapping(setupActionClearFit,
"ClearFit");
448 connect(setupActionClearFit, SIGNAL(triggered()), setupMapper, SLOT(map()));
449 connect(setupMapper, SIGNAL(mappedString(
const QString &)),
this, SLOT(
executeSetupMenu(
const QString &)));
451 QMenu *setupSubMenuPeakFindingAgls =
new QMenu(
this);
452 setupSubMenuPeakFindingAgls->addAction(setupActionFindPeaks);
453 setupSubMenuPeakFindingAgls->addAction(setupActionFindPeaksConvolve);
454 setupActionPeakFindingAlgs->setMenu(setupSubMenuPeakFindingAgls);
457 setupMenu->addAction(setupActionManageSetup);
458 setupMenu->addSeparator();
459 setupMenu->addAction(setupActionPeakFindingAlgs);
460 setupMenu->addSeparator();
461 setupMenu->addAction(setupActionClearFit);
462 btnSetup->setMenu(setupMenu);
466 buttonsLayout->addWidget(btnFit, 0, 0);
467 buttonsLayout->addWidget(btnDisplay, 0, 1);
468 buttonsLayout->addWidget(btnSetup, 0, 2);
470 m_status =
new QLabel(
"Status:", w);
473 Qt::QueuedConnection);
475 layout->addLayout(buttonsLayout);
476 layout->addWidget(
m_tip);
478 m_browser->setObjectName(
"tree_browser");
489 m_browser->setContextMenuPolicy(Qt::CustomContextMenu);
490 connect(
m_browser, SIGNAL(customContextMenuRequested(
const QPoint &)),
this, SLOT(
popupMenu(
const QPoint &)));
508 FunctionFactory::Instance().notificationCenter.addObserver(
m_updateObserver);
510 FunctionFactory::Instance().enableNotifications();
524 const std::vector<std::string> workspaceNames{outName +
"_NormalisedCovarianceMatrix", outName +
"_Parameters",
525 outName +
"_Workspace"};
527 for (
const auto &
name : workspaceNames) {
529 auto foundInList =
m_wsListWidget->findItems(QString::fromStdString(
name), Qt::MatchExactly);
530 if (foundInList.size() == 0 && AnalysisDataService::Instance().doesExist(
name)) {
545 auto wsName = item->text();
557 QtCheckBoxFactory *checkBoxFactory =
new QtCheckBoxFactory(w);
558 QtEnumEditorFactory *comboBoxFactory =
new QtEnumEditorFactory(w);
559 QtSpinBoxFactory *spinBoxFactory =
new QtSpinBoxFactory(w);
560 DoubleEditorFactory *doubleEditorFactory =
new DoubleEditorFactory(w);
561 StringEditorFactory *stringEditFactory =
new StringEditorFactory(w);
563 FormulaDialogEditorFactory *formulaDialogEditFactory =
new FormulaDialogEditorFactory(w);
588 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
589 QStringList names = settings.childKeys();
591 QSignalMapper *mapperLoad =
new QSignalMapper(
this);
592 QSignalMapper *mapperRemove =
new QSignalMapper(
this);
597 for (
int i = 0; i < names.size(); i++) {
598 QAction *itemLoad =
new QAction(names.at(i),
this);
599 QAction *itemRemove =
new QAction(names.at(i),
this);
600 mapperLoad->setMapping(itemLoad, names.at(i));
601 mapperRemove->setMapping(itemRemove, names.at(i));
602 connect(itemLoad, SIGNAL(triggered()), mapperLoad, SLOT(map()));
603 connect(itemRemove, SIGNAL(triggered()), mapperRemove, SLOT(map()));
604 menuLoad->addAction(itemLoad);
605 menuRemove->addAction(itemRemove);
607 connect(mapperLoad, SIGNAL(mappedString(
const QString &)),
this, SLOT(
executeCustomSetupLoad(
const QString &)));
608 connect(mapperRemove, SIGNAL(mappedString(
const QString &)),
this, SLOT(
executeCustomSetupRemove(
const QString &)));
613 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
615 QString str = settings.value(
name).toString();
621 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
629 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
646 }
else if (item ==
"SeqFit") {
648 }
else if (item ==
"UndoFit") {
650 }
else if (item ==
"Evaluate") {
656 if (item ==
"PlotGuess") {
658 }
else if (item ==
"ClearAll") {
664 if (item ==
"FindPeaks")
665 findPeaks(std::make_unique<FindPeakDefaultStrategy>());
666 if (item ==
"FindPeaksConvolve")
667 findPeaks(std::make_unique<FindPeakConvolveStrategy>());
671 if (item ==
"ClearFit")
676 if (item ==
"SaveSetup")
678 if (item ==
"ClearSetups")
680 if (item ==
"CopyToClipboard")
682 if (item ==
"LoadFromString")
692 FunctionFactory::Instance().notificationCenter.removeObserver(
m_updateObserver);
733 QtBrowserItem *ci =
m_browser->currentItem();
748 QtBrowserItem *ci =
m_browser->currentItem();
753 if (function.isEmpty()) {
777 auto cf = std::dynamic_pointer_cast<Mantid::API::CompositeFunction>(func);
778 if (!cf || (cf->name() !=
"CompositeFunction" && cf->name() !=
"MultiBG" && cf->name() !=
"MultiDomainFunction")) {
819 return Mantid::API::FunctionFactory::Instance().createInitialized(str.toStdString());
820 }
catch (
const std::exception &ex) {
821 QMessageBox::critical(
this,
"Mantid - Error",
"Unexpected exception caught:\n\n" + QString(ex.what()));
827 QtBrowserItem *ci =
m_browser->currentItem();
830 QMenu *menu =
new QMenu(
this);
841 if (isFunctionsGroup) {
842 action =
new QAction(
"Add function",
this);
843 connect(action, SIGNAL(triggered()),
this, SLOT(
addFunction()));
844 menu->addAction(action);
847 Mantid::API::AnalysisDataService::Instance().doesExist(
workspaceName())) {
848 action =
new QAction(
"Setup multifit",
this);
849 connect(action, SIGNAL(triggered()),
this, SLOT(
setupMultifit()));
850 menu->addAction(action);
855 action =
new QAction(
"Remove plot",
this);
856 connect(action, SIGNAL(triggered()),
this, SLOT(
removeGuessAll()));
857 menu->addAction(action);
859 action =
new QAction(
"Plot",
this);
860 connect(action, SIGNAL(triggered()),
this, SLOT(
plotGuessAll()));
861 menu->addAction(action);
865 menu->addSeparator();
867 action =
new QAction(
"Save",
this);
868 connect(action, SIGNAL(triggered()),
this, SLOT(
saveFunction()));
869 menu->addAction(action);
871 action =
new QAction(
"Load",
this);
872 connect(action, SIGNAL(triggered()),
this, SLOT(
loadFunction()));
873 menu->addAction(action);
875 action =
new QAction(
"Copy To Clipboard",
this);
876 connect(action, SIGNAL(triggered()),
this, SLOT(
copy()));
877 menu->addAction(action);
879 menu->addSeparator();
881 action =
new QAction(
"Help",
this);
882 connect(action, SIGNAL(triggered()),
this, SLOT(
browserHelp()));
883 menu->addAction(action);
884 }
else if (isSettingsGroup || isASetting) {
886 action =
new QAction(
"Fit",
this);
887 connect(action, SIGNAL(triggered()),
this, SLOT(
fit()));
888 menu->addAction(action);
892 action =
new QAction(
"Undo Fit",
this);
893 connect(action, SIGNAL(triggered()),
this, SLOT(
undoFit()));
894 menu->addAction(action);
897 action =
new QAction(
"Clear all",
this);
898 connect(action, SIGNAL(triggered()),
this, SLOT(
clear()));
899 menu->addAction(action);
901 action =
new QAction(
"Help",
this);
902 connect(action, SIGNAL(triggered()),
this, SLOT(
browserHelp()));
903 menu->addAction(action);
905 }
else if (isFunction) {
906 if (isCompositeFunction) {
907 action =
new QAction(
"Add function",
this);
908 connect(action, SIGNAL(triggered()),
this, SLOT(
addFunction()));
909 menu->addAction(action);
912 action =
new QAction(
"Remove",
this);
913 connect(action, SIGNAL(triggered()),
this, SLOT(
deleteFunction()));
914 menu->addAction(action);
918 action =
new QAction(
"Remove plot",
this);
920 menu->addAction(action);
922 action =
new QAction(
"Plot",
this);
924 menu->addAction(action);
928 action =
new QAction(
"Help",
this);
929 connect(action, SIGNAL(triggered()),
this, SLOT(
functionHelp()));
930 menu->addAction(action);
932 menu->addSeparator();
935 bool isTie = !isParameter && ci->property()->propertyName() ==
"Tie";
936 bool isLowerBound = !isParameter && ci->property()->propertyName() ==
"Lower Bound";
937 bool isUpperBound = !isParameter && ci->property()->propertyName() ==
"Upper Bound";
938 bool isType = isParameter && ci->property()->propertyName() ==
"Type";
943 action =
new QAction(
"Remove",
this);
944 connect(action, SIGNAL(triggered()),
this, SLOT(
deleteTie()));
945 menu->addAction(action);
946 }
else if (isLowerBound || isUpperBound) {
947 action =
new QAction(
"Remove",
this);
948 connect(action, SIGNAL(triggered()),
this, SLOT(
removeBounds()));
949 menu->addAction(action);
950 }
else if (
count() > 0 && isParameter) {
956 if (!hasTies && !hasFixes) {
957 QMenu *constraintMenu = menu->addMenu(
"Constraint");
959 QMenu *detailMenu = constraintMenu->addMenu(
"Lower Bound");
961 action =
new QAction(
"10%",
this);
963 detailMenu->addAction(action);
965 action =
new QAction(
"50%",
this);
967 detailMenu->addAction(action);
969 action =
new QAction(
"Custom",
this);
970 connect(action, SIGNAL(triggered()),
this, SLOT(
addLowerBound()));
971 detailMenu->addAction(action);
972 detailMenu = constraintMenu->addMenu(
"Upper Bound");
974 action =
new QAction(
"10%",
this);
976 detailMenu->addAction(action);
978 action =
new QAction(
"50%",
this);
980 detailMenu->addAction(action);
982 action =
new QAction(
"Custom",
this);
983 connect(action, SIGNAL(triggered()),
this, SLOT(
addUpperBound()));
984 detailMenu->addAction(action);
985 detailMenu = constraintMenu->addMenu(
"Both Bounds");
987 action =
new QAction(
"10%",
this);
989 detailMenu->addAction(action);
991 action =
new QAction(
"50%",
this);
993 detailMenu->addAction(action);
995 action =
new QAction(
"Custom",
this);
996 connect(action, SIGNAL(triggered()),
this, SLOT(
addBothBounds()));
997 detailMenu->addAction(action);
1001 action =
new QAction(
"Remove constraints",
this);
1002 connect(action, SIGNAL(triggered()),
this, SLOT(
removeBounds()));
1003 menu->addAction(action);
1006 if (!hasTies && !hasFixes && !hasBounds) {
1007 action =
new QAction(
"Fix",
this);
1008 connect(action, SIGNAL(triggered()),
this, SLOT(
addFixTie()));
1009 menu->addAction(action);
1012 action =
new QAction(
"Tie",
this);
1013 connect(action, SIGNAL(triggered()),
this, SLOT(
addTie()));
1014 menu->addAction(action);
1016 QMenu *detail = menu->addMenu(
"Tie");
1018 action =
new QAction(
"To function",
this);
1020 detail->addAction(action);
1022 action =
new QAction(
"Custom Tie",
this);
1023 connect(action, SIGNAL(triggered()),
this, SLOT(
addTie()));
1024 detail->addAction(action);
1026 }
else if (hasTies) {
1027 action =
new QAction(
"Remove tie",
this);
1028 connect(action, SIGNAL(triggered()),
this, SLOT(
deleteTie()));
1029 menu->addAction(action);
1030 }
else if (hasFixes) {
1031 action =
new QAction(
"Remove fix",
this);
1032 connect(action, SIGNAL(triggered()),
this, SLOT(
deleteTie()));
1033 menu->addAction(action);
1038 menu->popup(QCursor::pos());
1044 const QtBrowserItem *
const ci =
m_browser->currentItem();
1082 return std::shared_ptr<Mantid::API::Workspace>();
1084 return Mantid::API::AnalysisDataService::Instance().retrieve(wsName);
1086 return std::shared_ptr<Mantid::API::Workspace>();
1093 std::string res =
"";
1113 mws = std::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(
1114 Mantid::API::AnalysisDataService::Instance().retrieve(wsName.toStdString()));
1119 if (wi < mws->getNumberHistograms() && !mws->x(wi).empty()) {
1154 if (withProperties) {
1158 if (!
value.isEmpty()) {
1159 minimStr +=
"," + prop->propertyName() +
"=" +
value;
1162 minimStr +=
"," + prop->propertyName() +
"=";
1164 minimStr += QString::number(
m_intManager->value(prop));
1170 throw std::runtime_error(
"The fit browser doesn't support the type "
1171 "of minimizer's property " +
1172 prop->propertyName().toStdString());
1177 return minimStr.toStdString();
1219 const std::vector<std::string> names = Mantid::API::FunctionFactory::Instance().getFunctionNamesGUI();
1225 const auto &functionFactory = Mantid::API::FunctionFactory::Instance();
1226 for (
const auto &fnName : names) {
1227 if (fnName ==
"MultiBG")
1231 function = functionFactory.createFunction(fnName);
1232 }
catch (std::exception &exc) {
1233 g_log.
warning() <<
"Unable to create " << fnName <<
": " << exc.what() <<
"\n";
1236 QString qfnName = QString::fromStdString(fnName);
1255 bool storeSettings =
false;
1261 }
else if (prop->propertyName() ==
"Type") {
1278 storeSettings =
true;
1281 if (storeSettings) {
1283 settings.beginGroup(
"Mantid/FitBrowser");
1301 settings.beginGroup(
"Mantid/FitBrowser");
1327 if (allowedIndex != currentIndex) {
1332 }
else if (prop->propertyName() ==
"Workspace Index") {
1338 }
else if (prop->propertyName() ==
"WorkspaceIndex") {
1341 auto const index = prop->valueText().toInt();
1350 settings.beginGroup(
"Mantid/FitBrowser");
1380 }
else if (prop ==
m_endX) {
1395 if (prop->propertyName() ==
"LowerBound") {
1398 }
else if (prop->propertyName() ==
"UpperBound") {
1410 if (vectorAttribute) {
1416 std::stringstream err_str;
1417 err_str << prop->propertyName().toStdString() <<
" - " << ve.what();
1444 if (oName.find_first_not_of(
' ') == std::string::npos) {
1451 }
else if (prop->propertyName() ==
"Tie") {
1460 const QString parName = h->
functionPrefix() +
"." + parProp->propertyName();
1470 h->
addTie(parName +
"=" + exp);
1473 "Failed to update tie on " + parName.toStdString() +
". Expression " + exp.toStdString() +
" is invalid.";
1474 QMessageBox::critical(
this,
"Mantid - Error", msg.c_str());
1478 }
else if (
getHandler()->setAttribute(prop)) {
1495 }
catch (std::exception &) {
1500 const auto oldTieStr = oldTie->asString();
1501 oldExp = QString::fromStdString(oldTieStr.substr(oldTieStr.find(
"=") + 1));
1606 if (wsName.empty()) {
1607 QMessageBox::critical(
this,
"Mantid - Error",
"Workspace name is not set");
1627 alg->setProperty(
"EvaluationType",
"Histogram");
1629 alg->setProperty(
"Function", std::dynamic_pointer_cast<Mantid::API::IFunction>(
compositeFunction())->clone());
1630 alg->setProperty(
"InputWorkspace", ws);
1631 auto tbl = std::dynamic_pointer_cast<ITableWorkspace>(ws);
1635 alg->setPropertyValue(
"XColumn",
getXColumnName().toStdString());
1636 alg->setPropertyValue(
"YColumn",
getYColumnName().toStdString());
1640 alg->setProperty(
"StartX",
startX());
1641 alg->setProperty(
"EndX",
endX());
1642 alg->setPropertyValue(
"Output",
outputName());
1643 alg->setPropertyValue(
"Minimizer",
minimizer(
true));
1653 alg->setProperty(
"OutputCompositeMembers",
true);
1654 if (alg->existsProperty(
"ConvolveMembers")) {
1659 if (alg->getPropertyValue(
"EvaluationType") !=
"Histogram")
1662 g_log.
warning(
"Exclude property not avaliable when evaluating as a histogram.");
1667 while (!result.available()) {
1668 QCoreApplication::processEvents();
1671 if (!result.error().empty()) {
1674 }
catch (
const std::exception &e) {
1675 QString msg =
"Fit algorithm failed.\n\n" + QString(e.what()) +
"\n";
1676 QMessageBox::critical(
this,
"Mantid - Error", msg);
1703 QString
name(QString::fromStdString(alg->
getProperty(
"InputWorkspace")));
1704 if (
name.contains(
'_'))
1713 std::string out = alg->
getProperty(
"OutputWorkspace");
1722 double quality = alg->
getProperty(
"OutputChi2overDoF");
1723 std::string costFunctionStr = alg->
getProperty(
"CostFunction");
1724 std::shared_ptr<Mantid::API::ICostFunction> costfun =
1725 Mantid::API::CostFunctionFactory::Instance().create(costFunctionStr);
1726 status = (status ==
"success") ?
"success" :
"failed";
1727 emit
changeWindowTitle(QString(
"Fit Function (") + costfun->shortName().c_str() +
" = " + QString::number(quality) +
1728 ", " + status +
")");
1738 return function->asString();
1745 text.replace(
"\n",
"<br>");
1746 QString color(
"green");
1747 if (status !=
"success") {
1751 m_status->setText(QString(
"Status: <span style='color:%2'>%1</span>").arg(text, color));
1766 QStringList allowedNames;
1767 auto wsList = Mantid::API::AnalysisDataService::Instance().getObjectNames();
1768 for (
const auto &wsName : wsList) {
1769 auto const &
name = QString::fromStdString(wsName);
1771 allowedNames <<
name;
1775 for (
const auto &
name : allowedNames) {
1816 auto const qName = QString::fromStdString(wsName);
1823 bool initialSignalsBlocked =
m_enumManager->signalsBlocked();
1849 int iName =
static_cast<int>(
m_workspaceNames.indexOf(QString(wsName.c_str())));
1854 bool initialSignalsBlocked =
m_enumManager->signalsBlocked();
1856 if (QString::fromStdString(wsName) != oldName) {
1871 if (item->text().toStdString() == wsName) {
1883 QString oldNameQ = QString::fromStdString(oldName);
1884 QString newNameQ = QString::fromStdString(newName);
1892 if (iWorkspace >= 0) {
1900 if (item->text().toStdString() == oldName) {
1954 auto tbl = std::dynamic_pointer_cast<ITableWorkspace>(ws);
1955 auto mws = std::dynamic_pointer_cast<MatrixWorkspace>(ws);
1959 std::vector<double> xColumnData;
1960 auto col = tbl->getColumn(xColumnIndex);
1962 for (
size_t i = 0; i < tbl->rowCount(); ++i) {
1963 xColumnData.emplace_back(col->toDouble(i));
1965 }
catch (std::invalid_argument &err) {
1966 QMessageBox::critical(
this,
"Mantid - Error",
"The X column is not a number");
1967 throw std::invalid_argument(err);
1969 std::sort(xColumnData.begin(), xColumnData.end());
1970 range.push_back(xColumnData.front());
1971 range.push_back(xColumnData.back());
1974 range.push_back(xData.front());
1975 range.push_back(xData.back());
1982 auto tbl = std::dynamic_pointer_cast<ITableWorkspace>(ws);
1983 QString columnName =
"";
1985 auto columns = tbl->getColumnNames();
1987 if (xIndex >=
static_cast<int>(columns.size())) {
1988 QMessageBox::critical(
nullptr,
"Mantid - Error",
"X column was not found.");
1990 columnName = QString::fromStdString(columns[xIndex]);
1997 auto tbl = std::dynamic_pointer_cast<ITableWorkspace>(ws);
1998 QString columnName =
"";
2000 auto columns = tbl->getColumnNames();
2002 if (yIndex >=
static_cast<int>(columns.size())) {
2003 QMessageBox::critical(
nullptr,
"Mantid - Error",
"Y column was not found.");
2005 columnName = QString::fromStdString(columns[yIndex]);
2012 auto tbl = std::dynamic_pointer_cast<ITableWorkspace>(ws);
2013 QString columnName =
"";
2015 auto columns = tbl->getColumnNames();
2018 if (errIndex >=
static_cast<int>(columns.size())) {
2019 QMessageBox::warning(
nullptr,
"Mantid - Warning",
"Error column was not found.");
2020 }
else if (errIndex != -1) {
2021 columnName = QString::fromStdString(columns[errIndex]);
2030 QtBrowserItem *res =
nullptr;
2031 for (
auto &child : children) {
2032 if (child->property() == prop) {
2036 if (grand_children.size() > 0)
2100 for (QtProperty *prop : props) {
2107 for (
auto paramIndex = 0u; paramIndex < finalFunction->nParams(); ++paramIndex) {
2108 compositeFunction()->setParameter(paramIndex, finalFunction->getParameter(paramIndex));
2155 QtBrowserItem *ci =
m_browser->currentItem();
2156 QtProperty *paramProp = ci->property();
2168 QString tieStr = QInputDialog::getText(
this,
"Mantid - Fit",
"Enter tie expression", QLineEdit::Normal,
"", &
ok);
2170 tieStr = tieStr.trimmed();
2171 if (!tieStr.contains(
'=')) {
2172 tieStr = h->
functionPrefix() +
"." + paramProp->propertyName() +
"=" + tieStr;
2183 QtBrowserItem *ci =
m_browser->currentItem();
2184 QtProperty *paramProp = ci->property();
2190 std::string parName = paramProp->propertyName().toStdString();
2191 QStringList fnNames;
2200 if (iPar == -1 && fun == h->
function().get())
2209 if (fnNames.empty() || iPar < 0) {
2210 QMessageBox::information(
this,
"Mantid - information",
"Cannot tie this parameter to any function");
2215 QString tieName = QInputDialog::getItem(
this,
"Mantid - Fit",
"Select function", fnNames, 0,
false, &
ok);
2220 QString tieExpr = QString::fromStdString(
m_compositeFunction->parameterName(iPar)) +
"=" + tieName;
2229 QtBrowserItem *ci =
m_browser->currentItem();
2230 QtProperty *paramProp = ci->property();
2236 h->
fix(paramProp->propertyName());
2243 QtBrowserItem *ci =
m_browser->currentItem();
2244 QtProperty *paramProp = ci->property();
2249 if (paramProp->propertyName() !=
"Tie") {
2250 auto parameterMap = h->
getTies();
2251 auto match = parameterMap.find(paramProp->propertyName());
2252 if (match != parameterMap.end()) {
2253 paramProp = match.value();
2256 if (paramProp->propertyName() ==
"Tie") {
2258 QString qParName = ties.key(paramProp,
"");
2259 std::string parName = qParName.toStdString();
2260 QStringList functionNames;
2262 int ithParameter = -1;
2268 if (ithParameter == -1 && function == h->
function().get())
2271 ithParameter =
static_cast<int>(i);
2278 if (functionNames.empty() && ithParameter < 0) {
2279 QMessageBox::information(
this,
"Mantid - information",
"Cannot find a parameter with this tie");
2281 QString tieExpr = QString::fromStdString(
m_compositeFunction->parameterName(ithParameter));
2282 h->
removeTie(paramProp, tieExpr.toStdString());
2285 h->
removeTie(ci->property()->propertyName());
2300 for (
const auto *sub : subs) {
2301 const auto propName = sub->propertyName();
2302 if (propName ==
"Tie") {
2304 }
else if (propName ==
"Fix") {
2306 }
else if (propName ==
"LowerBound") {
2308 }
else if (propName ==
"UpperBound") {
2320 std::find_if(std::cbegin(subs), std::cend(subs), [](
const auto x) {
return (*x).propertyName() ==
"Tie"; });
2321 sub != std::cend(subs)) {
2348 QtBrowserItem *ci =
m_browser->currentItem();
2349 QtProperty *parProp = ci->property();
2354 double x = parProp->valueText().toDouble();
2355 double loBound =
x * (1 - 0.01 * f);
2356 double upBound =
x * (1 + 0.01 * f);
2412 QtBrowserItem *ci =
m_browser->currentItem();
2413 QtProperty *parProp = ci->property();
2458 if (manager ==
nullptr)
2460 QtProperty *prop = manager->addProperty(
name);
2462 manager->setRange(prop, -DBL_MAX, DBL_MAX);
2473 QString propName =
name.toLower();
2474 if (propName ==
"filename") {
2476 }
else if (propName ==
"formula") {
2493 const std::vector<std::string> &allowed_values)
const {
2494 QStringList qAllowedValues;
2497 for (
const auto &values : allowed_values) {
2498 qAllowedValues << QString::fromStdString(values);
2511 auto *manager =
dynamic_cast<QtStringPropertyManager *
>(prop->propertyManager());
2513 manager->setValue(prop,
value);
2518 const auto *
const manager =
dynamic_cast<QtStringPropertyManager *
>(prop->propertyManager());
2520 return manager->value(prop);
2540 auto const allowedIndices =
2542 auto const firstIndex =
m_allowedSpectra.empty() ? 0 : allowedIndices.front();
2545 auto allowedIndex = currentIndex;
2546 if (currentIndex < firstIndex) {
2547 allowedIndex = firstIndex;
2548 }
else if (currentIndex > lastIndex) {
2549 allowedIndex = lastIndex;
2550 }
else if (!
m_allowedSpectra.empty() && !allowedIndices.contains(currentIndex)) {
2555 if (i >= 0 && i < allowedIndices.size()) {
2556 allowedIndex = allowedIndices[i];
2560 return allowedIndex;
2565 QString fnName = QInputDialog::getText(
this, tr(
"Mantid - Input"), tr(
"Please select a name for the function"),
2566 QLineEdit::Normal,
"", &
ok);
2567 if (
ok && !fnName.isEmpty()) {
2574 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
2575 QStringList names = settings.childKeys();
2576 if (names.contains(fnName) &&
2577 QMessageBox::question(
this,
"Mantid - Question",
2578 "Function with this name already exists.\n"
2579 "Would you like to replace it?",
2580 QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes) {
2589 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
2590 QStringList names = settings.childKeys();
2591 if (names.isEmpty()) {
2592 QMessageBox::information(
this,
"Mantid - Information",
"There are no saved functions");
2595 QString
name = QInputDialog::getItem(
this,
"Mantid - Input",
"Please select a function to load", names, 0,
false);
2596 if (!
name.isEmpty()) {
2597 QString str = settings.value(
name).toString();
2604 QString str = QInputDialog::getText(
this,
"Mantid - Input",
"Specify fit function string");
2606 if (!str.isEmpty()) {
2614 bool isAutoBGset =
false;
2630 QClipboard *clipboard = QApplication::clipboard();
2631 clipboard->setText(QString::fromStdString(
theFunction()->asString()));
2635 QClipboard *clipboard = QApplication::clipboard();
2636 QString str = clipboard->text();
2641 QString str = QString::fromStdString(
theFunction()->asString());
2649 if (!wsName.empty()) {
2651 auto ws = Mantid::API::AnalysisDataService::Instance().retrieve(wsName);
2652 auto mws = std::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(ws);
2656 function->setWorkspace(ws);
2666 bool hasPlot =
false;
2682 for (
const QString &att : attList) {
2683 QStringList name_value = att.split(
'=');
2684 if (name_value.size() == 2) {
2685 QString
name = name_value[0].trimmed();
2686 QString
value = name_value[1].trimmed();
2719 QStringList nameList = aName.split(
' ');
2720 if (nameList.isEmpty())
2722 QString
name = nameList[0];
2723 std::shared_ptr<Mantid::API::IFunction> f = std::shared_ptr<Mantid::API::IFunction>(
2724 Mantid::API::FunctionFactory::Instance().createFunction(
name.toStdString()));
2727 if (nameList.size() > 1) {
2728 nameList.removeFirst();
2731 Mantid::Kernel::ConfigService::Instance().setString(
"curvefitting.autoBackground", aName.toStdString());
2740 if (!wsName.empty() && dlg->addWorkspaces(QStringList(QString::fromStdString(wsName)))) {
2747 if (wsName.empty()) {
2748 QMessageBox::critical(
this,
"Mantid - Error",
"Workspace name is not set");
2752 std::string peakListName = wsName +
"_PeakList_tmp";
2754 QString::fromStdString(Mantid::Kernel::ConfigService::Instance().getString(
"curvefitting.findPeaksFWHM"));
2755 int FWHM{setting.isEmpty() ? 7 : setting.toInt()};
2758 findPeakStrategy->initialise(wsName,
workspaceIndex(), peakListName, FWHM, &obs);
2760 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
2763 Mantid::API::AnalysisDataService::Instance().retrieve(
workspaceName()));
2766 findPeakStrategy->execute();
2769 for (
size_t i = 0; i < findPeakStrategy->peakNumber(); ++i) {
2770 if (findPeakStrategy->getPeakCentre(i) <
startX() || findPeakStrategy->getPeakCentre(i) >
endX()) {
2781 QApplication::restoreOverrideCursor();
2785 QApplication::restoreOverrideCursor();
2799 settings.beginGroup(
"Mantid/FitBrowser");
2800 m_decimals = settings.value(
"decimals", 6).toInt();
2803 for (QtProperty *prop : props) {
2811 settings.beginGroup(
"Mantid/FitBrowser");
2848 QStringList ties = dlg->getParameterTies();
2850 if (!ties.isEmpty()) {
2853 Mantid::API::AnalysisDataService::Instance().retrieve(
workspaceName()));
2856 QString fun1Ini = QString::fromStdString(fun->asString());
2857 QString funIni =
"composite=MultiBG;" + fun1Ini +
",Workspace=" + wsName +
",WSParam=(WorkspaceIndex=0);";
2859 for (
size_t i = 1; i < mws->getNumberHistograms(); ++i) {
2860 QString comma = i > 1 ?
"," :
"";
2861 QString fi = comma +
"f" + QString::number(i) +
".";
2862 for (
int j = 0; j < static_cast<int>(fun->nParams()); ++j) {
2863 if (!ties[j].isEmpty()) {
2864 tieStr += fi + QString::fromStdString(fun->parameterName(j)) +
"=" + ties[j];
2867 QString wsParam =
",WSParam=(WorkspaceIndex=" + QString::number(i);
2868 wsParam +=
",StartX=" + QString::number(
startX()) +
",EndX=" + QString::number(
endX()) +
")";
2869 funIni += fun1Ini +
",Workspace=" + wsName + wsParam +
";";
2871 if (!tieStr.isEmpty()) {
2872 funIni +=
"ties=(" + tieStr +
")";
2888 QStringList parNames;
2891 throw std::runtime_error(
"IFunction expected but func function of another type");
2893 for (
size_t i = 0; i < fun0->nParams(); ++i) {
2894 parNames << QString::fromStdString(fun0->parameterName(i));
2900 throw std::runtime_error(
"IFunction expected but func function of another type");
2902 for (
size_t j = 0; j < fun->nParams(); ++j) {
2903 if (parNames.indexOf(QString::fromStdString(fun->parameterName(j))) < 0) {
2910 QApplication::setOverrideCursor(Qt::WaitCursor);
2914 table->addColumn(
"int",
"Index");
2915 for (
const QString &par : parNames) {
2916 table->addColumn(
"double", par.toStdString());
2938 Mantid::API::AnalysisDataService::Instance().addOrReplace(
workspaceName() +
"_Param_series", table);
2941 group->setProperty(
"InputWorkspaces", worspaceNames);
2946 QApplication::restoreOverrideCursor();
2968 ws = Mantid::API::AnalysisDataService::Instance().retrieve(
workspaceName());
2985 auto mws = std::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(ws);
2988 auto isHistogram = mws->isHistogramData();
2998 auto tws = std::dynamic_pointer_cast<Mantid::API::ITableWorkspace>(ws);
3010 auto names = tws->getColumnNames();
3011 QStringList columns;
3012 for (
const auto &
name : names) {
3013 columns << QString::fromStdString(
name);
3014 auto col = tws->getColumn(
name);
3015 if (xName.isEmpty() && col->getPlotType() == 1 ) {
3016 xName = QString::fromStdString(
name);
3018 if (yName.isEmpty() && col->getPlotType() == 2 ) {
3019 yName = QString::fromStdString(
name);
3021 if (errName.isEmpty() && col->getPlotType() == 5 ) {
3022 errName = QString::fromStdString(
name);
3028 if (!xName.isEmpty()) {
3031 if (
auto name = std::find_if(std::cbegin(columns), std::cend(columns), [&](
const auto x) {
return x != yName; });
3032 name != std::cend(columns)) {
3036 if (!yName.isEmpty()) {
3039 if (
auto name = std::find_if(std::cbegin(columns), std::cend(columns), [&](
const auto x) {
return x != xName; });
3040 name != std::cend(columns)) {
3044 columns.prepend(
"");
3046 if (!errName.isEmpty()) {
3086 for (
auto &prop : props) {
3087 if (propsToRemove.contains(prop->propertyName())) {
3103 auto ws = Mantid::API::AnalysisDataService::Instance().retrieve(
workspaceName());
3104 auto tws = std::dynamic_pointer_cast<Mantid::API::ITableWorkspace>(ws);
3108 if (i < 0 || i >=
static_cast<int>(tws->rowCount()) || tws->rowCount() == 0)
3110 auto col = tws->getColumn(
static_cast<size_t>(i));
3111 const double startXVal = col->toDouble(0);
3112 const double endXVal = col->toDouble(tws->rowCount() - 1);
3131 auto minzer = Mantid::API::FuncMinimizerFactory::Instance().createMinimizer(this->
minimizer());
3132 const auto &properties = minzer->getProperties();
3133 for (
auto property : properties) {
3134 QString propName = QString::fromStdString((*property).name());
3135 QtProperty *prop =
nullptr;
3154 QString val = QString::fromStdString(prp->value());
3158 m_stringManager->setValue(prop, QString::fromStdString((*property).value()));
3160 QMessageBox::warning(
this,
"Mantid - Error",
3161 "Type of minimizer's property " + propName +
" is not yet supported by the browser.");
3168 QString toolTip = QString::fromStdString((*property).documentation());
3169 if (!toolTip.isEmpty()) {
3170 prop->setToolTip(toolTip);
3182 size_t np = fun->nParams();
3184 for (
size_t i = 0; i < np; ++i) {
3185 const double parValue = fun->getParameter(i);
3186 out.append(parValue);
3196 size_t np = fun->nParams();
3198 for (
size_t i = 0; i < np; ++i) {
3199 std::string parName = fun->parameterName(i);
3200 out.append(QString::fromStdString(parName));
3255 return static_cast<int>(m_functionsGroup->children().size());
3259 auto const name = wsName.toStdString();
3263 indices.reserve(wsSpectra.size());
3264 std::transform(wsSpectra.cbegin(), wsSpectra.cend(), std::back_inserter(indices),
3265 [&ws](
const auto i) { return static_cast<int>(ws->getIndexFromSpectrumNumber(i)); });
3278 throw std::runtime_error(
"Workspace " +
name +
" is not a MatrixWorkspace");
3287 QString qWsName = QString::fromStdString(wsName);
3295 auto const name = wsName.toStdString();
3300 throw std::runtime_error(
"Workspace " +
name +
" is not a TableWorkspace");
3313 return addFunction(fnName.toStdString())->functionPrefix();
3317 const std::unique_ptr<FindPeakStrategyGeneric> &findPeakStrategy) {
3318 bool validFn =
false;
3319 auto f = std::dynamic_pointer_cast<Mantid::API::IPeakFunction>(
3320 Mantid::API::FunctionFactory::Instance().createFunction(
defaultPeakType()));
3324 f->setCentre(findPeakStrategy->getPeakCentre(peakIndex));
3325 f->setFwhm(findPeakStrategy->getPeakWidth(peakIndex));
3326 f->setHeight(findPeakStrategy->getPeakHeight(peakIndex));
3333 if (prefix.isEmpty())
3334 throw std::runtime_error(
"Peak function prefix cannot be empty");
3335 auto const indexList = prefix.split(
".");
3336 auto const n = indexList.size() - 1;
3338 for (
int i = 0; i <
n; ++i) {
3339 auto const index = indexList[i].mid(1).toInt();
3340 handler = handler->getHandler(
index);
3342 return handler->getHandler(indexList[
n].mid(1).toInt());
3347 handler->setCentre(
value);
3348 handler->updateParameters();
3353 return handler->centre();
3358 handler->setHeight(
value);
3359 handler->updateParameters();
3364 return handler->height();
3369 handler->setFwhm(
value);
3370 handler->updateParameters();
3375 return handler->fwhm();
3380 return handler->getWidthParameterName();
3385 return handler->getCentreParameterName();
3390 return handler->isParameterExplicitlySet(param);
3396 const auto nFunctions = parentHandler->cfun()->nFunctions();
3397 for (
size_t i = 0; i < nFunctions; ++i) {
3398 const auto *handler = parentHandler->getHandler(i);
3399 if (handler->pfun()) {
3400 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.