feat: put current zoom level in redis
CI / lint (pull_request) Successful in 52s
CI / test (3.12) (pull_request) Successful in 1m18s
CI / test (3.13) (pull_request) Successful in 1m15s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 1m27s
CI / test-with-coverage (pull_request) Successful in 1m31s
CI / coverage-analysis (pull_request) Failing after 2s
CI / test (3.14) (pull_request) Successful in 1m15s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m16s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Successful in 1m24s
Docs build and publish / docker (push) Successful in 2s
CI / test-with-beamline-plugins (pxii_bec) (push) Failing after 28s
CI / test (3.12) (push) Failing after 31s
CI / test-with-coverage (push) Failing after 33s
CI / test-with-beamline-plugins (pxi_bec) (push) Canceled after 36s
CI / test (3.14) (push) Canceled after 36s
CI / test (3.13) (push) Canceled after 36s
CI / lint (push) Canceled after 36s
CI / coverage-analysis (push) Canceled after 0s
Build and Publish / release (push) Successful in 35s
CI / test-with-beamline-plugins (pxiii_bec) (push) Canceled after 38s

This commit was merged in pull request #251.
This commit is contained in:
perl_d committed 2026-10-06 15:41:17 +02:00
1 parent e96ad082c4
commit 4ac6f4a947
4 files changed
+20 -4

No files matched your search

+9
View File
@@ -617,6 +617,15 @@ class BeamlineConfig:
def gridscan_analysis_mode(self, val: GridscanAnalysisMode) -> None:
self.redis.set(f"{self._bl}:gridscan_analysis_mode", str(val))
@property
def current_zoom_level(self) -> float | None:
data = self.redis.get(f"{self._bl}:current_zoom_level")
return float(data) if data is not None else None
@current_zoom_level.setter
def current_zoom_level(self, val: float) -> None:
self.redis.set(f"{self._bl}:current_zoom_level", str(val))
def _get_settings(self) -> BeamlineSettingsModel:
tmp = self.redis.get(f"{self._bl}:settings")
if tmp is None:
+1
View File
@@ -1748,6 +1748,7 @@ class AareDAQ:
self._devs.zoom = val
time.sleep(0.2)
self._devs.samcam_auto(AutoEnum.ONCE)
self._cfg.current_zoom_level = val
def save_beam_location_camera_setting(self) -> None:
"""Persist the camera's current gain/exposure for the current zoom as
+6 -3
View File
@@ -15,6 +15,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.config import BeamlineConfig
from aare.devices import aerotech, smargon
from aare.devices.area_detector import AutoEnum, epicsAD
from aare.devices.bec_worker import BECClientWorker
@@ -31,13 +32,14 @@ CHI_ZERO_TOLERANCE_DEG = 1e-3
class BeamlineDevices:
def __init__(self, beamline: MXBeamline, dispatch: BeamlineDispatch):
def __init__(self, beamline: MXBeamline, dispatch: BeamlineDispatch, cfg: BeamlineConfig):
self._cfg = cfg
self._dispatch = dispatch
self._beamline = beamline
BEAMLINE = beamline.value.upper()
self.tell = make_tell_client(beamline)
self.aerotech = aerotech.AerotechController(beamline)
self.bec_worker = BECClientWorker(beamline)
self.bec_worker = BECClientWorker(beamline, cfg=self._cfg)
self._smargon = smargon.Smargon(beamline)
self.exp_shutter = ExperimentalHutchShutter(beamline=self._beamline)
# Personnel Safety System: gates whether the robot is allowed to move.
@@ -125,7 +127,7 @@ class BeamlineDevices:
finally:
beamline = MXBeamline.SIMULATED if simulated else self._beamline
logger.info(f"Restarting BEC worker with simulated={simulated}")
self.bec_worker = BECClientWorker(beamline)
self.bec_worker = BECClientWorker(beamline, cfg=self._cfg)
def restart_tell(self, simulated: bool = False) -> None:
beamline = MXBeamline.SIMULATED if simulated else self._beamline
@@ -197,6 +199,7 @@ class BeamlineDevices:
def set_zoom(self, value: float, /, wait: bool = True):
self._zoom.move(value, wait=wait)
self._cfg.current_zoom_level = value
# Optics
@property
+4 -1
View File
@@ -15,6 +15,7 @@ from bec_lib.device import RPCError, ScanRequestError
from bec_lib.service_config import ServiceConfig
from aare.beamline_dispatch.beamline_dispatch import get_beamline_dispatch
from aare.daq.config import BeamlineConfig
logger = setup_logger("aareDAQ")
@@ -69,11 +70,12 @@ def _bec_state_to_aare_state(bec_state: str) -> BeamlineStateEnum:
class BECClientWorker:
def __init__(self, beamline: MXBeamline, name: str = "default"):
def __init__(self, beamline: MXBeamline, cfg: BeamlineConfig, name: str = "default"):
logger.debug(f"initialising BEC worker for {beamline}")
BEAMLINE = beamline.value.lower()
self.beamline = beamline
self._backlight_brightness: Any
self._cfg = cfg
if self.beamline is MXBeamline.X06DA:
self._beamline_name = "pxiii"
elif self.beamline is MXBeamline.X10SA:
@@ -527,6 +529,7 @@ class BECClientWorker:
@zoom.setter
def zoom(self, value: float):
self.scans.umv(self._zoom, value, relative=False)
self._cfg.current_zoom_level = value
@property
def ring_current(self) -> float: