Skip to content

Commit

Permalink
refs #6667 Should fix the issue when abs units files are requested
Browse files Browse the repository at this point in the history
for arb units run
  • Loading branch information
abuts committed Jul 10, 2013
1 parent 19705bd commit 6d3e1ed
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 20 deletions.
48 changes: 29 additions & 19 deletions Code/Mantid/scripts/Inelastic/DirectEnergyConversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,8 @@ def initialise(self, instr_name,reload_instrument=False):
'diag_bleed_test','diag_bleed_pixels','diag_bleed_maxrate','diag_hard_mask_file','diag_use_hard_mask_only','diag_background_test_range']

# before starting long run, makes sence to verify if all files requested for the run are in fact availible. Here we specify the properties which describe files
self.__file_properties = ['det_cal_file','map_file','hard_mask_file','monovan_mapfile']
self.__file_properties = ['det_cal_file','map_file','hard_mask_file']
self.__abs_norm_file_properties = ['monovan_mapfile']

self.__normalization_methods=['none','monitor-1','current'] # 'monitor-2','uamph', peak -- disabled/unknown at the moment

Expand Down Expand Up @@ -1307,28 +1308,37 @@ def make_ckpt_name(*argi) :
"""
return ''.join(str(arg) for arg in argi if arg is not None)

def check_necessary_files(self):
def check_necessary_files(self,monovan_run):
""" Method verifies if all files necessary for a run are availible.
usefull for long runs to check if all files necessary for it are present/accessible
"""
file_missing = False
for prop in self.__file_properties :
file = getattr(self,prop)
if not (file is None) and isinstance(file,str):
file_path = FileFinder.getFullPath(file)
if len(file_path) == 0:
# it still can be run number
try:
file_path = common.find_file(file)
except:
file_path=''

if len(file_path)==0:
self.log(" Can not find file ""{0}"" for property: {1} ".format(file,prop),'error')
file_missing=True

if file_missing:

def check_files_list(files_list):
file_missing = False
for prop in files_list :
file = getattr(self,prop)
if not (file is None) and isinstance(file,str):
file_path = FileFinder.getFullPath(file)
if len(file_path) == 0:
# it still can be run number
try:
file_path = common.find_file(file)
except:
file_path=''

if len(file_path)==0:
self.log(" Can not find file ""{0}"" for property: {1} ".format(file,prop),'error')
file_missing=True

return file_missing

base_file_missing = check_files_list(self.__file_properties)
abs_file_missing=False
if not (monovan_run is None):
abs_file_missing = check_files_list(self.__abs_norm_file_properties)

if base_file_missing or abs_file_missing:
raise RuntimeError(" Files needed for the run are missing ")


Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/scripts/Inelastic/dgreduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def arb_units(wb_run,sample_run,ei_guess,rebin,map_file='default',monovan_run=No
return

# check if reducer can find all non-run files necessary for the reduction before starting long run.
Reducer.check_necessary_files();
Reducer.check_necessary_files(monovan_run);

print 'Output will be normalised to', Reducer.normalise_method
if (numpy.size(sample_run)) > 1 and Reducer.sum_runs:
Expand Down

0 comments on commit 6d3e1ed

Please sign in to comment.