|
1 | | -from ophyd_async.core import ( |
2 | | - StandardReadable, |
3 | | -) |
| 1 | +from ophyd_async.core import StandardReadable, StrictEnum |
4 | 2 | from ophyd_async.epics.core import epics_signal_r |
5 | 3 |
|
| 4 | +from dodal.devices.positioner import create_positioner |
| 5 | + |
| 6 | + |
| 7 | +class FilterAValues(StrictEnum): |
| 8 | + """Maps from a short usable name to the string name in EPICS""" |
| 9 | + |
| 10 | + AL_2MM = "2 mm Al" |
| 11 | + AL_1_5MM = "1.5 mm Al" |
| 12 | + AL_1_25MM = "1.25 mm Al" |
| 13 | + AL_0_8MM = "0.8 mm Al" |
| 14 | + AL_0_55MM = "0.55 mm Al" |
| 15 | + AL_0_5MM = "0.5 mm Al" |
| 16 | + AL_0_3MM = "0.3 mm Al" |
| 17 | + AL_0_25MM = "0.25 mm Al" |
| 18 | + AL_0_15MM = "0.15 mm Al" |
| 19 | + AL_0_1MM = "0.1 mm Al" |
| 20 | + AL_0_05MM = "0.05 mm Al" |
| 21 | + AL_0_025MM = "0.025 mm Al" |
| 22 | + AL_GAP = "Gap" |
| 23 | + |
| 24 | + |
| 25 | +class FilterBValues(StrictEnum): |
| 26 | + DIAMOND_THIN = "Diamond thin" |
| 27 | + DIAMOND_THICK = "Diamond thick" |
| 28 | + NI_DRAIN = "ni drain" |
| 29 | + AU_DRAIN = "au drain" |
| 30 | + AL_DRAIN = "al drain" |
| 31 | + GAP = "Gap" |
| 32 | + IN_LINE_DIODE = "in line diode" |
| 33 | + |
6 | 34 |
|
7 | 35 | class Diode(StandardReadable): |
8 | 36 | def __init__( |
9 | 37 | self, |
10 | 38 | prefix: str, |
11 | 39 | name: str = "", |
12 | 40 | ): |
13 | | - self._prefix = prefix |
14 | 41 | with self.add_children_as_readables(): |
15 | 42 | self.signal = epics_signal_r(float, prefix + "B:DIODE:I") |
| 43 | + self.positioner_a = create_positioner( |
| 44 | + FilterAValues, prefix + "A:MP", positioner_pv_suffix=":SELECT" |
| 45 | + ) # more complex, will be fixed on Tuesday 20.05.2025 |
| 46 | + self.positioner_b = create_positioner( |
| 47 | + FilterBValues, prefix + "B:MP", positioner_pv_suffix=":SELECT" |
| 48 | + ) |
16 | 49 |
|
17 | 50 | super().__init__(name=name) |
0 commit comments