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(mappedString(
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(mappedString(
const QString &)),
this,
425 setupSubMenuManage->addAction(setupActionSave);
427 setupSubMenuManage->addAction(setupActionClear);
428 setupSubMenuManage->addAction(setupActionCopyToClipboard);
429 setupSubMenuManage->addAction(setupActionLoadFromString);
430 setupActionManageSetup->setMenu(setupSubMenuManage);
432 QMenu *setupSubMenuRemove =
new QMenu(
this);
437 QSignalMapper *PeakFindingAlgMapper =
new QSignalMapper(
this);
438 PeakFindingAlgMapper->setMapping(setupActionFindPeaks,
"FindPeaks");
439 PeakFindingAlgMapper->setMapping(setupActionFindPeaksConvolve,
"FindPeaksConvolve");
440 connect(setupActionFindPeaks, SIGNAL(triggered()), PeakFindingAlgMapper, SLOT(map()));
441 connect(setupActionFindPeaksConvolve, SIGNAL(triggered()), PeakFindingAlgMapper, SLOT(map()));
442 connect(PeakFindingAlgMapper, SIGNAL(mappedString(
const QString &)),
this,
445 QSignalMapper *setupMapper =
new QSignalMapper(
this);
446 setupMapper->setMapping(setupActionClearFit,
"ClearFit");
447 connect(setupActionClearFit, SIGNAL(triggered()), setupMapper, SLOT(map()));
448 connect(setupMapper, SIGNAL(mappedString(
const QString &)),
this, SLOT(
executeSetupMenu(
const QString &)));
450 QMenu *setupSubMenuPeakFindingAgls =
new QMenu(
this);
451 setupSubMenuPeakFindingAgls->addAction(setupActionFindPeaks);
452 setupSubMenuPeakFindingAgls->addAction(setupActionFindPeaksConvolve);
453 setupActionPeakFindingAlgs->setMenu(setupSubMenuPeakFindingAgls);
456 setupMenu->addAction(setupActionManageSetup);
457 setupMenu->addSeparator();
458 setupMenu->addAction(setupActionPeakFindingAlgs);
459 setupMenu->addSeparator();
460 setupMenu->addAction(setupActionClearFit);
461 btnSetup->setMenu(setupMenu);
465 buttonsLayout->addWidget(btnFit, 0, 0);
466 buttonsLayout->addWidget(btnDisplay, 0, 1);
467 buttonsLayout->addWidget(btnSetup, 0, 2);
469 m_status =
new QLabel(
"Status:", w);
472 Qt::QueuedConnection);
474 layout->addLayout(buttonsLayout);
475 layout->addWidget(
m_tip);
477 m_browser->setObjectName(
"tree_browser");
488 m_browser->setContextMenuPolicy(Qt::CustomContextMenu);
489 connect(
m_browser, SIGNAL(customContextMenuRequested(
const QPoint &)),
this, SLOT(
popupMenu(
const QPoint &)));
507 FunctionFactory::Instance().notificationCenter.addObserver(
m_updateObserver);
509 FunctionFactory::Instance().enableNotifications();
523 const std::vector<std::string> workspaceNames{outName +
"_NormalisedCovarianceMatrix", outName +
"_Parameters",
524 outName +
"_Workspace"};
526 for (
const auto &
name : workspaceNames) {
528 auto foundInList =
m_wsListWidget->findItems(QString::fromStdString(
name), Qt::MatchExactly);
529 if (foundInList.size() == 0 && AnalysisDataService::Instance().doesExist(
name)) {
544 auto wsName = item->text();
556 QtCheckBoxFactory *checkBoxFactory =
new QtCheckBoxFactory(w);
557 QtEnumEditorFactory *comboBoxFactory =
new QtEnumEditorFactory(w);
558 QtSpinBoxFactory *spinBoxFactory =
new QtSpinBoxFactory(w);
559 DoubleEditorFactory *doubleEditorFactory =
new DoubleEditorFactory(w);
560 StringEditorFactory *stringEditFactory =
new StringEditorFactory(w);
562 FormulaDialogEditorFactory *formulaDialogEditFactory =
new FormulaDialogEditorFactory(w);
587 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
588 QStringList names = settings.childKeys();
590 QSignalMapper *mapperLoad =
new QSignalMapper(
this);
591 QSignalMapper *mapperRemove =
new QSignalMapper(
this);
596 for (
int i = 0; i < names.size(); i++) {
597 QAction *itemLoad =
new QAction(names.at(i),
this);
598 QAction *itemRemove =
new QAction(names.at(i),
this);
599 mapperLoad->setMapping(itemLoad, names.at(i));
600 mapperRemove->setMapping(itemRemove, names.at(i));
601 connect(itemLoad, SIGNAL(triggered()), mapperLoad, SLOT(map()));
602 connect(itemRemove, SIGNAL(triggered()), mapperRemove, SLOT(map()));
603 menuLoad->addAction(itemLoad);
604 menuRemove->addAction(itemRemove);
606 connect(mapperLoad, SIGNAL(mappedString(
const QString &)),
this, SLOT(
executeCustomSetupLoad(
const QString &)));
607 connect(mapperRemove, SIGNAL(mappedString(
const QString &)),
this, SLOT(
executeCustomSetupRemove(
const QString &)));
612 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
614 QString str = settings.value(
name).toString();
620 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
622 settings.remove(
name);
628 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
645 }
else if (item ==
"SeqFit") {
647 }
else if (item ==
"UndoFit") {
649 }
else if (item ==
"Evaluate") {
655 if (item ==
"PlotGuess") {
657 }
else if (item ==
"ClearAll") {
663 if (item ==
"FindPeaks")
664 findPeaks(std::make_unique<FindPeakDefaultStrategy>());
665 if (item ==
"FindPeaksConvolve")
666 findPeaks(std::make_unique<FindPeakConvolveStrategy>());
670 if (item ==
"ClearFit")
675 if (item ==
"SaveSetup")
677 if (item ==
"ClearSetups")
679 if (item ==
"CopyToClipboard")
681 if (item ==
"LoadFromString")
691 FunctionFactory::Instance().notificationCenter.removeObserver(
m_updateObserver);
730 QtBrowserItem *ci =
m_browser->currentItem();
745 QtBrowserItem *ci =
m_browser->currentItem();
750 if (function.isEmpty()) {
774 auto cf = std::dynamic_pointer_cast<Mantid::API::CompositeFunction>(func);
775 if (!cf || (cf->name() !=
"CompositeFunction" && cf->name() !=
"MultiBG" && cf->name() !=
"MultiDomainFunction")) {
816 return Mantid::API::FunctionFactory::Instance().createInitialized(str.toStdString());
817 }
catch (
const std::exception &ex) {
818 QMessageBox::critical(
this,
"Mantid - Error",
"Unexpected exception caught:\n\n" + QString(ex.what()));
824 QtBrowserItem *ci =
m_browser->currentItem();
827 QMenu *menu =
new QMenu(
this);
838 if (isFunctionsGroup) {
839 action =
new QAction(
"Add function",
this);
840 connect(action, SIGNAL(triggered()),
this, SLOT(
addFunction()));
841 menu->addAction(action);
844 Mantid::API::AnalysisDataService::Instance().doesExist(
workspaceName())) {
845 action =
new QAction(
"Setup multifit",
this);
846 connect(action, SIGNAL(triggered()),
this, SLOT(
setupMultifit()));
847 menu->addAction(action);
852 action =
new QAction(
"Remove plot",
this);
853 connect(action, SIGNAL(triggered()),
this, SLOT(
removeGuessAll()));
854 menu->addAction(action);
856 action =
new QAction(
"Plot",
this);
857 connect(action, SIGNAL(triggered()),
this, SLOT(
plotGuessAll()));
858 menu->addAction(action);
862 menu->addSeparator();
864 action =
new QAction(
"Save",
this);
865 connect(action, SIGNAL(triggered()),
this, SLOT(
saveFunction()));
866 menu->addAction(action);
868 action =
new QAction(
"Load",
this);
869 connect(action, SIGNAL(triggered()),
this, SLOT(
loadFunction()));
870 menu->addAction(action);
872 action =
new QAction(
"Copy To Clipboard",
this);
873 connect(action, SIGNAL(triggered()),
this, SLOT(
copy()));
874 menu->addAction(action);
876 menu->addSeparator();
878 action =
new QAction(
"Help",
this);
879 connect(action, SIGNAL(triggered()),
this, SLOT(
browserHelp()));
880 menu->addAction(action);
881 }
else if (isSettingsGroup || isASetting) {
883 action =
new QAction(
"Fit",
this);
884 connect(action, SIGNAL(triggered()),
this, SLOT(
fit()));
885 menu->addAction(action);
889 action =
new QAction(
"Undo Fit",
this);
890 connect(action, SIGNAL(triggered()),
this, SLOT(
undoFit()));
891 menu->addAction(action);
894 action =
new QAction(
"Clear all",
this);
895 connect(action, SIGNAL(triggered()),
this, SLOT(
clear()));
896 menu->addAction(action);
898 action =
new QAction(
"Help",
this);
899 connect(action, SIGNAL(triggered()),
this, SLOT(
browserHelp()));
900 menu->addAction(action);
902 }
else if (isFunction) {
903 if (isCompositeFunction) {
904 action =
new QAction(
"Add function",
this);
905 connect(action, SIGNAL(triggered()),
this, SLOT(
addFunction()));
906 menu->addAction(action);
909 action =
new QAction(
"Remove",
this);
910 connect(action, SIGNAL(triggered()),
this, SLOT(
deleteFunction()));
911 menu->addAction(action);
915 action =
new QAction(
"Remove plot",
this);
917 menu->addAction(action);
919 action =
new QAction(
"Plot",
this);
921 menu->addAction(action);
925 action =
new QAction(
"Help",
this);
926 connect(action, SIGNAL(triggered()),
this, SLOT(
functionHelp()));
927 menu->addAction(action);
929 menu->addSeparator();
932 bool isTie = !isParameter && ci->property()->propertyName() ==
"Tie";
933 bool isLowerBound = !isParameter && ci->property()->propertyName() ==
"Lower Bound";
934 bool isUpperBound = !isParameter && ci->property()->propertyName() ==
"Upper Bound";
935 bool isType = isParameter && ci->property()->propertyName() ==
"Type";
940 action =
new QAction(
"Remove",
this);
941 connect(action, SIGNAL(triggered()),
this, SLOT(
deleteTie()));
942 menu->addAction(action);
943 }
else if (isLowerBound || isUpperBound) {
944 action =
new QAction(
"Remove",
this);
945 connect(action, SIGNAL(triggered()),
this, SLOT(
removeBounds()));
946 menu->addAction(action);
947 }
else if (
count() > 0 && isParameter) {
953 if (!hasTies && !hasFixes) {
954 QMenu *constraintMenu = menu->addMenu(
"Constraint");
956 QMenu *detailMenu = constraintMenu->addMenu(
"Lower Bound");
958 action =
new QAction(
"10%",
this);
960 detailMenu->addAction(action);
962 action =
new QAction(
"50%",
this);
964 detailMenu->addAction(action);
966 action =
new QAction(
"Custom",
this);
967 connect(action, SIGNAL(triggered()),
this, SLOT(
addLowerBound()));
968 detailMenu->addAction(action);
969 detailMenu = constraintMenu->addMenu(
"Upper Bound");
971 action =
new QAction(
"10%",
this);
973 detailMenu->addAction(action);
975 action =
new QAction(
"50%",
this);
977 detailMenu->addAction(action);
979 action =
new QAction(
"Custom",
this);
980 connect(action, SIGNAL(triggered()),
this, SLOT(
addUpperBound()));
981 detailMenu->addAction(action);
982 detailMenu = constraintMenu->addMenu(
"Both Bounds");
984 action =
new QAction(
"10%",
this);
986 detailMenu->addAction(action);
988 action =
new QAction(
"50%",
this);
990 detailMenu->addAction(action);
992 action =
new QAction(
"Custom",
this);
993 connect(action, SIGNAL(triggered()),
this, SLOT(
addBothBounds()));
994 detailMenu->addAction(action);
998 action =
new QAction(
"Remove constraints",
this);
999 connect(action, SIGNAL(triggered()),
this, SLOT(
removeBounds()));
1000 menu->addAction(action);
1003 if (!hasTies && !hasFixes && !hasBounds) {
1004 action =
new QAction(
"Fix",
this);
1005 connect(action, SIGNAL(triggered()),
this, SLOT(
addFixTie()));
1006 menu->addAction(action);
1009 action =
new QAction(
"Tie",
this);
1010 connect(action, SIGNAL(triggered()),
this, SLOT(
addTie()));
1011 menu->addAction(action);
1013 QMenu *detail = menu->addMenu(
"Tie");
1015 action =
new QAction(
"To function",
this);
1017 detail->addAction(action);
1019 action =
new QAction(
"Custom Tie",
this);
1020 connect(action, SIGNAL(triggered()),
this, SLOT(
addTie()));
1021 detail->addAction(action);
1023 }
else if (hasTies) {
1024 action =
new QAction(
"Remove tie",
this);
1025 connect(action, SIGNAL(triggered()),
this, SLOT(
deleteTie()));
1026 menu->addAction(action);
1027 }
else if (hasFixes) {
1028 action =
new QAction(
"Remove fix",
this);
1029 connect(action, SIGNAL(triggered()),
this, SLOT(
deleteTie()));
1030 menu->addAction(action);
1035 menu->popup(QCursor::pos());
1041 const QtBrowserItem *
const ci =
m_browser->currentItem();
1079 return std::shared_ptr<Mantid::API::Workspace>();
1081 return Mantid::API::AnalysisDataService::Instance().retrieve(wsName);
1083 return std::shared_ptr<Mantid::API::Workspace>();
1090 std::string res =
"";
1110 mws = std::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(
1111 Mantid::API::AnalysisDataService::Instance().retrieve(wsName.toStdString()));
1116 if (wi < mws->getNumberHistograms() && !mws->x(wi).empty()) {
1151 if (withProperties) {
1155 if (!
value.isEmpty()) {
1156 minimStr +=
"," + prop->propertyName() +
"=" +
value;
1159 minimStr +=
"," + prop->propertyName() +
"=";
1161 minimStr += QString::number(
m_intManager->value(prop));
1167 throw std::runtime_error(
"The fit browser doesn't support the type "
1168 "of minimizer's property " +
1169 prop->propertyName().toStdString());
1174 return minimStr.toStdString();
1216 const std::vector<std::string> names = Mantid::API::FunctionFactory::Instance().getFunctionNamesGUI();
1222 const auto &functionFactory = Mantid::API::FunctionFactory::Instance();
1223 for (
const auto &fnName : names) {
1224 if (fnName ==
"MultiBG")
1228 function = functionFactory.createFunction(fnName);
1229 }
catch (std::exception &exc) {
1230 g_log.
warning() <<
"Unable to create " << fnName <<
": " << exc.what() <<
"\n";
1233 QString qfnName = QString::fromStdString(fnName);
1252 bool storeSettings =
false;
1258 }
else if (prop->propertyName() ==
"Type") {
1275 storeSettings =
true;
1278 if (storeSettings) {
1280 settings.beginGroup(
"Mantid/FitBrowser");
1282 settings.setValue(prop->propertyName(), val);
1298 settings.beginGroup(
"Mantid/FitBrowser");
1299 settings.setValue(prop->propertyName(), val);
1324 if (allowedIndex != currentIndex) {
1329 }
else if (prop->propertyName() ==
"Workspace Index") {
1335 }
else if (prop->propertyName() ==
"WorkspaceIndex") {
1338 auto const index = prop->valueText().toInt();
1347 settings.beginGroup(
"Mantid/FitBrowser");
1349 settings.setValue(prop->propertyName(), val);
1377 }
else if (prop ==
m_endX) {
1392 if (prop->propertyName() ==
"LowerBound") {
1395 }
else if (prop->propertyName() ==
"UpperBound") {
1407 if (vectorAttribute) {
1413 std::stringstream err_str;
1414 err_str << prop->propertyName().toStdString() <<
" - " << ve.what();
1441 if (oName.find_first_not_of(
' ') == std::string::npos) {
1448 }
else if (prop->propertyName() ==
"Tie") {
1457 const QString parName = h->
functionPrefix() +
"." + parProp->propertyName();
1467 h->
addTie(parName +
"=" + exp);
1470 "Failed to update tie on " + parName.toStdString() +
". Expression " + exp.toStdString() +
" is invalid.";
1471 QMessageBox::critical(
this,
"Mantid - Error", msg.c_str());
1475 }
else if (
getHandler()->setAttribute(prop)) {
1492 }
catch (std::exception &) {
1497 const auto oldTieStr = oldTie->asString();
1498 oldExp = QString::fromStdString(oldTieStr.substr(oldTieStr.find(
"=") + 1));
1603 if (wsName.empty()) {
1604 QMessageBox::critical(
this,
"Mantid - Error",
"Workspace name is not set");
1624 alg->setProperty(
"EvaluationType",
"Histogram");
1626 alg->setProperty(
"Function", std::dynamic_pointer_cast<Mantid::API::IFunction>(
compositeFunction())->clone());
1627 alg->setProperty(
"InputWorkspace", ws);
1628 auto tbl = std::dynamic_pointer_cast<ITableWorkspace>(ws);
1632 alg->setPropertyValue(
"XColumn",
getXColumnName().toStdString());
1633 alg->setPropertyValue(
"YColumn",
getYColumnName().toStdString());
1637 alg->setProperty(
"StartX",
startX());
1638 alg->setProperty(
"EndX",
endX());
1639 alg->setPropertyValue(
"Output",
outputName());
1640 alg->setPropertyValue(
"Minimizer",
minimizer(
true));
1650 alg->setProperty(
"OutputCompositeMembers",
true);
1651 if (alg->existsProperty(
"ConvolveMembers")) {
1656 if (alg->getPropertyValue(
"EvaluationType") !=
"Histogram")
1659 g_log.
warning(
"Exclude property not avaliable when evaluating as a histogram.");
1664 while (!result.available()) {
1665 QCoreApplication::processEvents();
1668 if (!result.error().empty()) {
1671 }
catch (
const std::exception &e) {
1672 QString msg =
"Fit algorithm failed.\n\n" + QString(e.what()) +
"\n";
1673 QMessageBox::critical(
this,
"Mantid - Error", msg);
1700 QString
name(QString::fromStdString(alg->
getProperty(
"InputWorkspace")));
1701 if (
name.contains(
'_'))
1710 std::string out = alg->
getProperty(
"OutputWorkspace");
1719 double quality = alg->
getProperty(
"OutputChi2overDoF");
1720 std::string costFunctionStr = alg->
getProperty(
"CostFunction");
1721 std::shared_ptr<Mantid::API::ICostFunction> costfun =
1722 Mantid::API::CostFunctionFactory::Instance().create(costFunctionStr);
1723 status = (status ==
"success") ?
"success" :
"failed";
1724 emit
changeWindowTitle(QString(
"Fit Function (") + costfun->shortName().c_str() +
" = " + QString::number(quality) +
1725 ", " + status +
")");
1735 return function->asString();
1742 text.replace(
"\n",
"<br>");
1743 QString color(
"green");
1744 if (status !=
"success") {
1748 m_status->setText(QString(
"Status: <span style='color:%2'>%1</span>").arg(text, color));
1763 QStringList allowedNames;
1764 auto wsList = Mantid::API::AnalysisDataService::Instance().getObjectNames();
1765 for (
const auto &wsName : wsList) {
1766 auto const &
name = QString::fromStdString(wsName);
1768 allowedNames <<
name;
1772 for (
const auto &
name : allowedNames) {
1813 auto const qName = QString::fromStdString(wsName);
1820 bool initialSignalsBlocked =
m_enumManager->signalsBlocked();
1846 int iName =
static_cast<int>(
m_workspaceNames.indexOf(QString(wsName.c_str())));
1851 bool initialSignalsBlocked =
m_enumManager->signalsBlocked();
1853 if (QString::fromStdString(wsName) != oldName) {
1868 if (item->text().toStdString() == wsName) {
1880 QString oldNameQ = QString::fromStdString(oldName);
1881 QString newNameQ = QString::fromStdString(newName);
1889 if (iWorkspace >= 0) {
1897 if (item->text().toStdString() == oldName) {
1951 auto tbl = std::dynamic_pointer_cast<ITableWorkspace>(ws);
1952 auto mws = std::dynamic_pointer_cast<MatrixWorkspace>(ws);
1953 QVector<double> range;
1956 std::vector<double> xColumnData;
1957 auto col = tbl->getColumn(xColumnIndex);
1959 for (
size_t i = 0; i < tbl->rowCount(); ++i) {
1960 xColumnData.emplace_back(col->toDouble(i));
1962 }
catch (std::invalid_argument &err) {
1963 QMessageBox::critical(
this,
"Mantid - Error",
"The X column is not a number");
1964 throw std::invalid_argument(err);
1966 std::sort(xColumnData.begin(), xColumnData.end());
1967 range.push_back(xColumnData.front());
1968 range.push_back(xColumnData.back());
1971 range.push_back(xData.front());
1972 range.push_back(xData.back());
1979 auto tbl = std::dynamic_pointer_cast<ITableWorkspace>(ws);
1980 QString columnName =
"";
1982 auto columns = tbl->getColumnNames();
1984 if (xIndex >=
static_cast<int>(columns.size())) {
1985 QMessageBox::critical(
nullptr,
"Mantid - Error",
"X column was not found.");
1987 columnName = QString::fromStdString(columns[xIndex]);
1994 auto tbl = std::dynamic_pointer_cast<ITableWorkspace>(ws);
1995 QString columnName =
"";
1997 auto columns = tbl->getColumnNames();
1999 if (yIndex >=
static_cast<int>(columns.size())) {
2000 QMessageBox::critical(
nullptr,
"Mantid - Error",
"Y column was not found.");
2002 columnName = QString::fromStdString(columns[yIndex]);
2009 auto tbl = std::dynamic_pointer_cast<ITableWorkspace>(ws);
2010 QString columnName =
"";
2012 auto columns = tbl->getColumnNames();
2015 if (errIndex >=
static_cast<int>(columns.size())) {
2016 QMessageBox::warning(
nullptr,
"Mantid - Warning",
"Error column was not found.");
2017 }
else if (errIndex != -1) {
2018 columnName = QString::fromStdString(columns[errIndex]);
2027 QtBrowserItem *res =
nullptr;
2028 for (
auto &child : children) {
2029 if (child->property() == prop) {
2033 if (grand_children.size() > 0)
2097 foreach (QtProperty *prop, props) {
2104 for (
auto paramIndex = 0u; paramIndex < finalFunction->nParams(); ++paramIndex) {
2105 compositeFunction()->setParameter(paramIndex, finalFunction->getParameter(paramIndex));
2152 QtBrowserItem *ci =
m_browser->currentItem();
2153 QtProperty *paramProp = ci->property();
2165 QString tieStr = QInputDialog::getText(
this,
"Mantid - Fit",
"Enter tie expression", QLineEdit::Normal,
"", &ok);
2167 tieStr = tieStr.trimmed();
2168 if (!tieStr.contains(
'=')) {
2169 tieStr = h->
functionPrefix() +
"." + paramProp->propertyName() +
"=" + tieStr;
2180 QtBrowserItem *ci =
m_browser->currentItem();
2181 QtProperty *paramProp = ci->property();
2187 std::string parName = paramProp->propertyName().toStdString();
2188 QStringList fnNames;
2197 if (iPar == -1 && fun == h->
function().get())
2206 if (fnNames.empty() || iPar < 0) {
2207 QMessageBox::information(
this,
"Mantid - information",
"Cannot tie this parameter to any function");
2212 QString tieName = QInputDialog::getItem(
this,
"Mantid - Fit",
"Select function", fnNames, 0,
false, &ok);
2217 QString tieExpr = QString::fromStdString(
m_compositeFunction->parameterName(iPar)) +
"=" + tieName;
2226 QtBrowserItem *ci =
m_browser->currentItem();
2227 QtProperty *paramProp = ci->property();
2233 h->
fix(paramProp->propertyName());
2240 QtBrowserItem *ci =
m_browser->currentItem();
2241 QtProperty *paramProp = ci->property();
2246 if (paramProp->propertyName() !=
"Tie") {
2247 auto parameterMap = h->
getTies();
2248 auto match = parameterMap.find(paramProp->propertyName());
2249 if (match != parameterMap.end()) {
2250 paramProp = match.value();
2253 if (paramProp->propertyName() ==
"Tie") {
2255 QString qParName = ties.key(paramProp,
"");
2256 std::string parName = qParName.toStdString();
2257 QStringList functionNames;
2259 int ithParameter = -1;
2265 if (ithParameter == -1 && function == h->
function().get())
2268 ithParameter =
static_cast<int>(i);
2275 if (functionNames.empty() && ithParameter < 0) {
2276 QMessageBox::information(
this,
"Mantid - information",
"Cannot find a parameter with this tie");
2278 QString tieExpr = QString::fromStdString(
m_compositeFunction->parameterName(ithParameter));
2279 h->
removeTie(paramProp, tieExpr.toStdString());
2282 h->
removeTie(ci->property()->propertyName());
2297 for (
const auto *sub : subs) {
2298 const auto propName = sub->propertyName();
2299 if (propName ==
"Tie") {
2301 }
else if (propName ==
"Fix") {
2303 }
else if (propName ==
"LowerBound") {
2305 }
else if (propName ==
"UpperBound") {
2317 std::find_if(std::cbegin(subs), std::cend(subs), [](
const auto x) {
return (*x).propertyName() ==
"Tie"; });
2318 sub != std::cend(subs)) {
2345 QtBrowserItem *ci =
m_browser->currentItem();
2346 QtProperty *parProp = ci->property();
2351 double x = parProp->valueText().toDouble();
2352 double loBound =
x * (1 - 0.01 * f);
2353 double upBound =
x * (1 + 0.01 * f);
2409 QtBrowserItem *ci =
m_browser->currentItem();
2410 QtProperty *parProp = ci->property();
2455 if (manager ==
nullptr)
2457 QtProperty *prop = manager->addProperty(
name);
2459 manager->setRange(prop, -DBL_MAX, DBL_MAX);
2470 QString propName =
name.toLower();
2471 if (propName ==
"filename") {
2473 }
else if (propName ==
"formula") {
2490 const std::vector<std::string> &allowed_values)
const {
2491 QStringList qAllowedValues;
2494 for (
const auto &values : allowed_values) {
2495 qAllowedValues << QString::fromStdString(values);
2508 auto *manager =
dynamic_cast<QtStringPropertyManager *
>(prop->propertyManager());
2510 manager->setValue(prop,
value);
2515 const auto *
const manager =
dynamic_cast<QtStringPropertyManager *
>(prop->propertyManager());
2517 return manager->value(prop);
2537 auto const allowedIndices =
2539 auto const firstIndex =
m_allowedSpectra.empty() ? 0 : allowedIndices.front();
2542 auto allowedIndex = currentIndex;
2543 if (currentIndex < firstIndex) {
2544 allowedIndex = firstIndex;
2545 }
else if (currentIndex > lastIndex) {
2546 allowedIndex = lastIndex;
2547 }
else if (!
m_allowedSpectra.empty() && !allowedIndices.contains(currentIndex)) {
2552 if (i >= 0 && i < allowedIndices.size()) {
2553 allowedIndex = allowedIndices[i];
2557 return allowedIndex;
2562 QString fnName = QInputDialog::getText(
this, tr(
"Mantid - Input"), tr(
"Please select a name for the function"),
2563 QLineEdit::Normal,
"", &ok);
2564 if (ok && !fnName.isEmpty()) {
2571 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
2572 QStringList names = settings.childKeys();
2573 if (names.contains(fnName) && QMessageBox::question(
this,
"Mantid - Question",
2574 "Function with this name already exists.\n"
2575 "Would you like to replace it?",
2576 QMessageBox::Yes) != QMessageBox::Yes) {
2579 settings.setValue(fnName, QString::fromStdString(
theFunction()->asString()));
2585 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
2586 QStringList names = settings.childKeys();
2587 if (names.isEmpty()) {
2588 QMessageBox::information(
this,
"Mantid - Information",
"There are no saved functions");
2591 QString
name = QInputDialog::getItem(
this,
"Mantid - Input",
"Please select a function to load", names, 0,
false);
2592 if (!
name.isEmpty()) {
2593 QString str = settings.value(
name).toString();
2600 QString str = QInputDialog::getText(
this,
"Mantid - Input",
"Specify fit function string");
2602 if (!str.isEmpty()) {
2610 bool isAutoBGset =
false;
2626 QClipboard *clipboard = QApplication::clipboard();
2627 clipboard->setText(QString::fromStdString(
theFunction()->asString()));
2631 QClipboard *clipboard = QApplication::clipboard();
2632 QString str = clipboard->text();
2637 QString str = QString::fromStdString(
theFunction()->asString());
2645 if (!wsName.empty()) {
2647 auto ws = Mantid::API::AnalysisDataService::Instance().retrieve(wsName);
2648 auto mws = std::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(ws);
2652 function->setWorkspace(ws);
2662 bool hasPlot =
false;
2678 foreach (
const QString &att, attList) {
2679 QStringList name_value = att.split(
'=');
2680 if (name_value.size() == 2) {
2681 QString
name = name_value[0].trimmed();
2682 QString
value = name_value[1].trimmed();
2715 QStringList nameList = aName.split(
' ');
2716 if (nameList.isEmpty())
2718 QString
name = nameList[0];
2719 std::shared_ptr<Mantid::API::IFunction> f = std::shared_ptr<Mantid::API::IFunction>(
2720 Mantid::API::FunctionFactory::Instance().createFunction(
name.toStdString()));
2723 if (nameList.size() > 1) {
2724 nameList.removeFirst();
2727 Mantid::Kernel::ConfigService::Instance().setString(
"curvefitting.autoBackground", aName.toStdString());
2736 if (!wsName.empty() && dlg->addWorkspaces(QStringList(QString::fromStdString(wsName)))) {
2743 if (wsName.empty()) {
2744 QMessageBox::critical(
this,
"Mantid - Error",
"Workspace name is not set");
2748 std::string peakListName = wsName +
"_PeakList_tmp";
2750 QString::fromStdString(Mantid::Kernel::ConfigService::Instance().getString(
"curvefitting.findPeaksFWHM"));
2751 int FWHM{setting.isEmpty() ? 7 : setting.toInt()};
2754 findPeakStrategy->initialise(wsName,
workspaceIndex(), peakListName, FWHM, &obs);
2756 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
2759 Mantid::API::AnalysisDataService::Instance().retrieve(
workspaceName()));
2762 findPeakStrategy->execute();
2764 for (
size_t i = 0; i < findPeakStrategy->peakNumber(); ++i) {
2765 if (findPeakStrategy->getPeakCentre(i) <
startX() || findPeakStrategy->getPeakCentre(i) >
endX()) {
2773 QApplication::restoreOverrideCursor();
2777 QApplication::restoreOverrideCursor();
2791 settings.beginGroup(
"Mantid/FitBrowser");
2792 m_decimals = settings.value(
"decimals", 6).toInt();
2795 foreach (QtProperty *prop, props) {
2803 settings.beginGroup(
"Mantid/FitBrowser");
2804 settings.setValue(
"decimals",
d);
2840 QStringList ties = dlg->getParameterTies();
2842 if (!ties.isEmpty()) {
2845 Mantid::API::AnalysisDataService::Instance().retrieve(
workspaceName()));
2848 QString fun1Ini = QString::fromStdString(fun->asString());
2849 QString funIni =
"composite=MultiBG;" + fun1Ini +
",Workspace=" + wsName +
",WSParam=(WorkspaceIndex=0);";
2851 for (
size_t i = 1; i < mws->getNumberHistograms(); ++i) {
2852 QString comma = i > 1 ?
"," :
"";
2853 QString fi = comma +
"f" + QString::number(i) +
".";
2854 for (
int j = 0; j < static_cast<int>(fun->nParams()); ++j) {
2855 if (!ties[j].isEmpty()) {
2856 tieStr += fi + QString::fromStdString(fun->parameterName(j)) +
"=" + ties[j];
2859 QString wsParam =
",WSParam=(WorkspaceIndex=" + QString::number(i);
2860 wsParam +=
",StartX=" + QString::number(
startX()) +
",EndX=" + QString::number(
endX()) +
")";
2861 funIni += fun1Ini +
",Workspace=" + wsName + wsParam +
";";
2863 if (!tieStr.isEmpty()) {
2864 funIni +=
"ties=(" + tieStr +
")";
2880 QStringList parNames;
2883 throw std::runtime_error(
"IFunction expected but func function of another type");
2885 for (
size_t i = 0; i < fun0->nParams(); ++i) {
2886 parNames << QString::fromStdString(fun0->parameterName(i));
2892 throw std::runtime_error(
"IFunction expected but func function of another type");
2894 for (
size_t j = 0; j < fun->nParams(); ++j) {
2895 if (parNames.indexOf(QString::fromStdString(fun->parameterName(j))) < 0) {
2902 QApplication::setOverrideCursor(Qt::WaitCursor);
2906 table->addColumn(
"int",
"Index");
2907 foreach (
const QString &par, parNames) {
2908 table->addColumn(
"double", par.toStdString());
2930 Mantid::API::AnalysisDataService::Instance().addOrReplace(
workspaceName() +
"_Param_series", table);
2933 group->setProperty(
"InputWorkspaces", worspaceNames);
2938 QApplication::restoreOverrideCursor();
2960 ws = Mantid::API::AnalysisDataService::Instance().retrieve(
workspaceName());
2977 auto mws = std::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(ws);
2980 auto isHistogram = mws->isHistogramData();
2990 auto tws = std::dynamic_pointer_cast<Mantid::API::ITableWorkspace>(ws);
3002 auto names = tws->getColumnNames();
3003 QStringList columns;
3004 for (
const auto &
name : names) {
3005 columns << QString::fromStdString(
name);
3006 auto col = tws->getColumn(
name);
3007 if (xName.isEmpty() && col->getPlotType() == 1 ) {
3008 xName = QString::fromStdString(
name);
3010 if (yName.isEmpty() && col->getPlotType() == 2 ) {
3011 yName = QString::fromStdString(
name);
3013 if (errName.isEmpty() && col->getPlotType() == 5 ) {
3014 errName = QString::fromStdString(
name);
3020 if (!xName.isEmpty()) {
3023 if (
auto name = std::find_if(std::cbegin(columns), std::cend(columns), [&](
const auto x) {
return x != yName; });
3024 name != std::cend(columns)) {
3028 if (!yName.isEmpty()) {
3031 if (
auto name = std::find_if(std::cbegin(columns), std::cend(columns), [&](
const auto x) {
return x != xName; });
3032 name != std::cend(columns)) {
3036 columns.prepend(
"");
3038 if (!errName.isEmpty()) {
3078 for (
auto &prop : props) {
3079 if (propsToRemove.contains(prop->propertyName())) {
3095 auto ws = Mantid::API::AnalysisDataService::Instance().retrieve(
workspaceName());
3096 auto tws = std::dynamic_pointer_cast<Mantid::API::ITableWorkspace>(ws);
3100 if (i < 0 || i >=
static_cast<int>(tws->rowCount()) || tws->rowCount() == 0)
3102 auto col = tws->getColumn(
static_cast<size_t>(i));
3103 const double startXVal = col->toDouble(0);
3104 const double endXVal = col->toDouble(tws->rowCount() - 1);
3123 auto minzer = Mantid::API::FuncMinimizerFactory::Instance().createMinimizer(this->
minimizer());
3124 const auto &properties = minzer->getProperties();
3125 for (
auto property : properties) {
3126 QString propName = QString::fromStdString((*property).name());
3127 QtProperty *prop =
nullptr;
3146 QString val = QString::fromStdString(prp->value());
3150 m_stringManager->setValue(prop, QString::fromStdString((*property).value()));
3152 QMessageBox::warning(
this,
"Mantid - Error",
3153 "Type of minimizer's property " + propName +
" is not yet supported by the browser.");
3160 QString toolTip = QString::fromStdString((*property).documentation());
3161 if (!toolTip.isEmpty()) {
3162 prop->setToolTip(toolTip);
3174 size_t np = fun->nParams();
3176 for (
size_t i = 0; i < np; ++i) {
3177 const double parValue = fun->getParameter(i);
3178 out.append(parValue);
3188 size_t np = fun->nParams();
3190 for (
size_t i = 0; i < np; ++i) {
3191 std::string parName = fun->parameterName(i);
3192 out.append(QString::fromStdString(parName));
3247 return static_cast<int>(m_functionsGroup->children().size());
3251 auto const name = wsName.toStdString();
3255 indices.reserve(wsSpectra.size());
3256 std::transform(wsSpectra.cbegin(), wsSpectra.cend(), std::back_inserter(indices),
3257 [&ws](
const auto i) { return static_cast<int>(ws->getIndexFromSpectrumNumber(i)); });
3270 throw std::runtime_error(
"Workspace " +
name +
" is not a MatrixWorkspace");
3277 QString qWsName = QString::fromStdString(wsName);
3282 auto const name = wsName.toStdString();
3287 throw std::runtime_error(
"Workspace " +
name +
" is not a TableWorkspace");
3300 return addFunction(fnName.toStdString())->functionPrefix();
3304 const std::unique_ptr<FindPeakStrategyGeneric> &findPeakStrategy) {
3305 bool validFn =
false;
3306 auto f = std::dynamic_pointer_cast<Mantid::API::IPeakFunction>(
3307 Mantid::API::FunctionFactory::Instance().createFunction(
defaultPeakType()));
3311 f->setCentre(findPeakStrategy->getPeakCentre(peakIndex));
3312 f->setFwhm(findPeakStrategy->getPeakWidth(peakIndex));
3313 f->setHeight(findPeakStrategy->getPeakHeight(peakIndex));
3320 if (prefix.isEmpty())
3321 throw std::runtime_error(
"Peak function prefix cannot be empty");
3322 auto const indexList = prefix.split(
".");
3323 auto const n = indexList.size() - 1;
3325 for (
int i = 0; i <
n; ++i) {
3326 auto const index = indexList[i].mid(1).toInt();
3327 handler = handler->getHandler(
index);
3329 return handler->getHandler(indexList[
n].mid(1).toInt());
3334 handler->setCentre(
value);
3335 handler->updateParameters();
3340 return handler->centre();
3345 handler->setHeight(
value);
3346 handler->updateParameters();
3351 return handler->height();
3356 handler->setFwhm(
value);
3357 handler->updateParameters();
3362 return handler->fwhm();
3367 return handler->getWidthParameterName();
3372 return handler->getCentreParameterName();
3377 return handler->isParameterExplicitlySet(param);
3383 const auto nFunctions = parentHandler->cfun()->nFunctions();
3384 for (
size_t i = 0; i < nFunctions; ++i) {
3385 const auto *handler = parentHandler->getHandler(i);
3386 if (handler->pfun()) {
3387 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.