diff --git a/src/toolbox_scs/mnemonics_machinery.py b/src/toolbox_scs/mnemonics_machinery.py index 10a42d9f4ba896f00eec407071d772956febf591..f149366f0b6a530df05b5bb9f6c8ebb77ce0af48 100644 --- a/src/toolbox_scs/mnemonics_machinery.py +++ b/src/toolbox_scs/mnemonics_machinery.py @@ -98,7 +98,7 @@ def mnemonics_to_process(mnemo_list, merge_with, detector, func=None): merge_with: xarray Dataset Dataset that may contain non-processed arrays detector: str - One in {'ADQ412', 'FastADC', 'XGM', 'BAM', 'PES'} + One in {'ADQ412', 'FastADC', 'FastADC2', 'XGM', 'BAM', 'PES'} func: function function that takes one argument, an unprocessed mnemonic string, and converts it into a processed one, i.e. from 'MCP2apd' to @@ -112,7 +112,9 @@ def mnemonics_to_process(mnemo_list, merge_with, detector, func=None): if func is None: def func(x): return x - + det_list = ['ADQ412', 'FastADC', 'FastADC2', 'XGM', 'BAM', 'PES'] + if detector not in det_list: + raise ValueError(f"Detector not supported. Expecting one in {det_list}") if detector == 'BAM': det_mnemos = [m for m in _mnemonics if 'BAM' in m] default_mnemo = 'BAM1932M' @@ -130,9 +132,14 @@ def mnemonics_to_process(mnemo_list, merge_with, detector, func=None): default_mnemo = 'MCP2apd' default_processed = 'MCP2peaks' if detector == 'FastADC': - det_mnemos = [m for m in _mnemonics if 'FastADC' in m] + det_mnemos = [m for m in _mnemonics if 'FastADC' in m\ + and 'FastADC2_' not in m] default_mnemo = 'FastADC5raw' default_processed = 'FastADC5peaks' + if detector == 'FastADC2': + det_mnemos = [m for m in _mnemonics if 'FastADC2_' in m] + default_mnemo = 'FastADC2_5raw' + default_processed = 'FastADC2_5peaks' if detector == 'PES': det_mnemos = [m for m in _mnemonics if 'PES' in m and 'raw' in m] default_mnemo = 'PES_W_raw'