WIP migrate samcam
CI / lint (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped

This commit is contained in:
2026-09-01 15:29:46 +02:00
parent 116ea179c4
commit 4272f5bfda
2 changed files with 44 additions and 1 deletions
+3 -1
View File
@@ -14,6 +14,7 @@ from epics import PV
# - setter with option to do sync/async move
# - property setter, which assumes that sync move is done (excl. zoom, which is async by default)
from aare.beamline_dispatch.protocols import BeamlineDispatch
from aare.daq.samcam import BecSamCam
from aare.devices import aerotech, smargon
from aare.devices.area_detector import AutoEnum, epicsAD
from aare.devices.bec_worker import BECClientWorker
@@ -46,6 +47,7 @@ class BeamlineDevices:
self.dtz_mod = cfg_get("daq.detector_distance_limit_modifier", 1.0)
# TODO convert epics pvs to BEC
self._sample_cam = epicsAD(f"{BEAMLINE}-ES-MS:")
self._samcam = BecSamCam(self.bec_worker)
self._front_light = PredefinedPV(
name="front_light",
@@ -275,7 +277,7 @@ class BeamlineDevices:
# Detector Z
@property
def dtz(self) -> float:
return self._dtz.user_setpoint.get()
return self._dtz.user_setpoint.get(cached=True)
@property
def dty(self) -> float:
+41
View File
@@ -0,0 +1,41 @@
from __future__ import annotations
from enum import Enum
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from aare.devices.bec_worker import BECClientWorker
class AutoEnum(Enum):
MANUAL = 0
ONCE = 1
AUTO = 2
class BecSamCam:
def __init__(self, bec: BECClientWorker) -> None:
self.acquire = bec.dev.TODO
self.exposure = bec.dev.samcam_exp
self.gain = bec.dev.samcam_gain
self.gain_rbv = bec.dev.TODO
self.gain_rbv = bec.dev.TODO
self.gain_mode = bec.dev.TODO
self.expo_mode = bec.dev.TODO
self.uid = bec.dev.TODO
self.zoom = bec.dev.scam_zoom
def setup(self, gain: float = 15, expo: float = 0.025):
self.acquire.put(0, wait=True)
self.gain_mode.put(0, wait=True) # manual gain control
self.gain.put(gain, wait=True)
self.expo_mode.put(0, wait=True) # manual exposure control
self.exposure.put(expo, wait=True)
self.acquire.put(1, wait=True)
def set_auto(self, state: AutoEnum):
"""Uses AutoEnum 0 is Manual, 1 is Once, 2 is Auto"""
self.acquire.put(0, wait=True)
self.gain_mode.put(state.value) # automatic gain control
self.expo_mode.put(state.value) # automatic exposure control
self.acquire.put(1)