Skip to content

Commit

Permalink
refs #9438 Better diagnostics
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
abuts authored and KarlPalmen committed May 30, 2014
1 parent 784ee66 commit 90f54b5
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Code/Mantid/scripts/Inelastic/DirectEnergyConversion.py
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand All @@ -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,
Expand Down Expand Up @@ -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 = \
Expand Down

0 comments on commit 90f54b5

Please sign in to comment.