From 5fbb3660630fd1f7ee3b77b45a5651cc2bd39b0d Mon Sep 17 00:00:00 2001 From: "Ganyushin, Dmitry" Date: Thu, 22 Aug 2024 13:48:31 -0400 Subject: [PATCH 1/4] Added MinSizeCompressOnLoad parameterd to SNSPowderReudction --- .../plugins/algorithms/SNSPowderReduction.py | 9 +++++++-- .../plugins/algorithms/SNSPowderReductionTest.py | 12 ++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Framework/PythonInterface/plugins/algorithms/SNSPowderReduction.py b/Framework/PythonInterface/plugins/algorithms/SNSPowderReduction.py index 7c6b7c0ea366..7a82e0ccc68b 100644 --- a/Framework/PythonInterface/plugins/algorithms/SNSPowderReduction.py +++ b/Framework/PythonInterface/plugins/algorithms/SNSPowderReduction.py @@ -160,6 +160,7 @@ class SNSPowderReduction(DataProcessorAlgorithm): _sampleFormula = None _massDensity = None _containerShape = None + _compressionThreshold = None def category(self): return "Diffraction\\Reduction" @@ -178,7 +179,9 @@ def summary(self): return "The algorithm used for reduction of powder diffraction data obtained on SNS instruments (e.g. PG3)" def PyInit(self): - self.copyProperties("AlignAndFocusPowderFromFiles", ["Filename", "PreserveEvents", "DMin", "DMax", "DeltaRagged"]) + self.copyProperties( + "AlignAndFocusPowderFromFiles", ["Filename", "PreserveEvents", "DMin", "DMax", "DeltaRagged", "MinSizeCompressOnLoad"] + ) self.declareProperty("Sum", False, "Sum the runs. Does nothing for characterization runs.") self.declareProperty( @@ -438,6 +441,8 @@ def PyExec(self): # noqa self._info = None self._chunks = self.getProperty("MaxChunkSize").value + self._compressionThreshold = self.getProperty("MinSizeCompressOnLoad").value + # define splitters workspace and filter wall time self._splittersWS = self.getProperty("SplittersWorkspace").value if self._splittersWS is not None: @@ -928,7 +933,7 @@ def _focusAndSum(self, filenames, preserveEvents=True, final_name=None, absorpti ReductionProperties="__snspowderreduction", LogAllowList=self.getPropertyValue("LogAllowList").strip(), LogBlockList=self.getPropertyValue("LogBlockList").strip(), - **otherArgs, + MinSizeCompressOnLoad=self._compressionThreshold**otherArgs, ) # TODO make sure that this funny function is called diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/SNSPowderReductionTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/SNSPowderReductionTest.py index 95366d6b8760..6d013fe4f4bc 100644 --- a/Framework/PythonInterface/test/python/plugins/algorithms/SNSPowderReductionTest.py +++ b/Framework/PythonInterface/test/python/plugins/algorithms/SNSPowderReductionTest.py @@ -19,6 +19,18 @@ def testValidateInputs(self): RuntimeError, SNSPowderReduction, Filename="PG3_46577", OutputDirectory="/tmp/", PushDataPositive="AddMinimum", OffsetData=42.0 ) + def testValidateInputsCompressLoad(self): + # PushDataPositive and OffsetData cannot be specified together + self.assertRaises( + RuntimeError, + SNSPowderReduction, + Filename="PG3_46577", + OutputDirectory="/tmp/", + PushDataPositive="AddMinimum", + OffsetData=42.0, + MinSizeCompressOnLoad=1e-14, + ) + if __name__ == "__main__": unittest.main() From c4232cac734fcd0ee7cee967171b4f8c387609ac Mon Sep 17 00:00:00 2001 From: "Ganyushin, Dmitry" Date: Thu, 22 Aug 2024 14:56:37 -0400 Subject: [PATCH 2/4] Added a release note. --- .../v6.11.0/Framework/Algorithms/New_features/37831.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/source/release/v6.11.0/Framework/Algorithms/New_features/37831.rst b/docs/source/release/v6.11.0/Framework/Algorithms/New_features/37831.rst index 0780a35d4da9..e947d9ee9a84 100644 --- a/docs/source/release/v6.11.0/Framework/Algorithms/New_features/37831.rst +++ b/docs/source/release/v6.11.0/Framework/Algorithms/New_features/37831.rst @@ -1 +1,2 @@ -- Added a load compression parameter ``MinSizeCompressOnLoad`` for ref: :ref:`AlignAndFocusPowderFromFiles `. \ No newline at end of file +- Added a load compression parameter ``MinSizeCompressOnLoad`` for ref: :ref:`AlignAndFocusPowderFromFiles `. +- Added a load compression parameter ``MinSizeCompressOnLoad`` for ref: :ref:`SNSPowderReduction `. \ No newline at end of file From d019d53a5e65f25905c11d7d7e806f6698bfcc66 Mon Sep 17 00:00:00 2001 From: "Ganyushin, Dmitry" Date: Fri, 23 Aug 2024 11:25:33 -0400 Subject: [PATCH 3/4] Typo fix --- .../PythonInterface/plugins/algorithms/SNSPowderReduction.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Framework/PythonInterface/plugins/algorithms/SNSPowderReduction.py b/Framework/PythonInterface/plugins/algorithms/SNSPowderReduction.py index 7a82e0ccc68b..4f861b30cfb0 100644 --- a/Framework/PythonInterface/plugins/algorithms/SNSPowderReduction.py +++ b/Framework/PythonInterface/plugins/algorithms/SNSPowderReduction.py @@ -933,7 +933,8 @@ def _focusAndSum(self, filenames, preserveEvents=True, final_name=None, absorpti ReductionProperties="__snspowderreduction", LogAllowList=self.getPropertyValue("LogAllowList").strip(), LogBlockList=self.getPropertyValue("LogBlockList").strip(), - MinSizeCompressOnLoad=self._compressionThreshold**otherArgs, + MinSizeCompressOnLoad=self._compressionThreshold, + **otherArgs, ) # TODO make sure that this funny function is called From f59be22afa86e08968384a44301e69e1b17fcfeb Mon Sep 17 00:00:00 2001 From: "Ganyushin, Dmitry" Date: Fri, 23 Aug 2024 11:34:47 -0400 Subject: [PATCH 4/4] Improved release note. --- .../v6.11.0/Framework/Algorithms/New_features/37831.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/source/release/v6.11.0/Framework/Algorithms/New_features/37831.rst b/docs/source/release/v6.11.0/Framework/Algorithms/New_features/37831.rst index e947d9ee9a84..77b02091a1a6 100644 --- a/docs/source/release/v6.11.0/Framework/Algorithms/New_features/37831.rst +++ b/docs/source/release/v6.11.0/Framework/Algorithms/New_features/37831.rst @@ -1,2 +1 @@ -- Added a load compression parameter ``MinSizeCompressOnLoad`` for ref: :ref:`AlignAndFocusPowderFromFiles `. -- Added a load compression parameter ``MinSizeCompressOnLoad`` for ref: :ref:`SNSPowderReduction `. \ No newline at end of file +- Added a load compression parameter ``MinSizeCompressOnLoad`` for ref: :ref:`AlignAndFocusPowderFromFiles ` and ref: :ref:`SNSPowderReduction ` \ No newline at end of file