Skip to content

Commit e22b915

Browse files
Deprecate UnwrapSNS (#39097)
* deprecate algorithm UnwrapSNS * deprecate AlignAndFocusPowder property UnwrapRef * deprecate AlignAndFocusPowderFromFiles property UnwrapRef * deprecate SNSPowderReduction property UnwrapRef * update AlignAndFocusPowder docs * remove deprecated parameter UnwrapRef from the Powder Diffraction Reduction Interface * add release notes * remove unused field * Update docs/source/release/v6.13.0/Framework/Algorithms/Deprecated/39097.rst Co-authored-by: Pete Peterson <petersonpf@ornl.gov> --------- Co-authored-by: Pete Peterson <petersonpf@ornl.gov>
1 parent 1d5f6f1 commit e22b915

File tree

13 files changed

+40
-111
lines changed

13 files changed

+40
-111
lines changed

Framework/Algorithms/inc/MantidAlgorithms/UnwrapSNS.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
// Includes
1111
//----------------------------------------------------------------------
1212
#include "MantidAPI/Algorithm.h"
13+
#include "MantidAPI/DeprecatedAlgorithm.h"
1314
#include "MantidAlgorithms/DllConfig.h"
1415
#include "MantidDataObjects/EventWorkspace.h"
1516

@@ -31,7 +32,7 @@ namespace Algorithms {
3132
@author Russell Taylor, Tessella Support Services plc
3233
@date 25/07/2008
3334
*/
34-
class MANTID_ALGORITHMS_DLL UnwrapSNS final : public API::Algorithm {
35+
class MANTID_ALGORITHMS_DLL UnwrapSNS final : public API::Algorithm, public API::DeprecatedAlgorithm {
3536
public:
3637
UnwrapSNS();
3738
~UnwrapSNS() override = default;

Framework/Algorithms/src/UnwrapSNS.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ using std::size_t;
3232
/// Default constructor
3333
UnwrapSNS::UnwrapSNS()
3434
: m_conversionConstant(0.), m_inputWS(), m_inputEvWS(), m_LRef(0.), m_Tmin(0.), m_Tmax(0.), m_frameWidth(0.),
35-
m_numberOfSpectra(0), m_XSize(0) {}
35+
m_numberOfSpectra(0), m_XSize(0) {
36+
deprecatedDate("2025-03-24");
37+
}
3638

3739
/// Initialisation method
3840
void UnwrapSNS::init() {

Framework/PythonInterface/plugins/algorithms/AlignAndFocusPowderFromFiles.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ def validateInputs(self):
195195
if (not self.getProperty("LogAllowList").isDefault) and (not self.getProperty("LogBlockList").isDefault):
196196
errors["LogAllowList"] = "Cannot specify with LogBlockList"
197197
errors["LogBlockList"] = "Cannot specify with LogAllowList"
198+
if not self.getProperty("UnwrapRef").isDefault:
199+
errors["UnwrapRef"] = "AlignAndFocusPowderFromFiles property UnwrapRef is deprecated since 2025-03-24."
198200

199201
return errors
200202

Framework/PythonInterface/plugins/algorithms/SNSPowderReduction.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ class SNSPowderReduction(DataProcessorAlgorithm):
136136
_instrument = None
137137
_filterBadPulses = None
138138
_removePromptPulseWidth = None
139-
_LRef = None
140139
_DIFCref = None
141140
_wavelengthMin = None
142141
_wavelengthMax = None
@@ -392,6 +391,10 @@ def validateInputs(self):
392391

393392
if self.getProperty("InterpolateTargetTemp").value > 0.0 and not len(self.getProperty("BackgroundNumber").value) == 2:
394393
issues["InterpolateTargetTemp"] = "If InterpolateTargetTemp specified, you must provide two background run numbers"
394+
395+
# Deprecated properties
396+
if not self.getProperty("UnwrapRef").isDefault:
397+
issues["UnwrapRef"] = "SNSPowderReduction property UnwrapRef is deprecated since 2025-03-24."
395398
return issues
396399

397400
# pylint: disable=too-many-locals,too-many-branches,too-many-statements
@@ -413,7 +416,6 @@ def PyExec(self): # noqa
413416
self._filterBadPulses = self.getProperty("FilterBadPulses").value
414417
self._removePromptPulseWidth = self.getProperty("RemovePromptPulseWidth").value
415418
self._lorentz = self.getProperty("LorentzCorrection").value
416-
self._LRef = self.getProperty("UnwrapRef").value
417419
self._DIFCref = self.getProperty("LowResRef").value
418420
self._wavelengthMin = self.getProperty("CropWavelengthMin").value
419421
self._wavelengthMax = self.getProperty("CropWavelengthMax").value
@@ -944,7 +946,6 @@ def _focusAndSum(self, filenames, preserveEvents=True, final_name=None, absorpti
944946
CompressTolerance=self.COMPRESS_TOL_TOF,
945947
CompressBinningMode=self._compressBinningMode,
946948
LorentzCorrection=self._lorentz,
947-
UnwrapRef=self._LRef,
948949
LowResRef=self._DIFCref,
949950
LowResSpectrumOffset=self._lowResTOFoffset,
950951
CropWavelengthMin=self._wavelengthMin,
@@ -1060,7 +1061,6 @@ def _focusChunks(self, filename, filter_wall=(0.0, 0.0), splitwksp=None, preserv
10601061
CompressTolerance=self.COMPRESS_TOL_TOF,
10611062
CompressBinningMode=self._compressBinningMode,
10621063
LorentzCorrection=self._lorentz,
1063-
UnwrapRef=self._LRef,
10641064
LowResRef=self._DIFCref,
10651065
LowResSpectrumOffset=self._lowResTOFoffset,
10661066
CropWavelengthMin=self._wavelengthMin,

Framework/WorkflowAlgorithms/inc/MantidWorkflowAlgorithms/AlignAndFocusPowder.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ class DLLExport AlignAndFocusPowder : public API::DataProcessorAlgorithm {
9797
bool binInDspace{false};
9898
double xmin{0.0};
9999
double xmax{0.0};
100-
double LRef{0.0};
101100
double DIFCref{0.0};
102101
double minwl{0.0};
103102
double maxwl{0.0};

Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,7 @@ void AlignAndFocusPowder::init() {
215215
"Multiply each spectrum by "
216216
"sin(theta) where theta is "
217217
"half of the Bragg angle");
218-
declareProperty(PropertyNames::UNWRAP_REF, 0.,
219-
"Reference total flight path for frame "
220-
"unwrapping. Zero skips the correction");
218+
declareProperty(PropertyNames::UNWRAP_REF, 0., "This property is deprecated (since v6.13).");
221219
declareProperty(PropertyNames::LOWRES_REF, 0., "Reference DIFC for resolution removal. Zero skips the correction");
222220
declareProperty("CropWavelengthMin", 0., "Crop the data at this minimum wavelength. Overrides LowResRef.");
223221
mapPropertyName(PropertyNames::WL_MIN, "wavelength_min");
@@ -294,6 +292,11 @@ std::map<std::string, std::string> AlignAndFocusPowder::validateInputs() {
294292
"Must have same number of values as " + PropertyNames::RESONANCE_LOWER_LIMITS;
295293
}
296294

295+
// Deprecated properties
296+
if (!isDefault(PropertyNames::UNWRAP_REF)) {
297+
g_log.error("AlignAndFocusPowder property UnwrapRef is deprecated since 2025-03-24.");
298+
}
299+
297300
return result;
298301
}
299302

@@ -378,7 +381,6 @@ void AlignAndFocusPowder::exec() {
378381
auto dmin = getVecPropertyFromPmOrSelf(PropertyNames::D_MINS, m_dmins);
379382
auto dmax = getVecPropertyFromPmOrSelf(PropertyNames::D_MAXS, m_dmaxs);
380383
this->getVecPropertyFromPmOrSelf(PropertyNames::RAGGED_DELTA, m_delta_ragged);
381-
LRef = getProperty(PropertyNames::UNWRAP_REF);
382384
DIFCref = getProperty(PropertyNames::LOWRES_REF);
383385
const bool applyLorentz = getProperty(PropertyNames::LORENTZ);
384386
minwl = getProperty(PropertyNames::WL_MIN);
@@ -491,7 +493,7 @@ void AlignAndFocusPowder::exec() {
491493
}
492494

493495
// set up a progress bar with the "correct" number of steps
494-
m_progress = std::make_unique<Progress>(this, 0., 1., 22);
496+
m_progress = std::make_unique<Progress>(this, 0., 1., 21);
495497

496498
if (m_maskWS) {
497499
g_log.information() << "running MaskDetectors started at " << Types::Core::DateAndTime::getCurrentTime() << "\n";
@@ -651,26 +653,6 @@ void AlignAndFocusPowder::exec() {
651653
m_progress->report();
652654

653655
// Beyond this point, low resolution TOF workspace is considered.
654-
if (LRef > 0.) {
655-
// this algorithm was originally created for POWGEN before issues in the DAS were fixed
656-
// it is not used in any current reduction and remains for legacy data processing
657-
m_outputW = convertUnits(m_outputW, "TOF");
658-
659-
g_log.information() << "running UnwrapSNS(LRef=" << LRef << ",Tmin=" << tmin << ",Tmax=" << tmax << ") started at "
660-
<< Types::Core::DateAndTime::getCurrentTime() << "\n";
661-
API::IAlgorithm_sptr removeAlg = createChildAlgorithm("UnwrapSNS");
662-
removeAlg->setProperty("InputWorkspace", m_outputW);
663-
removeAlg->setProperty("OutputWorkspace", m_outputW);
664-
removeAlg->setProperty("LRef", LRef);
665-
if (tmin > 0.)
666-
removeAlg->setProperty("Tmin", tmin);
667-
if (tmax > tmin)
668-
removeAlg->setProperty("Tmax", tmax);
669-
removeAlg->executeAsChildAlg();
670-
m_outputW = removeAlg->getProperty("OutputWorkspace");
671-
}
672-
m_progress->report();
673-
674656
if (minwl > 0. || (!isEmpty(maxwl))) { // just crop the workspace
675657
// turn off the low res stuff
676658
m_processLowResTOF = false;
@@ -735,7 +717,7 @@ void AlignAndFocusPowder::exec() {
735717
m_progress->report();
736718

737719
// Convert units
738-
if (LRef > 0. || minwl > 0. || DIFCref > 0. || (!isEmpty(maxwl))) {
720+
if (minwl > 0. || DIFCref > 0. || (!isEmpty(maxwl))) {
739721
m_outputW = convertUnits(m_outputW, "dSpacing");
740722
if (m_processLowResTOF)
741723
m_lowResW = convertUnits(m_lowResW, "dSpacing");

docs/source/algorithms/AlignAndFocusPowder-v1.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ The way that algorithms are connected together is better described in the workfl
3232
- :ref:`algm-RemoveLowResTOF` ``CropWavelengthMin`` and ``CropWavelengthMax`` are prefered
3333
- :ref:`algm-RemovePromptPulse`
3434
- :ref:`algm-SortEvents` (event workspace only)
35-
- :ref:`algm-UnwrapSNS`
3635

3736

3837

docs/source/diagrams/AlignAndFocusPowder-v1_wkflw.dot

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ digraph AlignAndFocusPowder {
1313
MaskBinTable
1414
CalibrationWorkspace
1515
GroupingWorkspace
16-
UnwrapRef
1716
LowResRef
1817
params1 [label="Params"]
1918
params2 [label="Params"]
@@ -25,7 +24,6 @@ digraph AlignAndFocusPowder {
2524
clearDiffCal [label="ApplyDiffCal v1\nClear parameters"]
2625
compressEvents [label="CompressEvents v1"]
2726
compressEvents2 [label="CompressEvents v1"]
28-
convertUnitsTof1 [label="ConvertUnits v1\nTime-of-Flight"]
2927
convertUnitsTof2 [label="ConvertUnits v1\nTime-of-Flight"]
3028
convertUnitsD1 [label="ConvertUnits v1\nd-spacing"]
3129
convertUnitsD2 [label="ConvertUnits v1\nd-spacing"]
@@ -46,7 +44,6 @@ digraph AlignAndFocusPowder {
4644
rebinRagged [label="RebinRagged v1"]
4745
removeLowResTOF [label="RemoveLowResTOF v1"]
4846
removePromptPulse [label="RemovePromptPulse v1"]
49-
unwrapSNS [label="UnwrapSNS v1"]
5047
}
5148

5249
subgraph decisions {
@@ -58,7 +55,6 @@ digraph AlignAndFocusPowder {
5855
isDspace1 [label="Is d-space binning?"]
5956
isDspace2 [label="Is d-space binning?"]
6057
isDspace3 [label="Is d-space binning?"]
61-
ifLref [label="LRef specified?"]
6258
ifDIFCref [label="DIFCref specified?"]
6359
ifRaggedTof [label="ragged rebin\nand tof binning"]
6460
}
@@ -98,26 +94,19 @@ digraph AlignAndFocusPowder {
9894
maskBins -> convertUnitsD3
9995
convertUnitsD3 -> lorentz
10096

101-
lorentz -> ifLref
97+
lorentz -> ifDIFCref
10298

103-
ifLref -> convertUnitsWL2 [label="No"]
104-
cropWorkspaceWL -> convertUnitsD1
105-
106-
convertUnitsD1 -> isDspace2
107-
108-
ifLref -> convertUnitsTof1 [label="Yes"]
109-
convertUnitsTof1 -> unwrapSNS
110-
UnwrapRef -> unwrapSNS
111-
unwrapSNS -> convertUnitsWL2
112-
convertUnitsWL2 -> ifDIFCref
113-
114-
115-
ifDIFCref -> cropWorkspaceWL [label="No"]
99+
ifDIFCref -> convertUnitsWL2 [label="No"]
116100
ifDIFCref -> removeLowResTOF [label="Yes"]
117101

118102
LowResRef -> removeLowResTOF
119103
removeLowResTOF -> convertUnitsD1
120104

105+
convertUnitsWL2 -> cropWorkspaceWL
106+
cropWorkspaceWL -> convertUnitsD1
107+
108+
convertUnitsD1 -> isDspace2
109+
121110
isDspace2 -> diffFocus [label="No"]
122111
isDspace2 -> rebin2 [label="Yes"]
123112
params2 -> rebin2
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- :ref:`UnwrapSNS <algm-UnwrapSNS>` has been deprecated. There is no replacement.
2+
- Property ``UnwrapRef`` has been deprecated for algorithms that previously
3+
called deprecated algorithm :ref:`UnwrapSNS <algm-UnwrapSNS>`:
4+
:ref:`AlignAndFocusPowder <algm-AlignAndFocusPowder>`,
5+
:ref:`AlignAndFocusPowderFromFiles <algm-AlignAndFocusPowderFromFiles>`
6+
and :ref:`SNSPowderReduction <algm-SNSPowderReduction>`.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Deprecated parameter ``Unwrap Ref`` has been removed from the Powder
2+
Diffraction Reduction Interface.

0 commit comments

Comments
 (0)