Mantid
Loading...
Searching...
No Matches
PolarizationEfficienciesWildes.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2024 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
9#include "MantidAPI/Axis.h"
10#include "MantidAPI/Progress.h"
16#include "MantidKernel/Unit.h"
17#include <cmath>
18
19namespace {
21namespace PropNames {
22auto constexpr INPUT_NON_MAG_WS{"InputNonMagWorkspace"};
23auto constexpr INPUT_MAG_WS{"InputMagWorkspace"};
24auto constexpr FLIPPERS{"Flippers"};
25auto constexpr INPUT_P_EFF_WS{"InputPolarizerEfficiency"};
26auto constexpr INPUT_A_EFF_WS{"InputAnalyserEfficiency"};
27auto constexpr OUTPUT_P_EFF_WS{"OutputPolarizerEfficiency"};
28auto constexpr OUTPUT_F_P_EFF_WS{"OutputFpEfficiency"};
29auto constexpr OUTPUT_F_A_EFF_WS{"OutputFaEfficiency"};
30auto constexpr OUTPUT_A_EFF_WS{"OutputAnalyserEfficiency"};
31auto constexpr OUTPUT_PHI_WS{"OutputPhi"};
32auto constexpr OUTPUT_RHO_WS{"OutputRho"};
33auto constexpr OUTPUT_ALPHA_WS{"OutputAlpha"};
34auto constexpr OUTPUT_TPMO_WS{"OutputTwoPMinusOne"};
35auto constexpr OUTPUT_TAMO_WS{"OutputTwoAMinusOne"};
36auto constexpr INCLUDE_DIAGNOSTICS{"IncludeDiagnosticOutputs"};
37
38auto constexpr OUTPUT_EFF_GROUP{"Efficiency Outputs"};
39auto constexpr OUTPUT_DIAGNOSTIC_GROUP{"Diagnostic Outputs"};
40} // namespace PropNames
41
42auto constexpr INPUT_EFF_WS_ERROR{
43 "If a magnetic workspace group has been provided then input efficiency workspaces should not be provided."};
44auto constexpr INITIAL_CONFIG{"00,01,10,11"};
45auto constexpr MAG_KEY_PREFIX = "mag_";
46
47constexpr auto fnPhi = [](const auto &x) { return ((x[0] - x[1]) * (x[0] - x[2])) / (x[0] * x[3] - x[1] * x[2]); };
48constexpr auto fnFp = [](const auto &x) { return (x[0] - x[1] - x[2] + x[3]) / (2 * (x[0] - x[1])); };
49constexpr auto fnFa = [](const auto &x) { return (x[0] - x[1] - x[2] + x[3]) / (2 * (x[0] - x[2])); };
50constexpr auto fnNumerator = [](const auto &x, const auto &fa) {
51 return (1 - 2 * fa) * x[4] + (2 * fa - 1) * x[6] - x[5] + x[7];
52};
53constexpr auto fnDenominator = [](const auto &x, const auto &fp) {
54 return (1 - 2 * fp) * x[4] + (2 * fp - 1) * x[5] - x[6] + x[7];
55};
56} // namespace
57
58namespace Mantid::Algorithms {
59
60using namespace API;
61using namespace Kernel;
63
64// Register the algorithm in the AlgorithmFactory
65DECLARE_ALGORITHM(PolarizationEfficienciesWildes)
66
67std::string const PolarizationEfficienciesWildes::summary() const {
68 return "Calculates the efficiencies of the polarizer, flippers and the analyser for a two-flipper instrument setup.";
69}
70
73 std::make_unique<WorkspaceProperty<WorkspaceGroup>>(PropNames::INPUT_NON_MAG_WS, "", Direction::Input),
74 "Group workspace containing the transmission measurements for the non-magnetic sample");
75 declareProperty(std::make_unique<WorkspaceProperty<WorkspaceGroup>>(PropNames::INPUT_MAG_WS, "", Direction::Input,
77 "Group workspace containing the transmission measurements for the magnetic sample.");
78 const auto spinValidator = std::make_shared<SpinStateValidator>(std::unordered_set<int>{4});
79 declareProperty(PropNames::FLIPPERS, INITIAL_CONFIG, spinValidator,
80 "Flipper configurations of the input group workspace(s).");
81 declareProperty(std::make_unique<WorkspaceProperty<MatrixWorkspace>>(PropNames::INPUT_P_EFF_WS, "", Direction::Input,
83 "Workspace containing the known wavelength-dependent efficiency for the polarizer.");
84 declareProperty(std::make_unique<WorkspaceProperty<MatrixWorkspace>>(PropNames::INPUT_A_EFF_WS, "", Direction::Input,
86 "Workspace containing the known wavelength-dependent efficiency for the analyser.");
88 std::make_unique<WorkspaceProperty<MatrixWorkspace>>(PropNames::OUTPUT_F_P_EFF_WS, "", Direction::Output),
89 "Output workspace containing the polarizing flipper efficiencies");
91 std::make_unique<WorkspaceProperty<MatrixWorkspace>>(PropNames::OUTPUT_F_A_EFF_WS, "", Direction::Output),
92 "Output workspace containing the analysing flipper efficiencies");
93 declareProperty(std::make_unique<WorkspaceProperty<MatrixWorkspace>>(PropNames::OUTPUT_P_EFF_WS, "",
95 "Output workspace containing the polarizer efficiencies.");
96 declareProperty(std::make_unique<WorkspaceProperty<MatrixWorkspace>>(PropNames::OUTPUT_A_EFF_WS, "",
98 "Output workspace containing the analyser efficiencies.");
99 declareProperty(PropNames::INCLUDE_DIAGNOSTICS, false, "Whether to include additional diagnostic outputs.");
100 declareProperty(std::make_unique<WorkspaceProperty<MatrixWorkspace>>(PropNames::OUTPUT_PHI_WS, "phi",
102 "Output workspace containing the values for Phi.");
103 declareProperty(std::make_unique<WorkspaceProperty<MatrixWorkspace>>(PropNames::OUTPUT_RHO_WS, "rho",
105 "Output workspace containing the values for Rho.");
106 declareProperty(std::make_unique<WorkspaceProperty<MatrixWorkspace>>(PropNames::OUTPUT_ALPHA_WS, "alpha",
108 "Output workspace containing the values for Alpha.");
109 declareProperty(std::make_unique<WorkspaceProperty<MatrixWorkspace>>(PropNames::OUTPUT_TPMO_WS, "two_p_minus_one",
111 "Output workspace containing the values for the term (2p-1).");
112 declareProperty(std::make_unique<WorkspaceProperty<MatrixWorkspace>>(PropNames::OUTPUT_TAMO_WS, "two_a_minus_one",
114 "Output workspace containing the values for the term (2a-1).");
115
116 auto makeSettingIncludeDiagnosticsIsSelected = [] {
117 return std::make_unique<Kernel::EnabledWhenProperty>(PropNames::INCLUDE_DIAGNOSTICS, IS_EQUAL_TO, "1");
118 };
119
120 setPropertySettings(PropNames::OUTPUT_PHI_WS, makeSettingIncludeDiagnosticsIsSelected());
121 setPropertySettings(PropNames::OUTPUT_RHO_WS, makeSettingIncludeDiagnosticsIsSelected());
122 setPropertySettings(PropNames::OUTPUT_ALPHA_WS, makeSettingIncludeDiagnosticsIsSelected());
123 setPropertySettings(PropNames::OUTPUT_TPMO_WS, makeSettingIncludeDiagnosticsIsSelected());
124 setPropertySettings(PropNames::OUTPUT_TAMO_WS, makeSettingIncludeDiagnosticsIsSelected());
125
126 const auto &effOutputGroup = PropNames::OUTPUT_EFF_GROUP;
127 setPropertyGroup(PropNames::OUTPUT_P_EFF_WS, effOutputGroup);
128 setPropertyGroup(PropNames::OUTPUT_F_P_EFF_WS, effOutputGroup);
129 setPropertyGroup(PropNames::OUTPUT_F_A_EFF_WS, effOutputGroup);
130 setPropertyGroup(PropNames::OUTPUT_A_EFF_WS, effOutputGroup);
131
132 const auto &diagnosticOutputGroup = PropNames::OUTPUT_DIAGNOSTIC_GROUP;
133 setPropertyGroup(PropNames::OUTPUT_PHI_WS, diagnosticOutputGroup);
134 setPropertyGroup(PropNames::OUTPUT_RHO_WS, diagnosticOutputGroup);
135 setPropertyGroup(PropNames::OUTPUT_ALPHA_WS, diagnosticOutputGroup);
136 setPropertyGroup(PropNames::OUTPUT_TPMO_WS, diagnosticOutputGroup);
137 setPropertyGroup(PropNames::OUTPUT_TAMO_WS, diagnosticOutputGroup);
138}
139
140namespace {
142 const std::string &propertyName, std::map<std::string, std::string> &problems) {
143 if (!WorkspaceHelpers::matchingBins(workspace, refWs, true)) {
144 problems[propertyName] = "All input workspaces must have the same X values.";
145 return false;
146 }
147
148 return true;
149}
150
151bool isValidInputWorkspace(const Mantid::API::MatrixWorkspace_sptr &workspace,
152 const Mantid::API::MatrixWorkspace_sptr &refWs, const std::string &propertyName,
153 std::map<std::string, std::string> &problems) {
154 if (workspace == nullptr) {
155 problems[propertyName] = "All input workspaces must be matrix workspaces.";
156 return false;
157 }
158
159 Kernel::Unit_const_sptr unit = workspace->getAxis(0)->unit();
160 if (unit->unitID() != "Wavelength") {
161 problems[propertyName] = "All input workspaces must be in units of Wavelength.";
162 return false;
163 }
164
165 if (workspace->getNumberHistograms() != 1) {
166 problems[propertyName] = "All input workspaces must contain only a single spectrum.";
167 return false;
168 }
169
170 return hasMatchingBins(workspace, refWs, propertyName, problems);
171}
172
173bool isValidInputWSGroup(const Mantid::API::WorkspaceGroup_sptr &groupWs, const std::string &propertyName,
174 std::map<std::string, std::string> &problems) {
175 if (groupWs == nullptr) {
176 problems[propertyName] = "The input workspace must be a group workspace.";
177 return false;
178 }
179
180 if (groupWs->size() != 4) {
181 problems[propertyName] = "The input group must contain a workspace for all four flipper configurations.";
182 return false;
183 }
184
185 const MatrixWorkspace_sptr refWs = std::dynamic_pointer_cast<MatrixWorkspace>(groupWs->getItem(0));
186 for (size_t i = 0; i < groupWs->size(); ++i) {
187 const MatrixWorkspace_sptr childWs = std::dynamic_pointer_cast<MatrixWorkspace>(groupWs->getItem(i));
188 if (!isValidInputWorkspace(childWs, refWs, propertyName, problems)) {
189 return false;
190 }
191 }
192
193 return true;
194}
195} // namespace
196
197std::map<std::string, std::string> PolarizationEfficienciesWildes::validateInputs() {
198 std::map<std::string, std::string> problems;
199
200 const bool hasMagWsGrp = !isDefault(PropNames::INPUT_MAG_WS);
201 const bool hasInputPWs = !isDefault(PropNames::INPUT_P_EFF_WS);
202 const bool hasInputAWs = !isDefault(PropNames::INPUT_A_EFF_WS);
203
204 if (!isDefault(PropNames::OUTPUT_P_EFF_WS) && !hasMagWsGrp && !hasInputPWs && !hasInputAWs) {
205 problems[PropNames::OUTPUT_P_EFF_WS] = "If output polarizer efficiency is requested then either the magnetic "
206 "workspace or the known analyser efficiency should be provided.";
207 }
208
209 if (!isDefault(PropNames::OUTPUT_A_EFF_WS) && !hasMagWsGrp && !hasInputPWs && !hasInputAWs) {
210 problems[PropNames::OUTPUT_A_EFF_WS] = "If output analyser efficiency is requested then either the magnetic "
211 "workspace or the known polarizer efficiency should be provided.";
212 }
213
214 const WorkspaceGroup_sptr nonMagWsGrp = getProperty(PropNames::INPUT_NON_MAG_WS);
215 if (!isValidInputWSGroup(nonMagWsGrp, PropNames::INPUT_NON_MAG_WS, problems)) {
216 // We need to use a child workspace from the nonMag group as a reference for later checks, so stop here if there are
217 // any issues with this input
218 return problems;
219 }
220
221 const MatrixWorkspace_sptr nonMagRefWs = std::dynamic_pointer_cast<MatrixWorkspace>(nonMagWsGrp->getItem(0));
222
223 // If a magnetic workspace has been provided then we will use that to calculate the polarizer and analyser
224 // efficiencies, so individual efficiency workspaces should not be provided as well
225 if (hasMagWsGrp) {
226 if (hasInputPWs) {
227 problems[PropNames::INPUT_P_EFF_WS] = INPUT_EFF_WS_ERROR;
228 }
229
230 if (hasInputAWs) {
231 problems[PropNames::INPUT_A_EFF_WS] = INPUT_EFF_WS_ERROR;
232 }
233
234 const WorkspaceGroup_sptr magWsGrp = getProperty(PropNames::INPUT_MAG_WS);
235 if (isValidInputWSGroup(magWsGrp, PropNames::INPUT_MAG_WS, problems)) {
236 // Check that bins match between the input mag and nonMag workspace groups
237 const MatrixWorkspace_sptr magWs = std::dynamic_pointer_cast<MatrixWorkspace>(magWsGrp->getItem(0));
238 hasMatchingBins(magWs, nonMagRefWs, PropNames::INPUT_MAG_WS, problems);
239 }
240 } else {
241 if (hasInputPWs) {
242 const MatrixWorkspace_sptr inputPolEffWs = getProperty(PropNames::INPUT_P_EFF_WS);
243 isValidInputWorkspace(inputPolEffWs, nonMagRefWs, PropNames::INPUT_P_EFF_WS, problems);
244 }
245
246 if (hasInputAWs) {
247 const MatrixWorkspace_sptr inputAnaEffWs = getProperty(PropNames::INPUT_A_EFF_WS);
248 isValidInputWorkspace(inputAnaEffWs, nonMagRefWs, PropNames::INPUT_A_EFF_WS, problems);
249 }
250 }
251
252 return problems;
253}
254
256 Progress progress(this, 0.0, 1.0, 10);
257 progress.report(0, "Extracting spin state workspaces");
259
260 progress.report(1, "Calculating flipper efficiencies");
262
263 const bool solveForP = !isDefault(PropNames::OUTPUT_P_EFF_WS);
264 const bool solveForA = !isDefault(PropNames::OUTPUT_A_EFF_WS);
265 if (solveForP || solveForA) {
266 progress.report(4, "Finding polarizer and analyser efficiencies");
267 calculatePolarizerAndAnalyserEfficiencies(solveForP, solveForA);
268 }
269
270 progress.report(8, "Setting algorithm outputs");
271 setOutputs();
272
273 // Ensure that we don't carry over values from a previous run if an instance of this algorithm is run twice
275}
276
278 // Calculate the polarizing and analysing flipper efficiencies
279 const auto &[ws00, ws01, ws10, ws11] = getFlipperWorkspaces();
280
281 constexpr int var_num = 4;
282 // Calculate fp
283 const auto errorPropFp = Arithmetic::makeErrorPropagation<var_num>([](const auto &x) { return fnFp(x); });
284 m_wsFp = errorPropFp.evaluateWorkspaces(true, ws00, ws01, ws10, ws11);
285
286 // Calculate fa
287 const auto errorPropFa = Arithmetic::makeErrorPropagation<var_num>([](const auto &x) { return fnFa(x); });
288 m_wsFa = errorPropFa.evaluateWorkspaces(true, ws00, ws01, ws10, ws11);
289
290 // Calculate phi
291 const auto errorPropPhi = Arithmetic::makeErrorPropagation<var_num>([](const auto &x) { return fnPhi(x); });
292 m_wsPhi = errorPropPhi.evaluateWorkspaces(true, ws00, ws01, ws10, ws11);
293}
294
296 const auto &[ws00, ws01, ws10, ws11] = getFlipperWorkspaces();
297 const auto &[ws00Mag, ws01Mag, ws10Mag, ws11Mag] = getFlipperWorkspaces(true);
298
299 constexpr int var_num = 8;
300 const auto errorProp = Arithmetic::makeErrorPropagation<var_num>([](const auto &x) {
301 const auto fp = fnFp(x);
302 const auto fa = fnFa(x);
303 const auto numerator = fnNumerator(x, fa);
304 const auto denominator = fnDenominator(x, fp);
305 return sqrt(fnPhi(x) * (numerator / denominator));
306 });
307 const auto outWs = errorProp.evaluateWorkspaces(true, ws00, ws01, ws10, ws11, ws00Mag, ws01Mag, ws10Mag, ws11Mag);
308 return outWs;
309}
310
312 const bool solveForA) {
313 const auto &[ws00, ws01, ws10, ws11] = getFlipperWorkspaces();
314 if (m_magWsProvided) {
315 const auto &[ws00Mag, ws01Mag, ws10Mag, ws11Mag] = getFlipperWorkspaces(true);
316 constexpr int var_num = 8;
317 const MatrixWorkspace_sptr wsTPMO = calculateTPMO();
318
319 if (solveForP) {
320 m_wsP = (wsTPMO + 1) / 2;
321 }
322
323 if (solveForA) {
324 const auto errorProp = Arithmetic::makeErrorPropagation<var_num>([](const auto &x) {
325 const auto phi = fnPhi(x);
326 const auto fp = fnFp(x);
327 const auto fa = fnFa(x);
328 const auto numerator = fnNumerator(x, fa);
329 const auto denominator = fnDenominator(x, fp);
330 const auto TPMO = sqrt(phi * (numerator / denominator));
331 return (phi / (2 * TPMO)) + 0.5;
332 });
333 m_wsA = errorProp.evaluateWorkspaces(true, ws00, ws01, ws10, ws11, ws00Mag, ws01Mag, ws10Mag, ws11Mag);
334 }
335
336 return;
337 }
338
339 if (solveForP) {
340 if (const MatrixWorkspace_sptr inWsP = getProperty(PropNames::INPUT_P_EFF_WS)) {
341 m_wsP = inWsP->clone();
342 } else {
343 g_log.warning("The analyser efficiency workspace provided has been used to calculate the polarizer efficiency."
344 "This could lead to inflated errors as the analyser efficiency is a derived quantity.");
345 const MatrixWorkspace_sptr inWsA = getProperty(PropNames::INPUT_A_EFF_WS);
346 constexpr int var_num = 5;
347 const auto errorProp = Arithmetic::makeErrorPropagation<var_num>([](const auto &x) {
348 const auto TXMO = (2 * x[4]) - 1;
349 return (fnPhi(x) / (2 * TXMO)) + 0.5;
350 });
351 m_wsP = errorProp.evaluateWorkspaces(true, ws00, ws01, ws10, ws11, inWsA);
352 }
353 }
354
355 if (solveForA) {
356 if (const MatrixWorkspace_sptr inWsA = getProperty(PropNames::INPUT_A_EFF_WS)) {
357 m_wsA = inWsA->clone();
358 } else {
359 g_log.warning("The polarizer efficiency workspace provided has been used to calculate the analyser efficiency. "
360 "This could lead to inflated errors as the polarizer efficiency is a derived quantity.");
361 const MatrixWorkspace_sptr inWsP = getProperty(PropNames::INPUT_P_EFF_WS);
362 constexpr int var_num = 5;
363 const auto errorProp = Arithmetic::makeErrorPropagation<var_num>([](const auto &x) {
364 const auto TXMO = (2 * x[4]) - 1;
365 return (fnPhi(x) / (2 * TXMO)) + 0.5;
366 });
367 m_wsA = errorProp.evaluateWorkspaces(true, ws00, ws01, ws10, ws11, inWsP);
368 }
369 }
370}
371
373 setProperty(PropNames::OUTPUT_F_P_EFF_WS, m_wsFp);
374 setProperty(PropNames::OUTPUT_F_A_EFF_WS, m_wsFa);
375
376 if (m_wsP != nullptr) {
377 setProperty(PropNames::OUTPUT_P_EFF_WS, m_wsP);
378 }
379
380 if (m_wsA != nullptr) {
381 setProperty(PropNames::OUTPUT_A_EFF_WS, m_wsA);
382 }
383
384 if (getProperty(PropNames::INCLUDE_DIAGNOSTICS)) {
385 setProperty(PropNames::OUTPUT_PHI_WS, m_wsPhi);
386
387 const auto wsRho = (2 * m_wsFp) - 1;
388 setProperty(PropNames::OUTPUT_RHO_WS, wsRho);
389
390 const auto wsAlpha = (2 * m_wsFa) - 1;
391 setProperty(PropNames::OUTPUT_ALPHA_WS, wsAlpha);
392
393 if (m_wsP != nullptr) {
394 const auto wsTPMO = (2 * m_wsP) - 1;
395 setProperty(PropNames::OUTPUT_TPMO_WS, wsTPMO);
396 } else if (isChild()) {
397 // Clear diagnostic output property that may have been populated in a previous run as a child algorithm
398 resetPropertyValue(PropNames::OUTPUT_TPMO_WS);
399 }
400
401 if (m_wsA != nullptr) {
402 const auto wsTAMO = (2 * m_wsA) - 1;
403 setProperty(PropNames::OUTPUT_TAMO_WS, wsTAMO);
404 } else if (isChild()) {
405 // Clear diagnostic output property that may have been populated in a previous run as a child algorithm
406 resetPropertyValue(PropNames::OUTPUT_TAMO_WS);
407 }
408 } else if (isChild()) {
409 // Clear diagnostic output properties that may have been populated in a previous run as a child algorithm
410 resetPropertyValue(PropNames::OUTPUT_PHI_WS);
411 resetPropertyValue(PropNames::OUTPUT_RHO_WS);
412 resetPropertyValue(PropNames::OUTPUT_ALPHA_WS);
413 resetPropertyValue(PropNames::OUTPUT_TPMO_WS);
414 resetPropertyValue(PropNames::OUTPUT_TAMO_WS);
415 }
416}
417
419 m_wsFp = nullptr;
420 m_wsFa = nullptr;
421 m_wsPhi = nullptr;
422 m_wsP = nullptr;
423 m_wsA = nullptr;
424 m_magWsProvided = false;
425 m_spinStateWorkspaces.clear();
426}
427
428void PolarizationEfficienciesWildes::resetPropertyValue(const std::string &propertyName) {
429 setPropertyValue(propertyName, getPropertyValue(propertyName));
430}
431
433 const std::string &keyPrefix) {
434 const auto &flipperConfig = getPropertyValue(PropNames::FLIPPERS);
436 workspaceForSpinState(wsGrp, flipperConfig, FlipperConfigurations::OFF_OFF));
438 workspaceForSpinState(wsGrp, flipperConfig, FlipperConfigurations::OFF_ON));
440 workspaceForSpinState(wsGrp, flipperConfig, FlipperConfigurations::ON_OFF));
442 workspaceForSpinState(wsGrp, flipperConfig, FlipperConfigurations::ON_ON));
443}
444
446 const WorkspaceGroup_sptr magWsGrp = getProperty(PropNames::INPUT_MAG_WS);
447 const WorkspaceGroup_sptr nonMagWsGrp = getProperty(PropNames::INPUT_NON_MAG_WS);
448 if (magWsGrp) {
449 m_magWsProvided = true;
450 populateSpinStateWorkspaces(magWsGrp, MAG_KEY_PREFIX);
451 }
452 populateSpinStateWorkspaces(nonMagWsGrp);
453}
454
466
467} // namespace Mantid::Algorithms
#define DECLARE_ALGORITHM(classname)
Definition Algorithm.h:538
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.
bool isChild() const override
To query whether algorithm is a child.
Kernel::Logger & g_log
Definition Algorithm.h:422
void progress(double p, const std::string &msg="", double estimatedTime=0.0, int progressPrecision=0)
Sends ProgressNotification.
bool isDefault(const std::string &name) const
void setPropertyValue(const std::string &name, const std::string &value) override
Set the value of a property by string N.B.
Helper class for reporting progress from algorithms.
Definition Progress.h:25
A property class for workspaces.
void resetPropertyValue(const std::string &propertyName)
Sets the property value to its current value.
void resetMemberVariables()
Clear the values for all the algorithm member variables.
void exec() override
Execute the algorithm with the provided properties.
void mapSpinStateWorkspaces()
Populates the spin state workspaces map.
void populateSpinStateWorkspaces(const WorkspaceGroup_sptr &wsGrp, const std::string &keyPrefix="")
Populates the spin state workspaces map from ws group given key prefix.
MatrixWorkspace_sptr calculateTPMO()
Calculate (2p-1) from intensities.
void calculatePolarizerAndAnalyserEfficiencies(const bool solveForP, const bool solveForA)
Calculate the polarizer and/or analyser efficiencies, as requested.
void init() override
Setup the algorithm's properties and prepare constants.
std::map< std::string, std::string > validateInputs() override
Check that the inputs to the algorithm are valid.
FlipperWorkspaces getFlipperWorkspaces(const bool mag=false)
Access flipper workspaces in the spin state workspaces map.
std::unordered_map< std::string, MatrixWorkspace_sptr > m_spinStateWorkspaces
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void setPropertySettings(const std::string &name, std::unique_ptr< IPropertySettings > settings)
void setPropertyGroup(const std::string &name, const std::string &group)
Set the group for a given property.
void warning(const std::string &msg)
Logs at warning level.
Definition Logger.cpp:117
std::shared_ptr< WorkspaceGroup > WorkspaceGroup_sptr
shared pointer to Mantid::API::WorkspaceGroup
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
MANTID_ALGORITHMS_DLL API::MatrixWorkspace_sptr workspaceForSpinState(const API::WorkspaceGroup_sptr &group, const std::string &spinStateOrder, const std::string &targetSpinState)
Returns the workspace in the group associated with the given targetSpinState according to the order d...
std::shared_ptr< const Unit > Unit_const_sptr
Shared pointer to the Unit base class (const version)
Definition Unit.h:196
STL namespace.
static bool matchingBins(const std::shared_ptr< const MatrixWorkspace > &ws1, const std::shared_ptr< const MatrixWorkspace > &ws2, const bool firstOnly=false)
Checks whether the bins (X values) of two workspace are the same.
@ Input
An input workspace.
Definition Property.h:53
@ Output
An output workspace.
Definition Property.h:54