diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TOSCABankCorrection.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TOSCABankCorrection.py index 5d8fb537f8b66ed255d0f55fe9f131d4eea0ed5c..6cc5b9522b3474199b313ee669e5f44ceac5fb94 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TOSCABankCorrection.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TOSCABankCorrection.py @@ -16,7 +16,7 @@ class TOSCABankCorrection(DataProcessorAlgorithm): def category(self): - return 'PythonAlgorithms;Inelastic' + return 'PythonAlgorithms;Inelastic;CorrectionFunctions' def summary(self): @@ -28,7 +28,8 @@ class TOSCABankCorrection(DataProcessorAlgorithm): direction=Direction.Input), doc='Input reduced workspace') - self.declareProperty(FloatArrayProperty(name='SearchRange'), + self.declareProperty(FloatArrayProperty(name='SearchRange', + values=[200, 2000]), doc='Range over which to find peaks') self.declareProperty(name='ClosePeakTolerance', defaultValue=20.0, @@ -92,6 +93,11 @@ class TOSCABankCorrection(DataProcessorAlgorithm): peaks = self._get_peaks('__search_ws') DeleteWorkspace('__search_ws') + # Ensure there is at least one peak found + if len(peaks) < 1: + raise RuntimeError('Could not find any peaks. Try increasing \ + width of SearchRange and/or ClosePeakTolerance') + delta = self._get_delta(peaks) offset = delta / 2 diff --git a/Code/Mantid/docs/source/algorithms/TOSCABankCorrection-v1.rst b/Code/Mantid/docs/source/algorithms/TOSCABankCorrection-v1.rst new file mode 100644 index 0000000000000000000000000000000000000000..e927286c8d9b5d3fc9e3f4e9573d4fd979c38d37 --- /dev/null +++ b/Code/Mantid/docs/source/algorithms/TOSCABankCorrection-v1.rst @@ -0,0 +1,37 @@ +.. algorithm:: + +.. summary:: + +.. alias:: + +.. properties:: + +Description +----------- + +This algorithm attempts to automatically correct TOSCA data in which the +position of the sample has been moved and has affected the alignment of features +on the spectra from forward and backscattering detector banks. + +The input workspace should be an energy transfer reduction, for the default +values of SearchRange and ClosePeakTolerance the X axis is assumed to be in +cm-1, however the X axis is not restricted to this unit. + +The algorithm works by finding peaks of a given shape (using the :ref:`FindPeaks +<algm-FindPeaks>`) on both the forward and backscattering banks and attempting +to match them to what is believed to be the same feature on the other bank. + +The choice can then be made to either take the difference in peak centre between +the tallest matched peaks or to average the difference of all matched peaks to +determine the mount that both spectra must be moved by to correct for the change +in sample position. + +The data is then corrected by providing a shift in the X axis of each bank +spectra (using :ref:`ConvertAxisByFormula <algm-ConvertAxisByFormula>`) to bring +the two individual bank spectra back into alignment. + +The corrected spectra are then rebinned to the input workspace (using +:ref:`RebinToWorkspace <algm-RebinToWorkspace>`) to preserve the X range and to +maintain bin alignment. + +.. categories::