Commit 0f0f1c99 authored by Jerome Carnis's avatar Jerome Carnis 🦊
Browse files

deviceEigerP11.py: add logging and remove hard-coded value

parent 58089e5e
...@@ -171,12 +171,17 @@ class DeviceTangoEigerDetector(DeviceTango): ...@@ -171,12 +171,17 @@ class DeviceTangoEigerDetector(DeviceTango):
) )
converted_exposure = self.detector.to_device_unit("FrameTime", Exposure) converted_exposure = self.detector.to_device_unit("FrameTime", Exposure)
frame_time = ( min_frame_time = (1 / MAX_ACQUISITION_RATE).to(
10e-3 self.get_value("FrameTime", key=UNIT)
if converted_exposure
< (1 / MAX_ACQUISITION_RATE).to(self.get_value("FrameTime", key=UNIT))
else float(converted_exposure.m)
) )
if converted_exposure < min_frame_time:
self.logger.error(
f"Can't acquire data faster than {MAX_ACQUISITION_RATE}, "
"defaulting to it"
)
frame_time = min_frame_time.m
else:
frame_time = float(converted_exposure.m)
self.set_attribute(["TriggerMode", VALUE], TriggerMode.INTS.value) self.set_attribute(["TriggerMode", VALUE], TriggerMode.INTS.value)
self.set_attribute(["FrameTime", VALUE], frame_time) self.set_attribute(["FrameTime", VALUE], frame_time)
...@@ -213,12 +218,17 @@ class DeviceTangoEigerDetector(DeviceTango): ...@@ -213,12 +218,17 @@ class DeviceTangoEigerDetector(DeviceTango):
) )
converted_exposure = self.detector.to_device_unit("FrameTime", Exposure) converted_exposure = self.detector.to_device_unit("FrameTime", Exposure)
frame_time = ( min_frame_time = (1 / MAX_ACQUISITION_RATE).to(
10e-3 self.get_value("FrameTime", key=UNIT)
if converted_exposure
< (1 / MAX_ACQUISITION_RATE).to(self.get_value("FrameTime", key=UNIT))
else float(converted_exposure.m)
) )
if converted_exposure < min_frame_time:
self.logger.error(
f"Can't acquire data faster than {MAX_ACQUISITION_RATE}, "
"defaulting to it"
)
frame_time = min_frame_time.m
else:
frame_time = float(converted_exposure.m)
self.set_attribute(["FrameTime", VALUE], frame_time) self.set_attribute(["FrameTime", VALUE], frame_time)
self.set_attribute(["CountTime", VALUE], float(converted_exposure.m)) self.set_attribute(["CountTime", VALUE], float(converted_exposure.m))
...@@ -416,14 +426,17 @@ class EigerSwScanner(DeviceScanner): ...@@ -416,14 +426,17 @@ class EigerSwScanner(DeviceScanner):
converted_exposure = units.Quantity(params["Exposure"]).to( converted_exposure = units.Quantity(params["Exposure"]).to(
self.detector.get_value("FrameTime", key=UNIT) self.detector.get_value("FrameTime", key=UNIT)
) )
frame_time = ( min_frame_time = (1 / MAX_ACQUISITION_RATE).to(
10e-3 self.get_value("FrameTime", key=UNIT)
if converted_exposure
< (1 / MAX_ACQUISITION_RATE).to(
self.detector.get_value("FrameTime", key=UNIT)
)
else float(converted_exposure.m)
) )
if converted_exposure < min_frame_time:
self.logger.error(
f"Can't acquire data faster than {MAX_ACQUISITION_RATE}, "
"defaulting to it"
)
frame_time = min_frame_time.m
else:
frame_time = float(converted_exposure.m)
self.detector.set_attribute(["FrameTime", VALUE], frame_time) self.detector.set_attribute(["FrameTime", VALUE], frame_time)
self.detector.set_attribute(["CountTime", VALUE], float(converted_exposure.m)) self.detector.set_attribute(["CountTime", VALUE], float(converted_exposure.m))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment