refactor: addressed comments from review; fixed docstring; add DeviceClassInitError

This commit is contained in:
appel_c 2023-11-07 19:55:43 +01:00
parent 8a19ce1508
commit bda859e93d
2 changed files with 21 additions and 3 deletions

View File

@ -38,6 +38,13 @@ class EigerTimeoutError(EigerError):
pass
class DeviceClassInitError(EigerError):
"""Raised when initiation of the device class fails,
due to missing device manager or not started in sim_mode."""
pass
class SLSDetectorCam(Device):
"""SLS Detector Camera - Eiger 9M
@ -134,7 +141,7 @@ class Eiger9McSAXS(DetectorBase):
**kwargs,
)
if device_manager is None and not sim_mode:
raise Exception(
raise DeviceClassInitError(
f"No device manager for device: {name}, and not started sim_mode: {sim_mode}. Add DeviceManager to initialization or init with sim_mode=True"
)
self.sim_mode = sim_mode

View File

@ -37,6 +37,13 @@ class PilatusTimeoutError(PilatusError):
pass
class DeviceClassInitError(PilatusError):
"""Raised when initiation of the device class fails,
due to missing device manager or not started in sim_mode."""
pass
class TriggerSource(enum.IntEnum):
INTERNAL = 0
EXT_ENABLE = 1
@ -127,7 +134,7 @@ class PilatuscSAXS(DetectorBase):
**kwargs,
)
if device_manager is None and not sim_mode:
raise Exception(
raise DeviceClassInitError(
f"No device manager for device: {name}, and not started sim_mode: {sim_mode}. Add DeviceManager to initialization or init with sim_mode=True"
)
self.sim_mode = sim_mode
@ -416,7 +423,11 @@ class PilatuscSAXS(DetectorBase):
# TODO might be useful for base class
def pre_scan(self) -> None:
""" " Pre_scan gets executed right before"""
"""Pre_scan is an (optional) function that is executed by BEC just before the scan core
For the pilatus detector, it is used to arm the detector for the acquisition,
because the detector times out after ˜7-8seconds without seeing a trigger.
"""
self._arm_acquisition()
def _arm_acquisition(self) -> None: