add config signals
This commit is contained in:
@@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from ophyd import ADBase
|
||||
from ophyd import ADBase, EpicsSignalRO
|
||||
from ophyd import ADComponent as ADCpt
|
||||
from ophyd import Component as Cpt
|
||||
from ophyd_devices import PreviewSignal
|
||||
@@ -20,6 +20,16 @@ if TYPE_CHECKING: # pragma: no cover
|
||||
class BaslerCamBase(ADBase):
|
||||
"""BaslerCam Base class."""
|
||||
|
||||
cam_detector_state_string = Cpt(EpicsSignalRO, suffix="cam1:DetectorState_RBV", string=True)
|
||||
|
||||
_default_configuration_attrs = [
|
||||
'cam1.acquire_time',
|
||||
'cam1.detector_state',
|
||||
'cam_detector_state_string',
|
||||
'cam1.gain',
|
||||
'cam1.model',
|
||||
]
|
||||
|
||||
cam1 = ADCpt(AravisDetectorCam, "cam1:")
|
||||
image1 = ADCpt(ImagePlugin_V35, "image1:")
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from ophyd import ADBase
|
||||
from ophyd import ADBase, EpicsSignalRO
|
||||
from ophyd import ADComponent as ADCpt
|
||||
from ophyd import Component as Cpt
|
||||
from ophyd_devices import PreviewSignal
|
||||
@@ -20,6 +20,16 @@ if TYPE_CHECKING: # pragma: no cover
|
||||
class ProsilicaCamBase(ADBase):
|
||||
"""Base class for Prosilica cameras."""
|
||||
|
||||
cam_detector_state_string = Cpt(EpicsSignalRO, suffix="cam1:DetectorState_RBV", string=True)
|
||||
|
||||
_default_configuration_attrs = [
|
||||
'cam1.acquire_time',
|
||||
'cam1.detector_state',
|
||||
'cam_detector_state_string',
|
||||
'cam1.gain',
|
||||
'cam1.model',
|
||||
]
|
||||
|
||||
cam1 = ADCpt(ProsilicaDetectorCam, "cam1:")
|
||||
image1 = ADCpt(ImagePlugin_V35, "image1:")
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@ import enum
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Tuple
|
||||
|
||||
import numpy as np
|
||||
from bec_lib.file_utils import get_full_path
|
||||
from bec_lib.logger import bec_logger
|
||||
from ophyd import Component as Cpt
|
||||
from ophyd import EpicsSignal, Kind
|
||||
from ophyd import EpicsSignal, EpicsSignalRO, Kind
|
||||
from ophyd.areadetector.cam import ADBase, PilatusDetectorCam
|
||||
from ophyd.areadetector.plugins import HDF5Plugin_V22 as HDF5Plugin
|
||||
from ophyd.areadetector.plugins import ImagePlugin_V22 as ImagePlugin
|
||||
@@ -145,6 +145,19 @@ class Pilatus(PSIDeviceBase, ADBase):
|
||||
|
||||
# USER_ACCESS = ["start_live_mode", "stop_live_mode"]
|
||||
|
||||
cam_gain_menu_string = Cpt(EpicsSignalRO, suffix='cam1:GainMenu', string=True)
|
||||
|
||||
_default_configuration_attrs = [
|
||||
'cam.threshold_energy',
|
||||
'cam.threshold_auto_apply',
|
||||
'cam.gain_menu',
|
||||
'cam_gain_menu_string',
|
||||
'cam.pixel_cut_off',
|
||||
'cam.acquire_time',
|
||||
'cam.num_exposures',
|
||||
'cam.model',
|
||||
]
|
||||
|
||||
cam = Cpt(PilatusDetectorCam, "cam1:")
|
||||
hdf = Cpt(HDF5Plugin, "HDF1:")
|
||||
image1 = Cpt(ImagePlugin, "image1:")
|
||||
@@ -203,22 +216,11 @@ class Pilatus(PSIDeviceBase, ADBase):
|
||||
PreviewSignal,
|
||||
name="preview",
|
||||
ndim=2,
|
||||
num_rotation_90=0, # Check this
|
||||
num_rotation_90=3,
|
||||
doc="Preview signal for the Pilatus Detector",
|
||||
)
|
||||
file_event = Cpt(FileEventSignal, name="file_event")
|
||||
|
||||
@property
|
||||
def baseline_signals(self):
|
||||
"""Define baseline signals"""
|
||||
return [
|
||||
self.cam.acquire_time,
|
||||
self.cam.num_exposures,
|
||||
self.cam.threshold_energy,
|
||||
self.cam.gain_menu,
|
||||
self.cam.pixel_cut_off,
|
||||
]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
@@ -366,7 +368,7 @@ class Pilatus(PSIDeviceBase, ADBase):
|
||||
status = status_acquire & status_writing & status_cam_server
|
||||
return status
|
||||
|
||||
def _calculate_trigger(self, scan_msg: ScanStatusMessage):
|
||||
def _calculate_trigger(self, scan_msg: ScanStatusMessage) -> Tuple[float, float]:
|
||||
self._update_scan_parameter()
|
||||
total_osc = 0
|
||||
total_trig_lo = 0
|
||||
@@ -427,7 +429,7 @@ class Pilatus(PSIDeviceBase, ADBase):
|
||||
if calc_duration >= self.scan_parameter.scan_duration:
|
||||
break
|
||||
|
||||
return total_trig_lo + total_trig_hi
|
||||
return total_trig_lo, total_trig_hi
|
||||
|
||||
########################################
|
||||
# Beamline Specific Implementations #
|
||||
@@ -480,6 +482,14 @@ class Pilatus(PSIDeviceBase, ADBase):
|
||||
"""
|
||||
# self.stop_live_mode() # Make sure that live mode is stopped if scan runs
|
||||
|
||||
# If user has activated alignment mode on qt panel, switch back to multitrigger and stop acquisition
|
||||
if self.cam.trigger_mode.get() != TRIGGERMODE.MULT_TRIGGER.value:
|
||||
self.cam.trigger_mode.set(TRIGGERMODE.MULT_TRIGGER.value).wait(5)
|
||||
if self.cam.acquire.get() == ACQUIREMODE.ACQUIRING.value:
|
||||
self.cam.acquire.put(0)
|
||||
status_cam = CompareStatus(self.cam.acquire, ACQUIREMODE.DONE.value)
|
||||
status_cam.wait(timeout=5)
|
||||
|
||||
scan_msg: ScanStatusMessage = self.scan_info.msg
|
||||
if scan_msg.scan_name in self.xas_xrd_scan_names:
|
||||
self._update_scan_parameter()
|
||||
|
||||
Reference in New Issue
Block a user