refactor: eiger, add documentation for stage
This commit is contained in:
parent
e6d05c9d02
commit
cbeb679478
@ -1,6 +1,7 @@
|
|||||||
import enum
|
import enum
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
from bec_lib.core.devicemanager import DeviceStatus
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -229,24 +230,24 @@ class Eiger9mCsaxs(DetectorBase):
|
|||||||
# TODO function for abstract class?
|
# TODO function for abstract class?
|
||||||
def stage(self) -> List[object]:
|
def stage(self) -> List[object]:
|
||||||
"""Stage command, called from BEC in preparation of a scan.
|
"""Stage command, called from BEC in preparation of a scan.
|
||||||
The device needs to return with a state once it is ready to start the scan!
|
This will iniate the preparation of detector and file writer.
|
||||||
|
The following functuions are called:
|
||||||
|
- _prep_file_writer
|
||||||
|
- _prep_det
|
||||||
|
- _publish_file_location
|
||||||
|
- _arm_acquisition
|
||||||
|
The device returns a List[object] from the Ophyd Device class.
|
||||||
"""
|
"""
|
||||||
# Set parameters for scan interuption and if acquisition is done
|
|
||||||
self._stopped = False
|
self._stopped = False
|
||||||
# Get parameters for scan
|
|
||||||
self.scaninfo.load_scan_metadata()
|
self.scaninfo.load_scan_metadata()
|
||||||
self.mokev = self.device_manager.devices.mokev.obj.read()[
|
self.mokev = self.device_manager.devices.mokev.obj.read()[
|
||||||
self.device_manager.devices.mokev.name
|
self.device_manager.devices.mokev.name
|
||||||
]["value"]
|
]["value"]
|
||||||
# Prepare file writer and detector
|
|
||||||
# TODO refactor logger.info to DEBUG mode?
|
# TODO refactor logger.info to DEBUG mode?
|
||||||
# logger.info("Waiting for std daq to be armed")
|
|
||||||
self._prep_file_writer()
|
self._prep_file_writer()
|
||||||
# logger.info("std_daq is ready")
|
|
||||||
self._prep_det()
|
self._prep_det()
|
||||||
# logger.info("Eiger9m is ready")
|
|
||||||
self._publish_file_location()
|
self._publish_file_location()
|
||||||
self.arm_acquisition()
|
self._arm_acquisition()
|
||||||
# TODO Fix should take place in EPICS or directly on the hardware!
|
# TODO Fix should take place in EPICS or directly on the hardware!
|
||||||
# We observed that the detector missed triggers in the beginning in case BEC was to fast. Adding 50ms delay solved this
|
# We observed that the detector missed triggers in the beginning in case BEC was to fast. Adding 50ms delay solved this
|
||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
@ -343,7 +344,7 @@ class Eiger9mCsaxs(DetectorBase):
|
|||||||
msg.dumps(),
|
msg.dumps(),
|
||||||
)
|
)
|
||||||
|
|
||||||
def arm_acquisition(self) -> None:
|
def _arm_acquisition(self) -> None:
|
||||||
"""Arm detector for acquisition"""
|
"""Arm detector for acquisition"""
|
||||||
self.cam.acquire.put(1)
|
self.cam.acquire.put(1)
|
||||||
logger.info("Waiting for Eiger9m to be armed")
|
logger.info("Waiting for Eiger9m to be armed")
|
||||||
@ -357,11 +358,16 @@ class Eiger9mCsaxs(DetectorBase):
|
|||||||
time.sleep(0.005)
|
time.sleep(0.005)
|
||||||
logger.info("Eiger9m is armed")
|
logger.info("Eiger9m is armed")
|
||||||
|
|
||||||
# TODO is this correct? -> for hardware triggering, nothing should happen upon trigger signal
|
# TODO function for abstract class?
|
||||||
# Comment this otherwise!
|
|
||||||
def trigger(self) -> DeviceStatus:
|
def trigger(self) -> DeviceStatus:
|
||||||
|
"""Trigger the detector, called from BEC."""
|
||||||
|
self.on_trigger()
|
||||||
return super().trigger()
|
return super().trigger()
|
||||||
|
|
||||||
|
def on_trigger(self):
|
||||||
|
"""Specify action that should be taken upon trigger signal."""
|
||||||
|
pass
|
||||||
|
|
||||||
# TODO threadlocked needed? if yes why only for the eiger9m?
|
# TODO threadlocked needed? if yes why only for the eiger9m?
|
||||||
@threadlocked
|
@threadlocked
|
||||||
def unstage(self) -> List[object]:
|
def unstage(self) -> List[object]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user