From a947e065b2fc7aeef5d37276859af34f3c445157 Mon Sep 17 00:00:00 2001 From: Gustavo de Souza dos Reis Date: Thu, 22 Jan 2026 09:45:44 -0300 Subject: [PATCH] ABPM.ENH: add method for getting the BPM virtual slot. This enables backwards compatibility with the old constants table, but the class needs to be updated for the new table. --- siriuspy/siriuspy/search/rabpm_search.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/siriuspy/siriuspy/search/rabpm_search.py b/siriuspy/siriuspy/search/rabpm_search.py index 17c4f054f..9c543c236 100644 --- a/siriuspy/siriuspy/search/rabpm_search.py +++ b/siriuspy/siriuspy/search/rabpm_search.py @@ -100,6 +100,18 @@ def conv_devname_2_slot(cls, name): cls._get_data() return cls._mapping[name]["slot"] + @classmethod + def conv_devname_2_vslot(cls, name): + """Return the virtual slot of the given device name. + + Parameters + ---------- + names : string + Desired device name. + """ + cls._get_data() + return cls._mapping[name]["virtual_slot"] + @classmethod def conv_devname_2_cratename(cls, name): """Return the crate name of the given device name. @@ -174,9 +186,17 @@ def _build_mapping(cls): crate_num = crate[-2:] crate_name = ('IA-20RaBPMTL' if int(crate_num) == 21 else f'IA-{crate_num}RaBPM') + mapping[dev] = { - "slot": int(slot), "crate_name": crate_name, "crate_number": int(crate_num)} + + if not slot.isnumeric(): + slot, v_slot = slot.split('-') + mapping[dev]["virtual_slot"] = int(v_slot) + else: + mapping[dev]["virtual_slot"] = None + mapping[dev]["slot"] = int(slot) + cls._mapping = mapping cls._names = sorted(cls._mapping.keys())