Skip to content

Commit 92d9204

Browse files
committed
Revert group name change to fix unit tests
1 parent b355202 commit 92d9204

File tree

5 files changed

+461
-459
lines changed

5 files changed

+461
-459
lines changed

Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class MANTID_CURVEFITTING_DLL PlotPeakByLogValue final : public API::Algorithm {
8181

8282
void finaliseOutputWorkspaces(bool createFitOutput, const std::vector<std::string> &fitWorkspaces,
8383
const std::vector<std::string> &parameterWorkspaces,
84-
const std::vector<std::string> &covarianceWorkspaces, std::string range);
84+
const std::vector<std::string> &covarianceWorkspaces, const std::string &range);
8585

8686
API::IFunction_sptr setupFunction(bool individual, bool passWSIndexToFunction,
8787
const API::IFunction_sptr &inputFunction, const std::vector<double> &initialParams,

Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValueHelper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ struct InputSpectraToFit {
3636
API::MatrixWorkspace_sptr ws; ///< shared pointer to the workspace
3737
};
3838
/// Get a workspace
39-
MANTID_CURVEFITTING_DLL void appendInputSpectraToList(std::vector<InputSpectraToFit> &nameList,
40-
const std::shared_ptr<API::MatrixWorkspace> &wsMatrix,
39+
MANTID_CURVEFITTING_DLL void appendInputSpectraToList(std::vector<InputSpectraToFit> &nameList, const std::string &name,
40+
const std::shared_ptr<API::MatrixWorkspace> &ws,
4141
int workspaceIndex, int spectrumNumber, double start, double end,
4242
int period, const bool &workspaceOptional);
4343
MANTID_CURVEFITTING_DLL std::optional<API::Workspace_sptr> getWorkspace(const std::string &name, int period);

Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,14 +345,14 @@ IFunction_sptr PlotPeakByLogValue::setupFunction(bool individual, bool passWSInd
345345
void PlotPeakByLogValue::finaliseOutputWorkspaces(bool createFitOutput, const std::vector<std::string> &fitWorkspaces,
346346
const std::vector<std::string> &parameterWorkspaces,
347347
const std::vector<std::string> &covarianceWorkspaces,
348-
std::string range) {
348+
const std::string &range) {
349349
if (createFitOutput) {
350350
// collect output of fit for each spectrum into workspace groups
351351
auto const groupAlg = this->createChildAlgorithm("GroupWorkspaces");
352352
std::vector<std::pair<std::vector<std::string>, std::string>> groupingOperations = {
353-
{covarianceWorkspaces, std::format("{}_{}_NormalisedCovarianceMatrices", m_baseName, range)},
354-
{parameterWorkspaces, std::format("{}_{}_Parameters", m_baseName, range)},
355-
{fitWorkspaces, std::format("{}_{}_Workspaces", m_baseName, range)}};
353+
{covarianceWorkspaces, std::format("{}_NormalisedCovarianceMatrices", m_baseName)},
354+
{parameterWorkspaces, std::format("{}_Parameters", m_baseName)},
355+
{fitWorkspaces, std::format("{}_Workspaces", m_baseName)}};
356356

357357
for (const auto &[inputWorkspaces, outputName] : groupingOperations) {
358358
groupAlg->initialize();

Framework/CurveFitting/src/Algorithms/PlotPeakByLogValueHelper.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ std::vector<InputSpectraToFit> makeNames(const std::string &inputList, int defau
122122
void addMatrixworkspace(std::vector<InputSpectraToFit> &nameList, double start, double end, const std::string &name,
123123
int wi, int spec, int period, const std::optional<API::Workspace_sptr> &workspaceOptional,
124124
const std::shared_ptr<API::MatrixWorkspace> &wsMatrix) {
125-
appendInputSpectraToList(nameList, wsMatrix, wi, spec, start, end, period, workspaceOptional.has_value());
125+
appendInputSpectraToList(nameList, name, wsMatrix, wi, spec, start, end, period, workspaceOptional.has_value());
126126
}
127127
void addGroupWorkspace(std::vector<InputSpectraToFit> &nameList, double start, double end, int wi, int spec, int period,
128128
const std::shared_ptr<API::WorkspaceGroup> &wsg) {
@@ -131,25 +131,28 @@ void addGroupWorkspace(std::vector<InputSpectraToFit> &nameList, double start, d
131131
for (const auto &wsName : wsNames) {
132132
if (auto workspace =
133133
std::dynamic_pointer_cast<API::MatrixWorkspace>(API::AnalysisDataService::Instance().retrieve(wsName))) {
134-
appendInputSpectraToList(nameList, workspace, wi, spec, start, end, period, true);
134+
appendInputSpectraToList(nameList, wsName, workspace, wi, spec, start, end, period, true);
135135
}
136136
}
137137
}
138138

139139
/** Get a workspace identified by an InputSpectraToFit structure.
140+
* @param nameList :: List of spectra to fit
141+
* @param name :: Workspace name
140142
* @param ws :: Workspace to fit required to work out indices
141143
* @param workspaceIndex :: workspace index to use
142144
* @param spectrumNumber :: spectrum number to use
143145
* @param start :: Start of range for value based spectrum range
144146
* @param end :: End of range for value based spectrum range
145-
* @return Vector of workspace indices to fit
147+
* @param period :: Period if the file has several periods
148+
* @param workspaceOptional :: Whether a workspace is present or not
146149
*/
147-
void appendInputSpectraToList(std::vector<InputSpectraToFit> &nameList, const std::shared_ptr<API::MatrixWorkspace> &ws,
148-
int workspaceIndex, int spectrumNumber, double start, double end, int period,
149-
const bool &workspaceOptional) {
150+
void appendInputSpectraToList(std::vector<InputSpectraToFit> &nameList, const std::string &name,
151+
const std::shared_ptr<API::MatrixWorkspace> &ws, int workspaceIndex, int spectrumNumber,
152+
double start, double end, int period, const bool &workspaceOptional) {
150153
auto mws = workspaceOptional ? ws : nullptr;
151154
if (workspaceIndex >= 0) {
152-
nameList.emplace_back(ws->getName(), workspaceIndex, -1, -1, period, mws);
155+
nameList.emplace_back(name, workspaceIndex, -1, -1, period, mws);
153156
return;
154157
}
155158

@@ -159,14 +162,14 @@ void appendInputSpectraToList(std::vector<InputSpectraToFit> &nameList, const st
159162
for (int i = 0; i < axis->length(); ++i) {
160163
auto s = double(axis->spectraNo(i));
161164
if (s >= start && s <= end) {
162-
nameList.emplace_back(ws->getName(), i, s, -1, period, mws);
165+
nameList.emplace_back(name, i, s, -1, period, mws);
163166
}
164167
}
165168
} else {
166169
for (int i = 0; i < axis->length(); ++i) {
167170
int j = axis->spectraNo(i);
168171
if (j == spectrumNumber) {
169-
nameList.emplace_back(ws->getName(), i, j, -1, period, mws);
172+
nameList.emplace_back(name, i, j, -1, period, mws);
170173
break;
171174
}
172175
}
@@ -179,7 +182,7 @@ void appendInputSpectraToList(std::vector<InputSpectraToFit> &nameList, const st
179182
for (int i = 0; i < axis->length(); ++i) {
180183
double s = (*axis)(i);
181184
if (s >= start && s <= end) {
182-
nameList.emplace_back(ws->getName(), i, -1, s, period, mws);
185+
nameList.emplace_back(name, i, -1, s, period, mws);
183186
}
184187
}
185188
}

0 commit comments

Comments
 (0)