Skip to content

Commit

Permalink
Set parameters like dodal
Browse files Browse the repository at this point in the history
  • Loading branch information
shihab-dls committed Jan 21, 2025
1 parent 5ad3387 commit 0d78b66
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/ophyd_async/epics/eiger/_eiger.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,31 @@ def __init__(

@AsyncStatus.wrap
async def prepare(self, value: EigerTriggerInfo) -> None: # type: ignore
self.detector_params = value
self.set_detector_parameters(value)
await self._controller.set_energy(value.energy_ev)
await super().prepare(value)

def set_detector_parameters(self, detector_params: EigerTriggerInfo):
self.detector_params = detector_params
if self.detector_params is None:
raise ValueError("Parameters for scan must be specified")

to_check = [
(
self.detector_params.detector_size_constants is None,
"Detector Size must be set",
),
(
self.detector_params.beam_xy_converter is None,
"Beam converter must be set",
),
]

errors = [message for check_result, message in to_check if check_result]

if errors:
raise Exception("\n".join(errors))

@AsyncStatus.wrap
async def set_mx_settings_pvs(self) -> None:
if not self.detector_params:
Expand Down

0 comments on commit 0d78b66

Please sign in to comment.