From 85aa0125c1b30937cac9d14a1f67cd182b73a1d3 Mon Sep 17 00:00:00 2001 From: Gesner Passos Date: Wed, 4 Dec 2013 13:57:33 +0000 Subject: [PATCH] Refs #8548: Fix loading transmissions when event mode run is passed --- .../scripts/SANS/isis_reduction_steps.py | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Code/Mantid/scripts/SANS/isis_reduction_steps.py b/Code/Mantid/scripts/SANS/isis_reduction_steps.py index 104eb541cfaa..f0c838af8d85 100644 --- a/Code/Mantid/scripts/SANS/isis_reduction_steps.py +++ b/Code/Mantid/scripts/SANS/isis_reduction_steps.py @@ -88,6 +88,25 @@ def get_wksp_name(self): wksp_name = property(get_wksp_name, None, None, None) + def _load_transmission(self, inst=None, is_can=False, extra_options=dict()): + if '.raw' in self._data_file or '.RAW' in self._data_file: + self._load(inst, is_can, extra_options) + return + + workspace = self._get_workspace_name() + + # For sans, in transmission, we care only about the monitors. Hence, + # by trying to load only the monitors we speed up the reduction process. + # besides, we avoid loading events which is uselles for transmission. + # it may fail, if the input file was not a nexus file, in this case, + # it pass the job to the default _load method. + try: + outWs = LoadNexusMonitors(self._data_file, OutputWorkspace=workspace) + self.periods_in_file = 1 + self._wksp_name = workspace + except: + self._load(inst, is_can, extra_options) + def _load(self, inst = None, is_can=False, extra_options=dict()): """ Load a workspace and read the logs into the passed instrument reference @@ -219,8 +238,11 @@ def _assignHelper(self, reducer): spectrum_limits = {'SpectrumMin':spec_min, 'SpectrumMax':spec_min + 4} try: - # the spectrum_limits is not the default only for transmission data - self._load(reducer.instrument, extra_options=spectrum_limits) + if self._is_trans: + self._load_transmission(reducer.instrument, extra_options=spectrum_limits) + else: + # the spectrum_limits is not the default only for transmission data + self._load(reducer.instrument, extra_options=spectrum_limits) except RuntimeError, details: sanslog.warning(str(details)) self._wksp_name = ''