Fixed split_scan_data for trans data w/o roi

This commit is contained in:
halvorhv 2022-08-31 20:36:31 +02:00
parent 9ed675b8cb
commit 8c3861c984

View file

@ -10,7 +10,7 @@ def split_scan_data(data: dict, options={}) -> list:
''' Splits a XANES-file from BM31 into different files depending on the edge. Has the option to add intensities of all scans of same edge into the same file. ''' Splits a XANES-file from BM31 into different files depending on the edge. Has the option to add intensities of all scans of same edge into the same file.
As of now only picks out xmap_rois (fluoresence mode) and for Mn, Fe, Co and Ni K-edges.''' As of now only picks out xmap_rois (fluoresence mode) and for Mn, Fe, Co and Ni K-edges.'''
required_options = ['log', 'logfile', 'save', 'save_folder', 'replace', 'active_roi', 'add_rois', 'return'] required_options = ['log', 'logfile', 'save', 'save_folder', 'replace', 'active_roi', 'add_rois', 'return', 'skip_if_no_roi']
default_options = { default_options = {
'log': False, 'log': False,
@ -20,7 +20,8 @@ def split_scan_data(data: dict, options={}) -> list:
'replace': False, # whether to replace the files if they already exist 'replace': False, # whether to replace the files if they already exist
'active_roi': None, 'active_roi': None,
'add_rois': False, # Whether to add the rois of individual scans of the same edge together 'add_rois': False, # Whether to add the rois of individual scans of the same edge together
'return': True 'return': True,
'skip_if_no_roi': True
} }
options = aux.update_options(options=options, required_options=required_options, default_options=default_options) options = aux.update_options(options=options, required_options=required_options, default_options=default_options)
@ -100,10 +101,14 @@ def split_scan_data(data: dict, options={}) -> list:
if not ('xmap_roi00' in headers[i]) and (not 'xmap_roi01' in headers[i]): if not ('xmap_roi00' in headers[i]) and (not 'xmap_roi01' in headers[i]):
if options['skip_if_no_roi']:
if options['log']: if options['log']:
aux.write_log(message='... ... Did not find fluoresence data. Skipping...', options=options) aux.write_log(message='... ... Did not find fluoresence data. Skipping...', options=options)
continue continue
if options['log']:
aux.write_log(message='... ... Did not find fluoresence data, but still proceeding ...', options=options)