From b48eab0fc61a5435516e2d943c26ee724b684d14 Mon Sep 17 00:00:00 2001 From: Steve Williams <stephen.williams@stfc.ac.uk> Date: Tue, 10 Aug 2010 18:24:40 +0000 Subject: [PATCH] Added some code to Normalize to make it compatible with ISIS and added some ISIS compatibility comments re #1421 --- .../PythonAPI/scripts/SANS/SANSReducer.py | 2 ++ .../scripts/SANS/SANSReductionSteps.py | 33 ++++++++++++++++--- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Code/Mantid/PythonAPI/scripts/SANS/SANSReducer.py b/Code/Mantid/PythonAPI/scripts/SANS/SANSReducer.py index 3016b92ad1c..f52ab15bbdd 100644 --- a/Code/Mantid/PythonAPI/scripts/SANS/SANSReducer.py +++ b/Code/Mantid/PythonAPI/scripts/SANS/SANSReducer.py @@ -14,6 +14,8 @@ __version__ = '0.0' class SANSReducer(Reducer): """ SANS-specific implementation of the Reducer + #TODO: ISIS can't deal with the solidAngle() and WeightedAzimuthalAverage steps, can we make them optional and remove references to them from this file? + #TODO: _dark_current_subtracter isn't a spallation source concept, I don't think """ ## Normalization options #TODO: those also correspond to the timer and monitor spectra -> store this in instr conf instead diff --git a/Code/Mantid/PythonAPI/scripts/SANS/SANSReductionSteps.py b/Code/Mantid/PythonAPI/scripts/SANS/SANSReductionSteps.py index 375aa2d20f7..afd01355ce7 100644 --- a/Code/Mantid/PythonAPI/scripts/SANS/SANSReductionSteps.py +++ b/Code/Mantid/PythonAPI/scripts/SANS/SANSReductionSteps.py @@ -12,7 +12,9 @@ from mantidsimple import * class BaseBeamFinder(ReductionStep): """ Base beam finder. Holds the position of the beam center - as well as the algorithm for finding it. + and the algorithm for calculates it using the beam's + displacement under gravity + TODO: Maintain HFIR-ISIS compatibility """ def __init__(self, beam_center_x=0.0, beam_center_y=0.0): super(BaseBeamFinder, self).__init__() @@ -85,6 +87,7 @@ class BaseTransmission(ReductionStep): """ Base transmission. Holds the transmission value as well as the algorithm for calculating it. + TODO: ISIS doesn't use ApplyTransmissionCorrection, perhaps it's in Q1D, can we remove it from here? """ def __init__(self, trans=0.0, error=0.0): super(BaseTransmission, self).__init__() @@ -348,11 +351,19 @@ class LoadRun(ReductionStep): class Normalize(ReductionStep): """ - Normalize the data to time or monitor + Normalize the data to + time ???is this implemented?? + or a spectrum, typically a monitor, with in the workspace. + By default the normalization is done with respect to the Instrument's + incident monitor + TODO: Maintain HFIR-ISIS compatibility """ - def __init__(self, normalization_spectrum=0): + def __init__(self, normalization_spectrum=-1): super(Normalize, self).__init__() - self._normalization_spectrum = normalization_spectrum + if normalization_spectrum == -1: + self._normalization_spectrum = reducer.instrument.get_incident_mon() + else: + self._normalization_spectrum = normalization_spectrum def get_normalization_spectrum(self): return self._normalization_spectrum @@ -366,6 +377,8 @@ class Normalize(ReductionStep): Divide(workspace, norm_ws, workspace) + mtd.deleteWorkspace(norm_ws) + # HFIR-specific: If we count for monitor we need to multiply by 1e8 if self._normalization_spectrum == reducer.NORMALIZATION_MONITOR: Scale(workspace, workspace, 1.0e8, 'Multiply') @@ -452,9 +465,19 @@ class SensitivityCorrection(ReductionStep): class Mask(ReductionStep): """ - Apply mask to workspace + Marks some spectra so that they are not included in the analysis + TODO: Maintain HFIR-ISIS compatibility + TODO: ISIS to add a xml string data member and a MaskDetectorsInShape call """ def __init__(self, nx_low=0, nx_high=0, ny_low=0, ny_high=0): + """ + Initalize masking and optionally define a "picture frame" outside of + which the spectra from all detectors are to be masked. + @param nx_low: number of pixels to mask on the lower-x side of the detector + @param nx_high: number of pixels to mask on the higher-x side of the detector + @param ny_low: number of pixels to mask on the lower-y side of the detector + @param ny_high: number of pixels to mask on the higher-y side of the detector + """ super(Mask, self).__init__() self._nx_low = nx_low self._nx_high = nx_high -- GitLab