-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy path_eiger.py
42 lines (32 loc) · 1.11 KB
/
_eiger.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from pydantic import Field
from ophyd_async.core import AsyncStatus, PathProvider, StandardDetector, TriggerInfo
from ._eiger_controller import EigerController
from ._eiger_io import EigerDriverIO
from ._odin_io import Odin, OdinWriter
class EigerTriggerInfo(TriggerInfo):
energy_ev: float = Field(gt=0)
class EigerDetector(StandardDetector):
"""
Ophyd-async implementation of an Eiger Detector.
"""
_controller: EigerController
_writer: Odin
def __init__(
self,
prefix: str,
path_provider: PathProvider,
drv_suffix="-EA-EIGER-01:",
hdf_suffix="-EA-ODIN-01:",
name="",
):
self.drv = EigerDriverIO(prefix + drv_suffix)
self.odin = Odin(prefix + hdf_suffix + "FP:")
super().__init__(
EigerController(self.drv),
OdinWriter(path_provider, lambda: self.name, self.odin),
name=name,
)
@AsyncStatus.wrap
async def prepare(self, value: EigerTriggerInfo) -> None: # type: ignore
await self._controller.set_energy(value.energy_ev)
await super().prepare(value)