9#include <boost/algorithm/string/replace.hpp>
10#include <boost/lexical_cast.hpp>
45using namespace Kernel;
56 "A list of sources of data to fit. \n"
57 "Sources can be either workspace names or file names followed optionally "
58 "by a list of spectra/workspace-indices \n"
59 "or values using the notation described in the description section of "
62 declareProperty(
"Spectrum", 1,
63 "Set a spectrum to fit. \n"
64 "However, if spectra lists (or workspace-indices/values "
65 "lists) are specified in the Input parameter string these "
67 declareProperty(
"WorkspaceIndex", 0,
68 "Set a workspace-index to fit (alternative option to Spectrum). "
69 "However, if spectra lists (or workspace-indices/values lists) are "
70 "specified in the Input parameter string, \n"
71 "or the Spectrum parameter integer, these take precedence.");
73 "The output TableWorkspace");
74 declareProperty(std::make_unique<API::FunctionProperty>(
"Function",
Direction::InOut),
75 "Parameters defining the fitting function and its initial values");
76 declareProperty(
"LogValue",
"",
77 "Name of the log value to plot the "
78 "parameters against. Default: use spectra "
80 declareProperty(std::make_unique<
ArrayProperty<double>>(
"StartX"),
"A value of x in, or on the low x "
81 "boundary of, the first bin to "
83 "the fit (default lowest value of x)");
84 declareProperty(std::make_unique<
ArrayProperty<double>>(
"EndX"),
"A value in, or on the high x boundary "
85 "of, the last bin the fitting range\n"
86 "(default the highest value of x)");
88 std::vector<std::string> fitOptions{
"Sequential",
"Individual"};
89 declareProperty(
"FitType",
"Sequential", std::make_shared<StringListValidator>(fitOptions),
90 "Defines the way of setting initial values. \n"
91 "If set to 'Sequential' every next fit starts with "
92 "parameters returned by the previous fit. \n"
93 "If set to 'Individual' each fit starts with the same "
94 "initial values defined in the Function property.");
96 declareProperty(
"PassWSIndexToFunction",
false,
97 "For each spectrum in Input pass its workspace index to all "
99 "have attribute WorkspaceIndex.");
101 declareProperty(
"Minimizer",
"Levenberg-Marquardt",
102 "Minimizer to use for fitting. Minimizers available are "
103 "'Levenberg-Marquardt', 'Simplex', 'FABADA',\n"
104 "'Conjugate gradient (Fletcher-Reeves imp.)', 'Conjugate "
105 "gradient (Polak-Ribiere imp.)' and 'BFGS'");
107 std::vector<std::string> costFuncOptions = CostFunctionFactory::Instance().getKeys();
108 declareProperty(
"CostFunction",
"Least squares", std::make_shared<StringListValidator>(costFuncOptions),
109 "Cost functions to use for fitting. Cost functions available "
110 "are 'Least squares' and 'Ignore positive peaks'",
113 declareProperty(
"MaxIterations", 500,
114 "Stop after this number of iterations if a good fit is not "
116 declareProperty(
"PeakRadius", 0,
117 "A value of the peak radius the peak functions should use. A "
118 "peak radius defines an interval on the x axis around the "
119 "centre of the peak where its values are calculated. Values "
120 "outside the interval are not calculated and assumed zeros."
121 "Numerically the radius is a whole number of peak widths "
122 "(FWHM) that fit into the interval on each side from the "
123 "centre. The default value of 0 means the whole x axis.");
125 declareProperty(
"CreateOutput",
false,
126 "Set to true to create output "
127 "workspaces with the results of the "
128 "fit(default is false).");
130 declareProperty(
"OutputCompositeMembers",
false,
131 "If true and CreateOutput is true then the value of each "
132 "member of a Composite Function is also output.");
134 declareProperty(
"AppendIdxToOutputName",
false,
135 "If true and CreateOutput is true then append either spectrum index, workspace index, or numeric "
136 "axis value depending on the input format.");
140 "If true and CreateOutput is true then create a new output of the result table in workspace 2D format.");
143 "If true and OutputCompositeMembers is true members of any "
144 "Convolution are output convolved\n"
145 "with corresponding resolution");
147 std::array<std::string, 2> evaluationTypes = {{
"CentrePoint",
"Histogram"}};
148 declareProperty(
"EvaluationType",
"CentrePoint",
153 "A list of pairs of real numbers, defining the regions to "
154 "exclude from the fit for all spectra.");
157 "A list of Exclusion ranges, defining the regions to "
158 "exclude from the fit for each spectra. Must have the "
159 "same number of sets as the number of the spectra.");
161 declareProperty(
"IgnoreInvalidData",
false,
"Flag to ignore infinities, NaNs and data with zero errors.");
163 declareProperty(
"OutputFitStatus",
false,
164 "Flag to output fit status information which consists of the fit "
165 "OutputStatus and the OutputChiSquared");
168std::map<std::string, std::string> PlotPeakByLogValue::validateInputs() {
169 std::map<std::string, std::string> errors;
173 const std::vector<InputSpectraToFit> wsNames =
makeNames(inputList, default_wi, default_spec);
174 for (
const auto &wsName : wsNames) {
175 if (wsName.wsIdx == -1 && wsName.spectrumNum == -1 && wsName.numericValue == -1) {
176 errors[
"InvalidRange"] =
"Range is out of bounds. Please make sure the selected range is within the boundaries.";
179 std::vector<std::string> excludeList =
getProperty(
"ExcludeMultiple");
180 if (!excludeList.empty() && excludeList.size() != wsNames.size()) {
181 errors[
"ExcludeMultiple"] =
"ExcludeMultiple must be the same size has the number of spectra.";
189void PlotPeakByLogValue::exec() {
195 const std::vector<InputSpectraToFit> wsNames =
makeNames(inputList, default_wi, default_spec);
199 bool passWSIndexToFunction =
getProperty(
"PassWSIndexToFunction");
200 bool createFitOutput =
getProperty(
"CreateOutput");
201 bool appendIdxToOutput =
getProperty(
"AppendIdxToOutputName");
203 bool outputCompositeMembers =
getProperty(
"OutputCompositeMembers");
204 bool outputConvolvedMembers =
getProperty(
"ConvolveMembers");
205 bool outputFitStatus =
getProperty(
"OutputFitStatus");
207 std::vector<double> startX =
getProperty(
"StartX");
209 std::vector<std::string> exclude =
getExclude(wsNames.size());
211 bool isDataName =
false;
216 if (!inputFunction) {
217 throw std::invalid_argument(
"Fitting function failed to initialize");
219 bool isMultiDomainFunction = std::dynamic_pointer_cast<MultiDomainFunction>(inputFunction) !=
nullptr;
221 IFunction_sptr ifunSingle = isMultiDomainFunction ? inputFunction->getFunction(0) : inputFunction;
224 std::vector<double> initialParams(ifunSingle->nParams());
226 for (
size_t i = 0; i < initialParams.size(); ++i) {
227 initialParams[i] = ifunSingle->getParameter(i);
232 std::vector<std::string> fitNames;
233 std::vector<std::string> parameterNames;
234 std::vector<std::string> covarianceNames;
235 std::vector<MatrixWorkspace_sptr> fitWorkspaces;
236 std::vector<ITableWorkspace_sptr> parameterWorkspaces;
237 std::vector<ITableWorkspace_sptr> covarianceWorkspaces;
239 std::vector<std::string> fitStatus;
240 std::vector<double> fitChiSquared;
241 if (outputFitStatus) {
244 fitStatus.reserve(wsNames.size());
245 fitChiSquared.reserve(wsNames.size());
248 double dProg = 1. /
static_cast<double>(wsNames.size());
250 for (
int i = 0; i < static_cast<int>(wsNames.size()); ++i) {
258 if (data.
wsIdx < 0) {
259 g_log.
warning() <<
"Zero spectra selected for fitting in workspace " << wsNames[i].name <<
'\n';
264 setupFunction(individual, passWSIndexToFunction, inputFunction, initialParams, isMultiDomainFunction, i, data);
265 std::shared_ptr<Algorithm> fit;
266 if (startX.size() == 0) {
267 fit =
runSingleFit(createFitOutput, outputCompositeMembers, outputConvolvedMembers, appendIdxToOutput, ifun, data,
269 }
else if (startX.size() == 1) {
270 fit =
runSingleFit(createFitOutput, outputCompositeMembers, outputConvolvedMembers, appendIdxToOutput, ifun, data,
271 startX[0], endX[0], exclude[i]);
273 fit =
runSingleFit(createFitOutput, outputCompositeMembers, outputConvolvedMembers, appendIdxToOutput, ifun, data,
274 startX[i], endX[i], exclude[i]);
277 ifun = fit->getProperty(
"Function");
278 double chi2 = fit->getProperty(
"OutputChi2overDoF");
280 if (createFitOutput) {
281 if (appendIdxToOutput) {
282 fitNames.emplace_back(fit->getPropertyValue(
"OutputWorkspace"));
283 parameterNames.emplace_back(fit->getPropertyValue(
"OutputParameters"));
284 covarianceNames.emplace_back(fit->getPropertyValue(
"OutputNormalisedCovarianceMatrix"));
286 fitWorkspaces.emplace_back(fit->getProperty(
"OutputWorkspace"));
287 parameterWorkspaces.emplace_back(fit->getProperty(
"OutputParameters"));
288 covarianceWorkspaces.emplace_back(fit->getProperty(
"OutputNormalisedCovarianceMatrix"));
291 if (outputFitStatus) {
292 fitStatus.push_back(fit->getProperty(
"OutputStatus"));
293 fitChiSquared.push_back(chi2);
296 g_log.
debug() <<
"Fit result " << fit->getPropertyValue(
"OutputStatus") <<
' ' << chi2 <<
'\n';
305 progress(Prog, (
"Fitting Workspace: (" + current +
") - "));
309 if (outputFitStatus) {
314 if (createFitOutput) {
319 if (appendIdxToOutput) {
329void PlotPeakByLogValue::groupResParams(
const std::vector<ITableWorkspace_sptr> ¶msWs,
330 const std::vector<std::string> ¶msNames) {
331 std::vector<ITableWorkspace_sptr> params;
333 if (paramsWs.size() > 0) {
335 }
else if (paramsNames.size() > 0) {
336 std::transform(paramsNames.cbegin(), paramsNames.cend(), std::back_inserter(params),
337 [](std::string
name) { return AnalysisDataService::Instance().retrieveWS<ITableWorkspace>(name); });
342 std::map<std::string, std::vector<double>> parameterValues;
343 std::map<std::string, std::vector<double>> parameterErrors;
345 for (
size_t i = 0; i < params.size(); ++i) {
346 for (
size_t rowNo = 0; rowNo < params[i]->rowCount(); ++rowNo) {
347 TableRow row = params[i]->getRow(rowNo);
349 auto paramName = row.
String(0);
353 parameterValues[paramName].push_back(
value);
354 parameterErrors[paramName].push_back(
error);
358 if (!parameterValues.empty()) {
359 size_t numParams = parameterValues.size();
360 size_t numDataPoints = parameterValues.begin()->second.size();
365 auto textAxis = std::make_unique<Mantid::API::TextAxis>(numParams);
367 size_t spectrumIndex = 0;
368 for (
const auto ¶mPair : parameterValues) {
369 const std::string ¶mName = paramPair.first;
370 const std::vector<double> &values = paramPair.second;
371 const std::vector<double> &errors = parameterErrors[paramName];
373 auto &xData = matrixWs->mutableX(spectrumIndex);
374 for (
size_t i = 0; i < numDataPoints; ++i) {
375 xData[i] =
static_cast<double>(i);
378 auto &yData = matrixWs->mutableY(spectrumIndex);
379 std::copy(values.begin(), values.end(), yData.begin());
381 auto &eData = matrixWs->mutableE(spectrumIndex);
382 std::copy(errors.begin(), errors.end(), eData.begin());
384 textAxis->setLabel(spectrumIndex, paramName);
389 matrixWs->replaceAxis(1, std::move(textAxis));
390 matrixWs->setTitle(
"Grouped Parameter Results");
391 matrixWs->getAxis(0)->setUnit(
"Empty");
392 matrixWs->setYUnitLabel(
"Parameter Value");
394 std::string outputWsName = this->
m_baseName +
"_ws";
395 Mantid::API::AnalysisDataService::Instance().addOrReplace(outputWsName, matrixWs);
399IFunction_sptr PlotPeakByLogValue::setupFunction(
bool individual,
bool passWSIndexToFunction,
401 const std::vector<double> &initialParams,
bool isMultiDomainFunction,
404 if (isMultiDomainFunction) {
405 ifun = inputFunction->getFunction(i);
406 if (!individual && i != 0) {
408 for (
size_t k = 0; k < ifun->nParams(); ++k) {
409 ifun->setParameter(k, prevFunction->getParameter(k));
414 ifun = inputFunction;
416 if (passWSIndexToFunction) {
420 if (individual && !isMultiDomainFunction) {
421 for (
size_t k = 0; k < initialParams.size(); ++k) {
422 ifun->setParameter(k, initialParams[k]);
428void PlotPeakByLogValue::finaliseOutputWorkspaces(
const std::vector<MatrixWorkspace_sptr> &fitWorkspaces,
429 const std::vector<ITableWorkspace_sptr> ¶msWorkspaces,
430 const std::vector<ITableWorkspace_sptr> &covarianceWorkspaces) {
434 for (
auto const &
workspace : covarianceWorkspaces)
435 covarianceGroup->addWorkspace(
workspace);
436 AnalysisDataService::Instance().addOrReplace(this->
m_baseName +
"_NormalisedCovarianceMatrices", covarianceGroup);
439 for (
auto const &
workspace : paramsWorkspaces)
441 AnalysisDataService::Instance().addOrReplace(this->
m_baseName +
"_Parameters", parameterGroup);
444 for (
auto const &
workspace : fitWorkspaces)
446 AnalysisDataService::Instance().addOrReplace(this->
m_baseName +
"_Workspaces", fitGroup);
449 const std::string paramName = minimizerWorkspace.first;
451 groupAlg->initialize();
452 groupAlg->setProperty(
"InputWorkspaces", minimizerWorkspace.second);
453 groupAlg->setProperty(
"OutputWorkspace", this->
m_baseName +
"_" + paramName);
458void PlotPeakByLogValue::finaliseOutputWorkspacesWithAppend(
const std::vector<std::string> &fitNames,
459 const std::vector<std::string> ¶msNames,
460 const std::vector<std::string> &covarianceNames,
461 const std::vector<InputSpectraToFit> &wsNames) {
465 auto start = wsNames[0];
466 auto end = wsNames[wsNames.size() - 1];
467 if (start.spectrumNum != -1) {
468 range = wsNames.size() > 1 && start.spectrumNum != end.spectrumNum
469 ? std::format(
"sp{:g}-{:g}", start.spectrumNum, end.spectrumNum)
470 : std::format(
"sp{:g}", start.spectrumNum);
471 }
else if (start.numericValue != -1) {
472 range = wsNames.size() > 1 && start.numericValue != end.numericValue
473 ? std::format(
"v{:g}-{:g}", start.numericValue, end.numericValue)
474 : std::format(
"v{:g}", start.numericValue);
476 range = wsNames.size() > 1 && start.wsIdx != end.wsIdx ? std::format(
"i{}-{}", start.wsIdx, end.wsIdx)
482 std::vector<std::pair<std::vector<std::string>, std::string>> groupingOperations = {
483 {covarianceNames, std::format(
"{}_{}_NormalisedCovarianceMatrices",
m_baseName, range)},
484 {paramsNames, std::format(
"{}_{}_Parameters",
m_baseName, range)},
485 {fitNames, std::format(
"{}_{}_Workspaces",
m_baseName, range)}};
487 for (
const auto &[inputWorkspaces, outputName] : groupingOperations) {
488 groupAlg->initialize();
489 groupAlg->setProperty(
"InputWorkspaces", inputWorkspaces);
490 groupAlg->setProperty(
"OutputWorkspace", outputName);
491 groupAlg->setAlwaysStoreInADS(
true);
496void PlotPeakByLogValue::finaliseMinimizerOutput() {
498 const std::string paramName = minimizerWorkspace.first;
500 groupAlg->initialize();
501 groupAlg->setProperty(
"InputWorkspaces", minimizerWorkspace.second);
502 groupAlg->setProperty(
"OutputWorkspace", this->
m_baseName +
"_" + paramName);
507void PlotPeakByLogValue::appendTableRow(
509 double logValue,
double chi2)
const {
517 auto p = std::dynamic_pointer_cast<API::CompositeFunction>(ifun);
519 for (
size_t i = 0; i < p->nFunctions(); ++i) {
520 auto f = ifun->getFunction(i);
521 for (
size_t j = 0; j < f->nParams(); ++j) {
522 row << p->getParameter(i, j) << p->getError(i, j);
526 auto intensity_handle = std::dynamic_pointer_cast<API::IPeakFunction>(f);
527 if (intensity_handle) {
528 row << intensity_handle->intensity() << intensity_handle->intensityError();
534 for (
size_t iPar = 0; iPar < ifun->nParams(); ++iPar) {
535 row << ifun->getParameter(iPar) << ifun->getError(iPar);
539 auto intensity_handle = std::dynamic_pointer_cast<API::IPeakFunction>(ifun);
540 if (intensity_handle) {
541 row << intensity_handle->intensity() << intensity_handle->intensityError();
551 if (logName ==
"SourceName") {
552 result->addColumn(
"str",
"SourceName");
554 }
else if (logName.empty()) {
555 auto col = result->addColumn(
"double",
"axis-1");
558 auto col = result->addColumn(
"double", logName);
562 auto p = std::dynamic_pointer_cast<API::CompositeFunction>(ifunSingle);
564 for (
size_t i = 0; i < p->nFunctions(); ++i) {
565 auto f = ifunSingle->getFunction(i);
566 for (
size_t j = 0; j < f->nParams(); ++j) {
567 result->addColumn(
"double", p->parameterName(i, j));
568 result->addColumn(
"double", p->parameterName(i, j) +
"_Err");
571 auto intensity_handle = std::dynamic_pointer_cast<API::IPeakFunction>(f);
572 if (intensity_handle) {
573 result->addColumn(
"double",
"f" +
std::to_string(i) +
".Integrated Intensity");
574 result->addColumn(
"double",
"f" +
std::to_string(i) +
".Integrated Intensity_Err");
580 for (
size_t iPar = 0; iPar < ifunSingle->nParams(); ++iPar) {
581 result->addColumn(
"double", ifunSingle->parameterName(iPar));
582 result->addColumn(
"double", ifunSingle->parameterName(iPar) +
"_Err");
585 auto intensity_handle = std::dynamic_pointer_cast<API::IPeakFunction>(ifunSingle);
586 if (intensity_handle) {
587 result->addColumn(
"double",
"Integrated Intensity");
588 result->addColumn(
"double",
"Integrated Intensity_Err");
592 result->addColumn(
"double",
"Chi_squared");
598std::shared_ptr<Algorithm> PlotPeakByLogValue::runSingleFit(
bool createFitOutput,
bool outputCompositeMembers,
599 bool outputConvolvedMembers,
bool appendIdx,
601 double startX,
double endX,
const std::string &exclude) {
602 g_log.
debug() <<
"Fitting " << data.
ws->getName() <<
" index " << data.
wsIdx <<
" with \n";
605 std::string wsBaseName;
607 if (createFitOutput) {
608 wsBaseName = data.
name;
611 wsBaseName +=
"_" + std::format(
"sp{:g}", data.
spectrumNum);
613 wsBaseName +=
"_" + std::format(
"v{:g}", data.
numericValue);
620 bool histogramFit = this->
getPropertyValue(
"EvaluationType") ==
"Histogram";
621 bool ignoreInvalidData = this->
getProperty(
"IgnoreInvalidData");
626 fit->setPropertyValue(
"EvaluationType", this->
getPropertyValue(
"EvaluationType"));
627 fit->setProperty(
"Function", ifun);
628 fit->setProperty(
"InputWorkspace", data.
ws);
629 fit->setProperty(
"WorkspaceIndex", data.
wsIdx);
630 fit->setProperty(
"StartX", startX);
631 fit->setProperty(
"EndX", endX);
632 fit->setProperty(
"IgnoreInvalidData", ignoreInvalidData);
634 fit->setPropertyValue(
"CostFunction", this->
getPropertyValue(
"CostFunction"));
635 fit->setPropertyValue(
"MaxIterations", this->
getPropertyValue(
"MaxIterations"));
637 fit->setProperty(
"CalcErrors",
true);
638 fit->setProperty(
"CreateOutput", createFitOutput);
639 fit->setAlwaysStoreInADS(createFitOutput && appendIdx);
641 fit->setProperty(
"OutputCompositeMembers", outputCompositeMembers);
642 fit->setProperty(
"ConvolveMembers", outputConvolvedMembers);
643 fit->setProperty(
"Exclude", exclude);
645 fit->setProperty(
"Output", wsBaseName);
646 fit->setRethrows(
true);
651double PlotPeakByLogValue::calculateLogValue(
const std::string &logName,
const InputSpectraToFit &data) {
653 if (logName.empty() || logName ==
"axis-1") {
656 double lowerEdge((*axis)(data.
wsIdx));
657 double upperEdge((*axis)(data.
wsIdx + 1));
658 logValue = lowerEdge + (upperEdge - lowerEdge) / 2;
660 logValue = (*axis)(data.
wsIdx);
661 }
else if (logName !=
"SourceName") {
664 throw std::invalid_argument(
"Log value " + logName +
" does not exist");
668 throw std::runtime_error(
"Failed to cast " + logName +
" to TimeSeriesProperty");
670 logValue = logp->lastValue();
675void PlotPeakByLogValue::setWorkspaceIndexAttribute(
const IFunction_sptr &fun,
int wsIndex)
const {
676 const std::string attName =
"WorkspaceIndex";
677 if (fun->hasAttribute(attName)) {
678 fun->setAttributeValue(attName, wsIndex);
683 for (
size_t i = 0; i < cf->nFunctions(); ++i) {
689std::string PlotPeakByLogValue::getMinimizerString(
const std::string &wsName,
const std::string &wsIndex) {
691 std::string wsBaseName = wsName +
"_" + wsIndex;
692 boost::replace_all(format,
"$wsname", wsName);
693 boost::replace_all(format,
"$wsindex", wsIndex);
694 boost::replace_all(format,
"$basename", wsBaseName);
695 boost::replace_all(format,
"$outputname",
m_baseName);
697 auto minimizer = FuncMinimizerFactory::Instance().createMinimizer(format);
698 auto minimizerProps = minimizer->getProperties();
699 for (
auto &minimizerProp : minimizerProps) {
702 const std::string &wsPropValue = minimizerProp->
value();
703 if (!wsPropValue.empty()) {
704 const std::string &wsPropName = minimizerProp->name();
713std::vector<std::string> PlotPeakByLogValue::getExclude(
const size_t numSpectra) {
714 std::vector<std::string> excludeList =
getProperty(
"ExcludeMultiple");
715 if (excludeList.empty()) {
717 std::vector<std::string> excludeVector(numSpectra, exclude);
718 return excludeVector;
#define DECLARE_ALGORITHM(classname)
double value
The value of the point.
IPeaksWorkspace_sptr workspace
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
virtual std::shared_ptr< Algorithm > createChildAlgorithm(const std::string &name, const double startProgress=-1., const double endProgress=-1., const bool enableLogging=true, const int &version=-1)
Create a Child Algorithm.
void progress(double p, const std::string &msg="", double estimatedTime=0.0, int progressPrecision=0)
Sends ProgressNotification.
void interruption_point()
This is called during long-running operations, and check if the algorithm has requested that it be ca...
Class to represent the axis of a workspace.
Stores numeric values that are assumed to be bin edge values.
TableRow represents a row in a TableWorkspace.
std::string & String(size_t col)
Returns a reference to the element in position col if its type is std::string.
double & Double(size_t col)
Returns a reference to the element in position col if its type is double.
A property class for workspaces.
std::string value() const override
Get the name of the workspace.
Takes a workspace group and fits the same spectrum in all workspaces with the same function.
std::shared_ptr< Algorithm > runSingleFit(bool createFitOutput, bool outputCompositeMembers, bool outputConvolvedMembers, bool appendIdx, const API::IFunction_sptr &ifun, const InputSpectraToFit &data, double startX, double endX, const std::string &exclude)
std::map< std::string, std::vector< std::string > > m_minimizerWorkspaces
Record of workspaces output by the minimizer.
void finaliseMinimizerOutput()
void finaliseOutputWorkspaces(const std::vector< API::MatrixWorkspace_sptr > &fitWorkspaces, const std::vector< API::ITableWorkspace_sptr > ¶meterWorkspaces, const std::vector< API::ITableWorkspace_sptr > &covarianceWorkspaces)
API::IFunction_sptr setupFunction(bool individual, bool passWSIndexToFunction, const API::IFunction_sptr &inputFunction, const std::vector< double > &initialParams, bool isMultiDomainFunction, int i, const InputSpectraToFit &data) const
void finaliseOutputWorkspacesWithAppend(const std::vector< std::string > &fitWorkspaces, const std::vector< std::string > ¶meterWorkspaces, const std::vector< std::string > &covarianceWorkspaces, const std::vector< InputSpectraToFit > &wsNames)
std::string m_baseName
Base name of output workspace.
double calculateLogValue(const std::string &logName, const InputSpectraToFit &data)
std::string getMinimizerString(const std::string &wsName, const std::string &wsIndex)
Create a minimizer string based on template string provided.
const std::string name() const override
Structure to identify data for fitting.
API::ITableWorkspace_sptr createResultsTable(const std::string &logName, const API::IFunction_sptr &ifunSingle, bool &isDataName)
void setWorkspaceIndexAttribute(const API::IFunction_sptr &fun, int wsIndex) const
Set any WorkspaceIndex attributes in the fitting function.
void groupResParams(const std::vector< API::ITableWorkspace_sptr > ¶msWs, const std::vector< std::string > ¶msNames)
std::vector< std::string > getExclude(const size_t numSpectra)
Create a vector of linked exclude starts and ends.
void appendTableRow(bool isDataName, API::ITableWorkspace_sptr &result, const API::IFunction_sptr &ifun, const InputSpectraToFit &data, double logValue, double chi2) const
Support for a property that holds an array of values.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
ListValidator is a validator that requires the value of a property to be one of a defined list of pos...
The Logger class is in charge of the publishing messages from the framework through various channels.
void debug(const std::string &msg)
Logs at debug level.
void warning(const std::string &msg)
Logs at warning level.
Validator to check that a property is not left empty.
The concrete, templated class for properties.
Base class for properties.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
A specialised Property class for holding a series of time-value pairs.
std::shared_ptr< WorkspaceGroup > WorkspaceGroup_sptr
shared pointer to Mantid::API::WorkspaceGroup
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
std::shared_ptr< CompositeFunction > CompositeFunction_sptr
shared pointer to the composite function base class
Kernel::Logger g_log("DetermineSpinStateOrder")
MANTID_CURVEFITTING_DLL std::vector< InputSpectraToFit > makeNames(const std::string &inputList, int default_wi, int default_spec)
Create a list of input workspace names.
std::shared_ptr< IValidator > IValidator_sptr
A shared_ptr to an IValidator.
constexpr double EMPTY_DBL() noexcept
Returns what we consider an "empty" double within a property.
std::string to_string(const wide_integer< Bits, Signed > &n)
@ InOut
Both an input & output workspace.
@ Input
An input workspace.
@ Output
An output workspace.