From b625028f661344bd29d35d088180a8d5befd1ce9 Mon Sep 17 00:00:00 2001 From: Laurent Mercadier <laurent.mercadier@xfel.eu> Date: Fri, 3 Sep 2021 07:38:08 +0200 Subject: [PATCH] Use run value of Beckhoff outputs to determine gas type --- src/toolbox_scs/constants.py | 8 ++++---- src/toolbox_scs/detectors/pes.py | 11 +++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/toolbox_scs/constants.py b/src/toolbox_scs/constants.py index b2b1616..4bc7f97 100644 --- a/src/toolbox_scs/constants.py +++ b/src/toolbox_scs/constants.py @@ -135,16 +135,16 @@ mnemonics = { 'key': 'u213.value', 'dim': None},), "PES_N2": ({'source': 'SA3_XTD10_PES/DCTRL/V30300S_NITROGEN', - 'key': 'interlock.AActionState.value', + 'key': 'hardwareState.value', 'dim': None},), "PES_Ne": ({'source': 'SA3_XTD10_PES/DCTRL/V30310S_NEON', - 'key': 'interlock.AActionState.value', + 'key': 'hardwareState.value', 'dim': None},), "PES_Kr": ({'source': 'SA3_XTD10_PES/DCTRL/V30320S_KRYPTON', - 'key': 'interlock.AActionState.value', + 'key': 'hardwareState.value', 'dim': None},), "PES_Xe": ({'source': 'SA3_XTD10_PES/DCTRL/V30330S_XENON', - 'key': 'interlock.AActionState.value', + 'key': 'hardwareState.value', 'dim': None},), # XTD10 MCP (after GATT) diff --git a/src/toolbox_scs/detectors/pes.py b/src/toolbox_scs/detectors/pes.py index e1bc70b..07d1fd8 100644 --- a/src/toolbox_scs/detectors/pes.py +++ b/src/toolbox_scs/detectors/pes.py @@ -14,7 +14,7 @@ import extra_data as ed from ..misc.bunch_pattern_external import is_sase_3 from ..mnemonics_machinery import (mnemonics_to_process, mnemonics_for_run) - +from ..constants import mnemonics as _mnemonics __all__ = [ 'get_pes_params', @@ -169,10 +169,13 @@ def get_pes_params(run): params = {} sel = run.select_trains(ed.by_index[:20]) mnemonics = mnemonics_for_run(run) - for gas in ['N2', 'Ne', 'Kr', 'Xe']: - arr = sel.get_array(*mnemonics[f'PES_{gas}'].values()) - if arr[0] == 0: + gas_dict = {'N2': 409.9, 'Ne': 870.2, 'Kr': 1921, 'Xe': 1148.7} + for gas in gas_dict.keys(): + mnemo = _mnemonics[f'PES_{gas}'][0] + arr = sel.get_run_value(mnemo['source'], mnemo['key']) + if arr == 'ON': params['gas'] = gas + params['binding_energy'] = gas_dict[gas] break if 'gas' not in params: params['gas'] = 'unknown' -- GitLab