Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion siriuspy/siriuspy/search/rabpm_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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())
Loading