mirror of
https://github.com/bec-project/ophyd_devices.git
synced 2025-07-09 18:28:03 +02:00
fix: fixed MIN_readout, and made it a class attribute with set/get functions
This commit is contained in:
@ -57,9 +57,9 @@ class Eiger9MSetup(CustomDetectorMixin):
|
|||||||
readout_time = (
|
readout_time = (
|
||||||
self.parent.scaninfo.readout_time
|
self.parent.scaninfo.readout_time
|
||||||
if hasattr(self.parent.scaninfo, "readout_time")
|
if hasattr(self.parent.scaninfo, "readout_time")
|
||||||
else self.parent.readout_time_min
|
else self.parent.get_min_readout()
|
||||||
)
|
)
|
||||||
self.parent.readout_time = max(readout_time, self.parent.readout_time_min)
|
self.parent.readout_time = max(readout_time, self.parent.get_min_readout())
|
||||||
|
|
||||||
def initialize_detector(self) -> None:
|
def initialize_detector(self) -> None:
|
||||||
"""Initialize detector"""
|
"""Initialize detector"""
|
||||||
@ -399,9 +399,12 @@ class Eiger9McSAXS(PSIDetectorBase):
|
|||||||
"describe",
|
"describe",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# specify Setup class
|
||||||
custom_prepare_cls = Eiger9MSetup
|
custom_prepare_cls = Eiger9MSetup
|
||||||
|
# specify minimum readout time for detector
|
||||||
|
PSIDetectorBase.set_min_readout(3e-3)
|
||||||
|
# specify class attributes
|
||||||
cam = ADCpt(SLSDetectorCam, "cam1:")
|
cam = ADCpt(SLSDetectorCam, "cam1:")
|
||||||
MIN_READOUT = 3e-3
|
|
||||||
|
|
||||||
def set_trigger(self, trigger_source: TriggerSource) -> None:
|
def set_trigger(self, trigger_source: TriggerSource) -> None:
|
||||||
"""Set trigger source for the detector.
|
"""Set trigger source for the detector.
|
||||||
|
@ -125,9 +125,9 @@ class FalconSetup(CustomDetectorMixin):
|
|||||||
readout_time = (
|
readout_time = (
|
||||||
self.parent.scaninfo.readout_time
|
self.parent.scaninfo.readout_time
|
||||||
if hasattr(self.parent.scaninfo, "readout_time")
|
if hasattr(self.parent.scaninfo, "readout_time")
|
||||||
else self.parent.readout_time_min
|
else self.parent.get_min_readout()
|
||||||
)
|
)
|
||||||
self.parent.readout_time = max(readout_time, self.parent.readout_time_min)
|
self.parent.readout_time = max(readout_time, self.parent.get_min_readout())
|
||||||
|
|
||||||
def initialize_detector(self) -> None:
|
def initialize_detector(self) -> None:
|
||||||
"""
|
"""
|
||||||
@ -320,9 +320,12 @@ class FalconcSAXS(PSIDetectorBase):
|
|||||||
"describe",
|
"describe",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# specify Setup class
|
||||||
custom_prepare_cls = FalconSetup
|
custom_prepare_cls = FalconSetup
|
||||||
MIN_READOUT = 3e-3
|
# specify minimum readout time for detector
|
||||||
|
PSIDetectorBase.set_min_readout(3e-3)
|
||||||
|
|
||||||
|
# specify class attributes
|
||||||
dxp = Cpt(EpicsDXPFalcon, "dxp1:")
|
dxp = Cpt(EpicsDXPFalcon, "dxp1:")
|
||||||
mca = Cpt(EpicsMCARecord, "mca1")
|
mca = Cpt(EpicsMCARecord, "mca1")
|
||||||
hdf5 = Cpt(FalconHDF5Plugins, "HDF1:")
|
hdf5 = Cpt(FalconHDF5Plugins, "HDF1:")
|
||||||
|
@ -86,9 +86,9 @@ class PilatusSetup(CustomDetectorMixin):
|
|||||||
readout_time = (
|
readout_time = (
|
||||||
self.parent.scaninfo.readout_time
|
self.parent.scaninfo.readout_time
|
||||||
if hasattr(self.parent.scaninfo, "readout_time")
|
if hasattr(self.parent.scaninfo, "readout_time")
|
||||||
else self.parent.readout_time_min
|
else self.parent.get_min_readout()
|
||||||
)
|
)
|
||||||
self.parent.readout_time = max(readout_time, self.parent.readout_time_min)
|
self.parent.readout_time = max(readout_time, self.parent.get_min_readout())
|
||||||
|
|
||||||
def initialize_detector(self) -> None:
|
def initialize_detector(self) -> None:
|
||||||
"""Initialize detector"""
|
"""Initialize detector"""
|
||||||
@ -410,9 +410,13 @@ class PilatuscSAXS(PSIDetectorBase):
|
|||||||
USER_ACCESS = [
|
USER_ACCESS = [
|
||||||
"describe",
|
"describe",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# specify Setup class
|
||||||
custom_prepare_cls = PilatusSetup
|
custom_prepare_cls = PilatusSetup
|
||||||
|
# specify minimum readout time for detector
|
||||||
|
PSIDetectorBase.set_min_readout(3e-3)
|
||||||
|
# specify class attributes
|
||||||
cam = ADCpt(SLSDetectorCam, "cam1:")
|
cam = ADCpt(SLSDetectorCam, "cam1:")
|
||||||
MIN_READOUT = 3e-3
|
|
||||||
|
|
||||||
def set_trigger(self, trigger_source: TriggerSource) -> None:
|
def set_trigger(self, trigger_source: TriggerSource) -> None:
|
||||||
"""Set trigger source for the detector"""
|
"""Set trigger source for the detector"""
|
||||||
|
@ -22,10 +22,23 @@ class DetectorInitError(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
MIN_READOUT = 3e-3
|
# MIN_READOUT = 3e-3
|
||||||
|
|
||||||
|
|
||||||
class CustomDetectorMixin:
|
class CustomDetectorMixin:
|
||||||
|
"""
|
||||||
|
Mixin class for custom detector logic
|
||||||
|
|
||||||
|
This class is used to implement BL specific logic for the detector.
|
||||||
|
It is used in the PSIDetectorBase class.
|
||||||
|
|
||||||
|
For the integration of a new detector, the following functions should
|
||||||
|
help with integrating functionality, but additional ones can be added.
|
||||||
|
|
||||||
|
Check PSIDetectorBase for the functions that are called during relevant function calls of
|
||||||
|
stage, unstage, trigger, stop and _init.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, parent: Device = None, *args, **kwargs) -> None:
|
def __init__(self, parent: Device = None, *args, **kwargs) -> None:
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
|
||||||
@ -186,7 +199,15 @@ class PSIDetectorBase(Device):
|
|||||||
|
|
||||||
custom_prepare_cls = CustomDetectorMixin
|
custom_prepare_cls = CustomDetectorMixin
|
||||||
|
|
||||||
MIN_READOUT = 3e-3
|
_MIN_READOUT = 1e-3
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_min_readout(cls):
|
||||||
|
return cls._MIN_READOUT
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def set_min_readout(cls, value):
|
||||||
|
cls._MIN_READOUT = value
|
||||||
|
|
||||||
# Specify which functions are revealed to the user in BEC client
|
# Specify which functions are revealed to the user in BEC client
|
||||||
USER_ACCESS = [
|
USER_ACCESS = [
|
||||||
@ -229,7 +250,6 @@ class PSIDetectorBase(Device):
|
|||||||
self.std_client = None
|
self.std_client = None
|
||||||
self.scaninfo = None
|
self.scaninfo = None
|
||||||
self.filewriter = None
|
self.filewriter = None
|
||||||
self.readout_time_min = MIN_READOUT
|
|
||||||
self.timeout = 5
|
self.timeout = 5
|
||||||
self.wait_for_connection(all_signals=True)
|
self.wait_for_connection(all_signals=True)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user