26 QStringList
const &workspaceNames,
double startX,
double endX)
27 : m_warnings(), m_view(view), m_model(model) {
36 [[maybe_unused]] std::string
const &arg2) {
38 case ViewEvent::ADSDeleteEvent:
41 case ViewEvent::ADSClearEvent:
44 case ViewEvent::ADSRenameEvent:
47 case ViewEvent::RemoveDomainClicked:
50 case ViewEvent::AddDomainClicked:
53 case ViewEvent::StartXChanged:
56 case ViewEvent::EndXChanged:
59 case ViewEvent::SelectionChanged:
62 case ViewEvent::FunctionRemoved:
65 case ViewEvent::FunctionAdded:
68 case ViewEvent::FunctionReplaced:
71 case ViewEvent::ParameterChanged:
74 case ViewEvent::AttributeChanged:
77 case ViewEvent::ParameterTieChanged:
80 case ViewEvent::ParameterConstraintRemoved:
83 case ViewEvent::ParameterConstraintChanged:
86 case ViewEvent::EditLocalParameterClicked:
89 case ViewEvent::EditLocalParameterFinished:
92 case ViewEvent::OutputBaseNameChanged:
95 case ViewEvent::GenerateScriptToFileClicked:
98 case ViewEvent::GenerateScriptToClipboardClicked:
102 throw std::runtime_error(
"Failed to notify the FitScriptGeneratorPresenter.");
108 case ViewEvent::GlobalParametersChanged:
112 throw std::runtime_error(
"Failed to notify the FitScriptGeneratorPresenter.");
118 case ViewEvent::FittingModeChanged:
122 throw std::runtime_error(
"Failed to notify the FitScriptGeneratorPresenter.");
132 workspaceRows.erase(std::remove_if(workspaceRows.begin(), workspaceRows.end(), differentWsName), workspaceRows.end());
150 if (!workspaces.empty() && !workspaceIndices.
empty())
209 std::string
const &constraint) {
217 }
catch (std::invalid_argument
const &ex) {
224 std::vector<std::string> workspaceNames, domainNames, ties, constraints;
225 std::vector<double> values;
226 std::vector<bool> fixes;
230 values, fixes, ties, constraints);
237 for (
auto i = 0u; i < values.size(); ++i) {
270 for (
auto const &workspaceName : workspaceNames)
271 addWorkspace(workspaceName.toStdString(), startX, endX);
277 for (
auto const &
workspace : workspaces) {
278 auto const maxIndex =
workspace->getNumberHistograms() - 1u;
279 for (
auto const &workspaceIndex : workspaceIndices) {
280 if (workspaceIndex.value <= maxIndex) {
281 auto const xData =
workspace->x(workspaceIndex.value);
290 auto &ads = AnalysisDataService::Instance();
291 if (ads.doesExist(workspaceName))
307 double startX,
double endX) {
311 }
catch (std::invalid_argument
const &ex) {
317 for (
auto const &
index : domainIndices) {
330 "its workspace, and less than the EndX.");
339 "its workspace, and greater than the StartX.");
344 std::string
const ¶meter,
double newValue) {
345 auto const equivalentParameter =
351 std::string
const &fullAttribute,
357 std::string
const ¶meter, std::string
const &tie) {
359 auto const [equivalentParameter, equivalentTie] =
362 }
catch (std::invalid_argument
const &ex) {
369 std::string
const ¶meter) {
375 std::string
const &functionIndex,
376 std::string
const &constraint) {
377 auto const equivalentFunctionIndex =
383 std::string
const &function) {
388 std::string
const &function) {
393 std::string
const &function) {
404template <
typename GetX,
typename UpdateX>
408 auto const newValue = std::invoke(std::forward<GetX>(getX),
m_view, domainIndex);
413template <
typename UpdateFunction>
415 std::string
const &function) {
424template <
typename UpdateFunction,
typename... Args>
431template <
typename Function,
typename... Args>
437 std::invoke(std::forward<Function>(func),
this, workspaceName, workspaceIndex, arguments...);
445 std::vector<std::string> &workspaceNames,
446 std::vector<std::string> &domainNames,
447 std::vector<double> &values, std::vector<bool> &fixes,
448 std::vector<std::string> &ties,
449 std::vector<std::string> &constraints)
const {
451 std::reverse(domainIndices.begin(), domainIndices.end());
452 for (
auto const domainIndex : domainIndices) {
459 FitDomainIndex domainIndex, std::string
const ¶meter, std::vector<std::string> &workspaceNames,
460 std::vector<std::string> &domainNames, std::vector<double> &values, std::vector<bool> &fixes,
461 std::vector<std::string> &ties, std::vector<std::string> &constraints)
const {
473 std::string
const ¶meter,
double value,
bool fix,
474 std::string
const &tie,
475 std::string
const &constraint) {
488std::vector<FitDomainIndex>
490 auto const doesNotHaveParameter = [&](
FitDomainIndex domainIndex) {
495 domainIndices.erase(std::remove_if(domainIndices.begin(), domainIndices.end(), doesNotHaveParameter),
496 domainIndices.end());
497 std::reverse(domainIndices.begin(), domainIndices.end());
498 return domainIndices;
502 std::string
const &workspaceName,
WorkspaceIndex workspaceIndex, std::string
const ¶meter,
503 std::string
const &tie)
const {
504 auto const equivalentParameter =
507 return {equivalentParameter, equivalentTie};
512 std::stringstream ss;
513 std::copy(
m_warnings.cbegin(),
m_warnings.cend(), std::ostream_iterator<std::string>(ss,
"\n"));
522 if (!message.empty())
526 std::invoke(std::forward<Generator>(func),
this);
531 if (!filepath.empty()) {
539 if (!scriptText.empty()) {
double value
The value of the point.
IPeaksWorkspace_sptr workspace
std::map< DeltaEMode::Type, std::string > index
std::vector< T > const * vec
Attribute is a non-fitting parameter.
Base MatrixWorkspace Abstract Class.
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)