Mantid
Loading...
Searching...
No Matches
IFitScriptGeneratorModel.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2020 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "DllOption.h"
10#include "MantidAPI/IFunction.h"
13
14#include <string>
15#include <tuple>
16#include <vector>
17
18namespace MantidQt {
19namespace MantidWidgets {
20
21class IFitScriptGeneratorPresenter;
22
24
25public:
26 virtual ~IFitScriptGeneratorModel() = default;
27
29
30 virtual void removeDomain(FitDomainIndex domainIndex) = 0;
31 virtual void addWorkspaceDomain(std::string const &workspaceName, WorkspaceIndex workspaceIndex, double startX,
32 double endX) = 0;
33 [[nodiscard]] virtual bool hasWorkspaceDomain(std::string const &workspaceName,
34 WorkspaceIndex workspaceIndex) const = 0;
35
36 virtual void renameWorkspace(std::string const &workspaceName, std::string const &newName) = 0;
37
38 [[nodiscard]] virtual bool updateStartX(std::string const &workspaceName, WorkspaceIndex workspaceIndex,
39 double startX) = 0;
40 [[nodiscard]] virtual bool updateEndX(std::string const &workspaceName, WorkspaceIndex workspaceIndex,
41 double endX) = 0;
42
43 virtual void removeFunction(std::string const &workspaceName, WorkspaceIndex workspaceIndex,
44 std::string const &function) = 0;
45 virtual void addFunction(std::string const &workspaceName, WorkspaceIndex workspaceIndex,
46 std::string const &function) = 0;
47 virtual void setFunction(std::string const &workspaceName, WorkspaceIndex workspaceIndex,
48 std::string const &function) = 0;
49 [[nodiscard]] virtual Mantid::API::IFunction_sptr getFunction(std::string const &workspaceName,
50 WorkspaceIndex workspaceIndex) const = 0;
51
52 [[nodiscard]] virtual std::string getEquivalentFunctionIndexForDomain(std::string const &workspaceName,
53 WorkspaceIndex workspaceIndex,
54 std::string const &functionIndex) const = 0;
55 [[nodiscard]] virtual std::string getEquivalentFunctionIndexForDomain(FitDomainIndex domainIndex,
56 std::string const &functionIndex) const = 0;
57 [[nodiscard]] virtual std::string getEquivalentParameterTieForDomain(std::string const &workspaceName,
58 WorkspaceIndex workspaceIndex,
59 std::string const &fullParameter,
60 std::string const &fullTie) const = 0;
61 [[nodiscard]] virtual std::string getAdjustedFunctionIndex(std::string const &parameter) const = 0;
62 [[nodiscard]] virtual std::string getFullParameter(FitDomainIndex domainIndex,
63 std::string const &parameter) const = 0;
64 [[nodiscard]] virtual std::string getFullTie(FitDomainIndex domainIndex, std::string const &tie) const = 0;
65
66 virtual void updateParameterValue(std::string const &workspaceName, WorkspaceIndex workspaceIndex,
67 std::string const &fullParameter, double newValue) = 0;
68 virtual void updateAttributeValue(std::string const &workspaceName, WorkspaceIndex workspaceIndex,
69 std::string const &fullAttribute,
70 Mantid::API::IFunction::Attribute const &newValue) = 0;
71
72 virtual void updateParameterTie(std::string const &workspaceName, WorkspaceIndex workspaceIndex,
73 std::string const &fullParameter, std::string const &tie) = 0;
74
75 virtual void removeParameterConstraint(std::string const &workspaceName, WorkspaceIndex workspaceIndex,
76 std::string const &fullParameter) = 0;
77 virtual void updateParameterConstraint(std::string const &workspaceName, WorkspaceIndex workspaceIndex,
78 std::string const &functionIndex, std::string const &constraint) = 0;
79
80 virtual void setGlobalParameters(std::vector<std::string> const &parameters) = 0;
81
82 virtual void setOutputBaseName(std::string const &outputBaseName) = 0;
83
84 virtual void setFittingMode(FittingMode fittingMode) = 0;
85 [[nodiscard]] virtual FittingMode getFittingMode() const = 0;
86
87 [[nodiscard]] virtual std::vector<GlobalTie> getGlobalTies() const = 0;
88 [[nodiscard]] virtual std::vector<GlobalParameter> getGlobalParameters() const = 0;
89
90 [[nodiscard]] virtual bool isSimultaneousMode() const = 0;
91
92 [[nodiscard]] virtual bool hasParameter(FitDomainIndex domainIndex, std::string const &fullParameter) const = 0;
93
94 virtual void setParameterValue(FitDomainIndex domainIndex, std::string const &fullParameter, double value) = 0;
95 virtual void setParameterFixed(FitDomainIndex domainIndex, std::string const &fullParameter, bool fix) = 0;
96 virtual void setParameterTie(FitDomainIndex domainIndex, std::string const &fullParameter,
97 std::string const &tie) = 0;
98 virtual void setParameterConstraint(FitDomainIndex domainIndex, std::string const &fullParameter,
99 std::string const &constraint) = 0;
100
101 [[nodiscard]] virtual std::string getDomainName(FitDomainIndex domainIndex) const = 0;
102 [[nodiscard]] virtual double getParameterValue(FitDomainIndex domainIndex,
103 std::string const &fullParameter) const = 0;
104 [[nodiscard]] virtual bool isParameterFixed(FitDomainIndex domainIndex, std::string const &fullParameter) const = 0;
105 [[nodiscard]] virtual std::string getParameterTie(FitDomainIndex domainIndex,
106 std::string const &fullParameter) const = 0;
107 [[nodiscard]] virtual std::string getParameterConstraint(FitDomainIndex domainIndex,
108 std::string const &fullParameter) const = 0;
109
110 [[nodiscard]] virtual std::size_t numberOfDomains() const = 0;
111
112 [[nodiscard]] virtual std::tuple<bool, std::string> isValid() const = 0;
113
114 virtual std::string generatePythonFitScript(
115 std::tuple<std::string, std::string, std::string, std::string, std::string, bool> const &fitOptions,
116 std::string const &filepath = "") = 0;
117};
118
119} // namespace MantidWidgets
120} // namespace MantidQt
#define EXPORT_OPT_MANTIDQT_COMMON
Definition: DllOption.h:15
double value
The value of the point.
Definition: FitMW.cpp:51
virtual FittingMode getFittingMode() const =0
virtual void removeFunction(std::string const &workspaceName, WorkspaceIndex workspaceIndex, std::string const &function)=0
virtual void updateParameterTie(std::string const &workspaceName, WorkspaceIndex workspaceIndex, std::string const &fullParameter, std::string const &tie)=0
virtual void addFunction(std::string const &workspaceName, WorkspaceIndex workspaceIndex, std::string const &function)=0
virtual void updateAttributeValue(std::string const &workspaceName, WorkspaceIndex workspaceIndex, std::string const &fullAttribute, Mantid::API::IFunction::Attribute const &newValue)=0
virtual void setParameterTie(FitDomainIndex domainIndex, std::string const &fullParameter, std::string const &tie)=0
virtual bool hasWorkspaceDomain(std::string const &workspaceName, WorkspaceIndex workspaceIndex) const =0
virtual std::vector< GlobalParameter > getGlobalParameters() const =0
virtual std::string getEquivalentFunctionIndexForDomain(FitDomainIndex domainIndex, std::string const &functionIndex) const =0
virtual bool updateStartX(std::string const &workspaceName, WorkspaceIndex workspaceIndex, double startX)=0
virtual void removeParameterConstraint(std::string const &workspaceName, WorkspaceIndex workspaceIndex, std::string const &fullParameter)=0
virtual void updateParameterConstraint(std::string const &workspaceName, WorkspaceIndex workspaceIndex, std::string const &functionIndex, std::string const &constraint)=0
virtual void addWorkspaceDomain(std::string const &workspaceName, WorkspaceIndex workspaceIndex, double startX, double endX)=0
virtual std::string getEquivalentFunctionIndexForDomain(std::string const &workspaceName, WorkspaceIndex workspaceIndex, std::string const &functionIndex) const =0
virtual std::string getParameterConstraint(FitDomainIndex domainIndex, std::string const &fullParameter) const =0
virtual std::string getEquivalentParameterTieForDomain(std::string const &workspaceName, WorkspaceIndex workspaceIndex, std::string const &fullParameter, std::string const &fullTie) const =0
virtual void setFittingMode(FittingMode fittingMode)=0
virtual void subscribePresenter(IFitScriptGeneratorPresenter *presenter)=0
virtual std::vector< GlobalTie > getGlobalTies() const =0
virtual std::string generatePythonFitScript(std::tuple< std::string, std::string, std::string, std::string, std::string, bool > const &fitOptions, std::string const &filepath="")=0
virtual std::size_t numberOfDomains() const =0
virtual bool hasParameter(FitDomainIndex domainIndex, std::string const &fullParameter) const =0
virtual std::string getParameterTie(FitDomainIndex domainIndex, std::string const &fullParameter) const =0
virtual std::string getFullParameter(FitDomainIndex domainIndex, std::string const &parameter) const =0
virtual void renameWorkspace(std::string const &workspaceName, std::string const &newName)=0
virtual void updateParameterValue(std::string const &workspaceName, WorkspaceIndex workspaceIndex, std::string const &fullParameter, double newValue)=0
virtual std::string getAdjustedFunctionIndex(std::string const &parameter) const =0
virtual void removeDomain(FitDomainIndex domainIndex)=0
virtual std::tuple< bool, std::string > isValid() const =0
virtual std::string getDomainName(FitDomainIndex domainIndex) const =0
virtual void setGlobalParameters(std::vector< std::string > const &parameters)=0
virtual void setOutputBaseName(std::string const &outputBaseName)=0
virtual bool updateEndX(std::string const &workspaceName, WorkspaceIndex workspaceIndex, double endX)=0
virtual Mantid::API::IFunction_sptr getFunction(std::string const &workspaceName, WorkspaceIndex workspaceIndex) const =0
virtual void setParameterFixed(FitDomainIndex domainIndex, std::string const &fullParameter, bool fix)=0
virtual void setParameterConstraint(FitDomainIndex domainIndex, std::string const &fullParameter, std::string const &constraint)=0
virtual void setParameterValue(FitDomainIndex domainIndex, std::string const &fullParameter, double value)=0
virtual void setFunction(std::string const &workspaceName, WorkspaceIndex workspaceIndex, std::string const &function)=0
virtual double getParameterValue(FitDomainIndex domainIndex, std::string const &fullParameter) const =0
virtual std::string getFullTie(FitDomainIndex domainIndex, std::string const &tie) const =0
virtual bool isParameterFixed(FitDomainIndex domainIndex, std::string const &fullParameter) const =0
Attribute is a non-fitting parameter.
Definition: IFunction.h:282
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
Definition: IFunction.h:732
A struct to impliment strongly typed integers, without implicit conversion.
Definition: IndexTypes.h:24