Skip to content

Commit

Permalink
bmp element model reworked for libera bpms
Browse files Browse the repository at this point in the history
  • Loading branch information
Sulimankhail committed Aug 28, 2024
1 parent 0f93f33 commit afe7feb
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions bact_device_models/devices/bpm_elem_libera.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import functools
from dataclasses import dataclass

from typing import Sequence, Union


@dataclass
class BPMElementPosition:
#: in nanometer
x: int
#: in nanometer
y: int


@dataclass
class BPMElementSignalFromButtons:
"""Beam position monitor readings from the buttons
Todo:
find out what the units of these signals are in reality
"""
a: int
b: int
c: int
d: int


@dataclass
class BPMElement:
name: str
pos: BPMElementPosition
sig: Union[BPMElementSignalFromButtons, None]


@dataclass
class BPMElementList:
bpms: Sequence[BPMElement]

def get_eleement(self, name: str) -> BPMElement:
@functools.lru_cache(maxsize=1)
def get_dict():
return {elem.name: elem for elem in self.bpms}

return get_dict()[name]

0 comments on commit afe7feb

Please sign in to comment.