Skip to content

Commit

Permalink
refs #9135 Work with monitors loaded separately.
Browse files Browse the repository at this point in the history
  • Loading branch information
abuts committed Mar 6, 2014
1 parent 9d72061 commit 7e891fd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Code/Mantid/scripts/Inelastic/CommonFunctions.py
Expand Up @@ -132,12 +132,16 @@ def load_run(inst_name, run_number, calibration=None, force=False):

args={};
ext = os.path.splitext(filename)[1].lower();
wrong_monitors_name = False;
if ext.endswith("raw"):
args['LoadMonitors']='Separate'
wrong_monitors_name = True
elif ext.endswith('nxs'):
args['LoadMonitors'] = '1'

loaded_ws = Load(Filename=filename, OutputWorkspace=output_name,**args)
if wrong_monitors_name:
RenameWorkspace(InputWorkspace=output_name+'_Monitors',OutputWorkspace=output_name+'_monitors');
if isinstance(loaded_ws,tuple) and len(loaded_ws)>1:
mon_ws = loaded_ws[1];
loaded_ws=loaded_ws[0];
Expand Down
15 changes: 11 additions & 4 deletions Code/Mantid/scripts/Inelastic/DirectEnergyConversion.py
Expand Up @@ -556,10 +556,11 @@ def get_ei(self, input_ws, resultws_name, ei_guess):
if type(monitor_ws) is str:
monitor_ws = mtd[monitor_ws]
try:
nsp = monitor_ws.getSpectrum(int(self.ei_mon_spectra[0]));
# check if the spectra with correspondent number is present in the worksace
nsp = monitor_ws.getIndexFromSpectrumNumber(int(self.ei_mon_spectra[0]));
except:
monitors_from_separate_ws = True
mon_ws = monitor_ws.getName()+'_Monitors'
mon_ws = monitor_ws.getName()+'_monitors'
monitor_ws = mtd[mon_ws];
#-------------------------------------------------------------

Expand Down Expand Up @@ -618,8 +619,14 @@ def normalise(self, data_ws, result_name, method, range_offset=0.0,mon_number=No
mon_spectr_num=int(self.mon1_norm_spec)
else:
mon_spectr_num=mon_number
NormaliseToMonitor(InputWorkspace=data_ws, OutputWorkspace=result_name, MonitorSpectrum=mon_spectr_num,
IntegrationRangeMin=float(str(range_min)), IntegrationRangeMax=float(str(range_max)),IncludePartialBins=True)

monWS_name = data_ws.getName()+'_monitors'
if monWS_name in mtd:
NormaliseToMonitor(InputWorkspace=data_ws, OutputWorkspace=result_name, MonitorWorkspace=monWS_name,
IntegrationRangeMin=float(str(range_min)), IntegrationRangeMax=float(str(range_max)),IncludePartialBins=True)
else:
NormaliseToMonitor(InputWorkspace=data_ws, OutputWorkspace=result_name, MonitorSpectrum=mon_spectr_num,
IntegrationRangeMin=float(str(range_min)), IntegrationRangeMax=float(str(range_max)),IncludePartialBins=True)
output = mtd[result_name]
elif method == 'current':
NormaliseByCurrent(InputWorkspace=data_ws, OutputWorkspace=result_name)
Expand Down

0 comments on commit 7e891fd

Please sign in to comment.