From 6dd01e778ad03b27a4efaef927502be00f98a7fc Mon Sep 17 00:00:00 2001 From: Alex Buts Date: Fri, 9 May 2014 12:57:23 +0100 Subject: [PATCH] refs #9438 Better diagnostics During IDF changes, it was found difficult to understand what is going wrong when monitor number is specified incorrectly. This change should help to address similar problem in a future. --- .../Inelastic/DirectEnergyConversion.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Code/Mantid/scripts/Inelastic/DirectEnergyConversion.py b/Code/Mantid/scripts/Inelastic/DirectEnergyConversion.py index 5e8b691eddc9..3c9e1bbebcb3 100644 --- a/Code/Mantid/scripts/Inelastic/DirectEnergyConversion.py +++ b/Code/Mantid/scripts/Inelastic/DirectEnergyConversion.py @@ -402,7 +402,7 @@ def _do_mono_SNS(self, data_ws, monitor_ws, result_name, ei_guess, ConvertFromDistribution(Workspace=result_name) - # Normalise using the chosen method + # Normalize using the chosen method # This should be done as soon as possible after loading and usually happens at diag. Here just in case if diag was bypassed self.normalise(mtd[result_name], result_name, self.normalise_method, range_offset=bin_offset) @@ -445,7 +445,7 @@ def _do_mono_ISIS(self, data_ws, monitor_ws, result_name, ei_guess, WorkspaceIndexList= '',Mode= 'Mean',SkipMonitors='1') - # Normalise using the chosen method+group + # Normalize using the chosen method+group # : This really should be done as soon as possible after loading self.normalise(mtd[result_name], result_name, self.normalise_method, range_offset=bin_offset) @@ -472,7 +472,7 @@ def _do_mono(self, data_ws, monitor_ws, result_name, ei_guess, white_run=None, map_file=None, spectra_masks=None, Tzero=None): """ Convert units of a given workspace to deltaE, including possible - normalisation to a white-beam vanadium run. + normalization to a white-beam vanadium run. """ if (self.__facility == "SNS"): self._do_mono_SNS(data_ws,monitor_ws,result_name,ei_guess, @@ -610,13 +610,17 @@ def get_ei(self, input_ws, resultws_name, ei_guess): if type(monitor_ws) is str: monitor_ws = mtd[monitor_ws] try: - # check if the spectra with correspondent number is present in the worksace + # check if the spectra with correspondent number is present in the workspace nsp = monitor_ws.getIndexFromSpectrumNumber(int(self.ei_mon_spectra[0])); - except: + except RuntimeError as err: monitors_from_separate_ws = True mon_ws = monitor_ws.getName()+'_monitors' - monitor_ws = mtd[mon_ws]; - #------------------------------------------------------------- + try: + monitor_ws = mtd[mon_ws]; + except: + print "**** ERROR while attempting to get spectra {0} from workspace: {1}, error: {2} ".format(self.ei_mon_spectra[0],monitor_ws.getName(), err) + raise + #------------------------------------------------ # Calculate the incident energy ei,mon1_peak,mon1_index,tzero = \