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);
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 for (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) &&
2574 QMessageBox::question(
this,
"Mantid - Question",
2575 "Function with this name already exists.\n"
2576 "Would you like to replace it?",
2577 QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes) {
2580 settings.setValue(fnName, QString::fromStdString(
theFunction()->asString()));
2586 settings.beginGroup(
"Mantid/FitBrowser/SavedFunctions");
2587 QStringList names = settings.childKeys();
2588 if (names.isEmpty()) {
2589 QMessageBox::information(
this,
"Mantid - Information",
"There are no saved functions");
2592 QString
name = QInputDialog::getItem(
this,
"Mantid - Input",
"Please select a function to load", names, 0,
false);
2593 if (!
name.isEmpty()) {
2594 QString str = settings.value(
name).toString();
2601 QString str = QInputDialog::getText(
this,
"Mantid - Input",
"Specify fit function string");
2603 if (!str.isEmpty()) {
2611 bool isAutoBGset =
false;
2627 QClipboard *clipboard = QApplication::clipboard();
2628 clipboard->setText(QString::fromStdString(
theFunction()->asString()));
2632 QClipboard *clipboard = QApplication::clipboard();
2633 QString str = clipboard->text();
2638 QString str = QString::fromStdString(
theFunction()->asString());
2646 if (!wsName.empty()) {
2648 auto ws = Mantid::API::AnalysisDataService::Instance().retrieve(wsName);
2649 auto mws = std::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(ws);
2653 function->setWorkspace(ws);
2663 bool hasPlot =
false;
2679 for (
const QString &att : attList) {
2680 QStringList name_value = att.split(
'=');
2681 if (name_value.size() == 2) {
2682 QString
name = name_value[0].trimmed();
2683 QString
value = name_value[1].trimmed();
2716 QStringList nameList = aName.split(
' ');
2717 if (nameList.isEmpty())
2719 QString
name = nameList[0];
2720 std::shared_ptr<Mantid::API::IFunction> f = std::shared_ptr<Mantid::API::IFunction>(
2721 Mantid::API::FunctionFactory::Instance().createFunction(
name.toStdString()));
2724 if (nameList.size() > 1) {
2725 nameList.removeFirst();
2728 Mantid::Kernel::ConfigService::Instance().setString(
"curvefitting.autoBackground", aName.toStdString());
2737 if (!wsName.empty() && dlg->addWorkspaces(QStringList(QString::fromStdString(wsName)))) {
2744 if (wsName.empty()) {
2745 QMessageBox::critical(
this,
"Mantid - Error",
"Workspace name is not set");
2749 std::string peakListName = wsName +
"_PeakList_tmp";
2751 QString::fromStdString(Mantid::Kernel::ConfigService::Instance().getString(
"curvefitting.findPeaksFWHM"));
2752 int FWHM{setting.isEmpty() ? 7 : setting.toInt()};
2755 findPeakStrategy->initialise(wsName,
workspaceIndex(), peakListName, FWHM, &obs);
2757 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
2760 Mantid::API::AnalysisDataService::Instance().retrieve(
workspaceName()));
2763 findPeakStrategy->execute();
2765 for (
size_t i = 0; i < findPeakStrategy->peakNumber(); ++i) {
2766 if (findPeakStrategy->getPeakCentre(i) <
startX() || findPeakStrategy->getPeakCentre(i) >
endX()) {
2774 QApplication::restoreOverrideCursor();
2778 QApplication::restoreOverrideCursor();
2792 settings.beginGroup(
"Mantid/FitBrowser");
2793 m_decimals = settings.value(
"decimals", 6).toInt();
2796 for (QtProperty *prop : props) {
2804 settings.beginGroup(
"Mantid/FitBrowser");
2805 settings.setValue(
"decimals",
d);
2841 QStringList ties = dlg->getParameterTies();
2843 if (!ties.isEmpty()) {
2846 Mantid::API::AnalysisDataService::Instance().retrieve(
workspaceName()));
2849 QString fun1Ini = QString::fromStdString(fun->asString());
2850 QString funIni =
"composite=MultiBG;" + fun1Ini +
",Workspace=" + wsName +
",WSParam=(WorkspaceIndex=0);";
2852 for (
size_t i = 1; i < mws->getNumberHistograms(); ++i) {
2853 QString comma = i > 1 ?
"," :
"";
2854 QString fi = comma +
"f" + QString::number(i) +
".";
2855 for (
int j = 0; j < static_cast<int>(fun->nParams()); ++j) {
2856 if (!ties[j].isEmpty()) {
2857 tieStr += fi + QString::fromStdString(fun->parameterName(j)) +
"=" + ties[j];
2860 QString wsParam =
",WSParam=(WorkspaceIndex=" + QString::number(i);
2861 wsParam +=
",StartX=" + QString::number(
startX()) +
",EndX=" + QString::number(
endX()) +
")";
2862 funIni += fun1Ini +
",Workspace=" + wsName + wsParam +
";";
2864 if (!tieStr.isEmpty()) {
2865 funIni +=
"ties=(" + tieStr +
")";
2881 QStringList parNames;
2884 throw std::runtime_error(
"IFunction expected but func function of another type");
2886 for (
size_t i = 0; i < fun0->nParams(); ++i) {
2887 parNames << QString::fromStdString(fun0->parameterName(i));
2893 throw std::runtime_error(
"IFunction expected but func function of another type");
2895 for (
size_t j = 0; j < fun->nParams(); ++j) {
2896 if (parNames.indexOf(QString::fromStdString(fun->parameterName(j))) < 0) {
2903 QApplication::setOverrideCursor(Qt::WaitCursor);
2907 table->addColumn(
"int",
"Index");
2908 for (
const QString &par : parNames) {
2909 table->addColumn(
"double", par.toStdString());
2931 Mantid::API::AnalysisDataService::Instance().addOrReplace(
workspaceName() +
"_Param_series", table);
2934 group->setProperty(
"InputWorkspaces", worspaceNames);
2939 QApplication::restoreOverrideCursor();
2961 ws = Mantid::API::AnalysisDataService::Instance().retrieve(
workspaceName());
2978 auto mws = std::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(ws);
2981 auto isHistogram = mws->isHistogramData();
2991 auto tws = std::dynamic_pointer_cast<Mantid::API::ITableWorkspace>(ws);
3003 auto names = tws->getColumnNames();
3004 QStringList columns;
3005 for (
const auto &
name : names) {
3006 columns << QString::fromStdString(
name);
3007 auto col = tws->getColumn(
name);
3008 if (xName.isEmpty() && col->getPlotType() == 1 ) {
3009 xName = QString::fromStdString(
name);
3011 if (yName.isEmpty() && col->getPlotType() == 2 ) {
3012 yName = QString::fromStdString(
name);
3014 if (errName.isEmpty() && col->getPlotType() == 5 ) {
3015 errName = QString::fromStdString(
name);
3021 if (!xName.isEmpty()) {
3024 if (
auto name = std::find_if(std::cbegin(columns), std::cend(columns), [&](
const auto x) {
return x != yName; });
3025 name != std::cend(columns)) {
3029 if (!yName.isEmpty()) {
3032 if (
auto name = std::find_if(std::cbegin(columns), std::cend(columns), [&](
const auto x) {
return x != xName; });
3033 name != std::cend(columns)) {
3037 columns.prepend(
"");
3039 if (!errName.isEmpty()) {
3079 for (
auto &prop : props) {
3080 if (propsToRemove.contains(prop->propertyName())) {
3096 auto ws = Mantid::API::AnalysisDataService::Instance().retrieve(
workspaceName());
3097 auto tws = std::dynamic_pointer_cast<Mantid::API::ITableWorkspace>(ws);
3101 if (i < 0 || i >=
static_cast<int>(tws->rowCount()) || tws->rowCount() == 0)
3103 auto col = tws->getColumn(
static_cast<size_t>(i));
3104 const double startXVal = col->toDouble(0);
3105 const double endXVal = col->toDouble(tws->rowCount() - 1);
3124 auto minzer = Mantid::API::FuncMinimizerFactory::Instance().createMinimizer(this->
minimizer());
3125 const auto &properties = minzer->getProperties();
3126 for (
auto property : properties) {
3127 QString propName = QString::fromStdString((*property).name());
3128 QtProperty *prop =
nullptr;
3147 QString val = QString::fromStdString(prp->value());
3151 m_stringManager->setValue(prop, QString::fromStdString((*property).value()));
3153 QMessageBox::warning(
this,
"Mantid - Error",
3154 "Type of minimizer's property " + propName +
" is not yet supported by the browser.");
3161 QString toolTip = QString::fromStdString((*property).documentation());
3162 if (!toolTip.isEmpty()) {
3163 prop->setToolTip(toolTip);
3175 size_t np = fun->nParams();
3177 for (
size_t i = 0; i < np; ++i) {
3178 const double parValue = fun->getParameter(i);
3179 out.append(parValue);
3189 size_t np = fun->nParams();
3191 for (
size_t i = 0; i < np; ++i) {
3192 std::string parName = fun->parameterName(i);
3193 out.append(QString::fromStdString(parName));
3248 return static_cast<int>(m_functionsGroup->children().size());
3252 auto const name = wsName.toStdString();
3256 indices.reserve(wsSpectra.size());
3257 std::transform(wsSpectra.cbegin(), wsSpectra.cend(), std::back_inserter(indices),
3258 [&ws](
const auto i) { return static_cast<int>(ws->getIndexFromSpectrumNumber(i)); });
3271 throw std::runtime_error(
"Workspace " +
name +
" is not a MatrixWorkspace");
3278 QString qWsName = QString::fromStdString(wsName);
3283 auto const name = wsName.toStdString();
3288 throw std::runtime_error(
"Workspace " +
name +
" is not a TableWorkspace");
3301 return addFunction(fnName.toStdString())->functionPrefix();
3305 const std::unique_ptr<FindPeakStrategyGeneric> &findPeakStrategy) {
3306 bool validFn =
false;
3307 auto f = std::dynamic_pointer_cast<Mantid::API::IPeakFunction>(
3308 Mantid::API::FunctionFactory::Instance().createFunction(
defaultPeakType()));
3312 f->setCentre(findPeakStrategy->getPeakCentre(peakIndex));
3313 f->setFwhm(findPeakStrategy->getPeakWidth(peakIndex));
3314 f->setHeight(findPeakStrategy->getPeakHeight(peakIndex));
3321 if (prefix.isEmpty())
3322 throw std::runtime_error(
"Peak function prefix cannot be empty");
3323 auto const indexList = prefix.split(
".");
3324 auto const n = indexList.size() - 1;
3326 for (
int i = 0; i <
n; ++i) {
3327 auto const index = indexList[i].mid(1).toInt();
3328 handler = handler->getHandler(
index);
3330 return handler->getHandler(indexList[
n].mid(1).toInt());
3335 handler->setCentre(
value);
3336 handler->updateParameters();
3341 return handler->centre();
3346 handler->setHeight(
value);
3347 handler->updateParameters();
3352 return handler->height();
3357 handler->setFwhm(
value);
3358 handler->updateParameters();
3363 return handler->fwhm();
3368 return handler->getWidthParameterName();
3373 return handler->getCentreParameterName();
3378 return handler->isParameterExplicitlySet(param);
3384 const auto nFunctions = parentHandler->cfun()->nFunctions();
3385 for (
size_t i = 0; i < nFunctions; ++i) {
3386 const auto *handler = parentHandler->getHandler(i);
3387 if (handler->pfun()) {
3388 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.