Skip to content

Commit 8f41f2b

Browse files
authored
Merge pull request #35945 from mantidproject/35855_fix_background_sub_with_polarization_analysis
Remove incorrect steps after polarization correction in ReflectometryReductionOneAuto
2 parents 65343a3 + ce7748f commit 8f41f2b

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

Framework/Reflectometry/src/ReflectometryReductionOneAuto3.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,10 @@ Algorithm_sptr ReflectometryReductionOneAuto3::createAlgorithmForGroupMember(std
828828
std::dynamic_pointer_cast<MatrixWorkspace>(AnalysisDataService::Instance().retrieve(outputNames.iVsLam));
829829
auto newProcInst = convertToSpectrumNumber("0", currentWorkspace);
830830
alg->setProperty("ProcessingInstructions", newProcInst);
831+
// We only want to recalculate IvsQ, so we should not perform the sum banks or background subtraction steps
832+
alg->setProperty("SubtractBackground", false);
833+
alg->setProperty("BackgroundProcessingInstructions", "");
834+
alg->setProperty("ROIDetectorIDs", "");
831835
}
832836

833837
return alg;

Framework/Reflectometry/test/ReflectometryReductionOneAuto3Test.h

+31
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,37 @@ class ReflectometryReductionOneAuto3Test : public CxxTest::TestSuite {
823823
ADS.clear();
824824
}
825825

826+
void test_polarization_correction_with_background_subtraction() {
827+
828+
std::string const name = "input";
829+
prepareInputGroup(name, "Fredrikze");
830+
applyPolarizationEfficiencies(name);
831+
832+
ReflectometryReductionOneAuto3 alg;
833+
alg.initialize();
834+
alg.setPropertyValue("InputWorkspace", name);
835+
alg.setProperty("ThetaIn", 10.0);
836+
alg.setProperty("WavelengthMin", 1.0);
837+
alg.setProperty("WavelengthMax", 15.0);
838+
alg.setProperty("ProcessingInstructions", "2");
839+
alg.setProperty("MomentumTransferStep", 0.04);
840+
alg.setProperty("PolarizationAnalysis", true);
841+
alg.setProperty("SubtractBackground", true);
842+
alg.setProperty("BackgroundProcessingInstructions", "3-4");
843+
alg.setPropertyValue("OutputWorkspace", "IvsQ");
844+
alg.setPropertyValue("OutputWorkspaceBinned", "IvsQ_binned");
845+
alg.setPropertyValue("OutputWorkspaceWavelength", "IvsLam");
846+
alg.execute();
847+
848+
auto outQGroup = retrieveOutWS("IvsQ");
849+
auto outLamGroup = retrieveOutWS("IvsLam");
850+
851+
TS_ASSERT_EQUALS(outQGroup.size(), 4);
852+
TS_ASSERT_EQUALS(outLamGroup.size(), 4);
853+
854+
ADS.clear();
855+
}
856+
826857
void test_input_workspace_group_with_default_output_workspaces() {
827858
ReflectometryReductionOneAuto3 alg;
828859
setup_alg_on_input_workspace_group_with_run_number(alg);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- :ref:`algm-ReflectometryReductionOneAuto` no longer throws an error when attempting to run a reduction that applies both a background subtraction and a polarization correction.

0 commit comments

Comments
 (0)