From 8c3861c984147e13ef54f7b4899fcfff655be14a Mon Sep 17 00:00:00 2001 From: halvorhv Date: Wed, 31 Aug 2022 20:36:31 +0200 Subject: [PATCH] Fixed split_scan_data for trans data w/o roi --- nafuma/xanes/io.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/nafuma/xanes/io.py b/nafuma/xanes/io.py index 4b98727..3311746 100644 --- a/nafuma/xanes/io.py +++ b/nafuma/xanes/io.py @@ -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. 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 = { '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 'active_roi': None, '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) @@ -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 options['skip_if_no_roi']: + if options['log']: + aux.write_log(message='... ... Did not find fluoresence data. Skipping...', options=options) + continue if options['log']: - aux.write_log(message='... ... Did not find fluoresence data. Skipping...', options=options) + aux.write_log(message='... ... Did not find fluoresence data, but still proceeding ...', options=options) - continue +