From 6fce0925b30d797fe5540883f18bafc22b8abc07 Mon Sep 17 00:00:00 2001 From: David Perl Date: Fri, 30 Oct 2026 16:23:24 +0100 Subject: [PATCH] feat: use rotation scan defaut settings from config service --- pyproject.toml | 2 +- .../beamline_dispatch/default/beamline_dispatch.py | 12 +++++++++++- .../beamline_dispatch/x06da/beamline_dispatch.py | 5 ----- .../beamline_dispatch/x10sa/beamline_dispatch.py | 5 ----- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 10356cbe..3e4cc9d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ dependencies = [ "aarelcinfer-client==0.1.1a8", "matplotlib>=3.10.3", "httpx>=0.28.1", - "aare-config>=0.1.7", + "aare-config>=0.3.0", ] [project.optional-dependencies] diff --git a/src/aare/beamline_dispatch/default/beamline_dispatch.py b/src/aare/beamline_dispatch/default/beamline_dispatch.py index 45dba3bb..28435b60 100644 --- a/src/aare/beamline_dispatch/default/beamline_dispatch.py +++ b/src/aare/beamline_dispatch/default/beamline_dispatch.py @@ -4,6 +4,7 @@ from abc import ABC from importlib.resources import files from typing import Any +from aare_config import AareConfigClient from aarecommon.config.beamline import MXBeamline from aarecommon.models.beam_centre import BeamCentre @@ -46,6 +47,9 @@ class DefaultDispatch(BeamlineDispatch, ABC): ) -> None: self._auth = DefaultAuthDispatch() self._geo = geo_class(beamline=beamline) + self._config = AareConfigClient( + redis_url=f"redis://mx-{beamline.value.lower()}-queue-01", key_prefix="config" + ) @property def auth(self): @@ -57,7 +61,13 @@ class DefaultDispatch(BeamlineDispatch, ABC): @property def default_rotation_parameters(self) -> dict[str, Any]: - return {"exp_time_s": 0.04, "dtz": 110, "incr_omega_deg": 0.2} + defaults = self._config.rotation_defaults + return { + "exp_time_s": defaults.exp_time_s, + "dtz": defaults.detector_distance_mm, + "incr_omega_deg": defaults.image_width_deg, + "transmission": defaults.transmission_fraction, + } @property def default_auto_raster_parameters(self) -> dict[str, Any]: diff --git a/src/aare/beamline_dispatch/x06da/beamline_dispatch.py b/src/aare/beamline_dispatch/x06da/beamline_dispatch.py index 0c85000c..a6dbdd18 100644 --- a/src/aare/beamline_dispatch/x06da/beamline_dispatch.py +++ b/src/aare/beamline_dispatch/x06da/beamline_dispatch.py @@ -109,11 +109,6 @@ class X06daDispatch(DefaultDispatch): def bec_macros(self) -> BecMacros: return self._bec_macros - @property - def default_rotation_parameters(self) -> dict[str, Any]: - default = super().default_rotation_parameters - return default | {"transmission": 1.0} - @property def default_auto_raster_parameters(self) -> dict[str, Any]: return {"exp_time_s": 0.04, "transmission": 1.0, "dtz": 150} diff --git a/src/aare/beamline_dispatch/x10sa/beamline_dispatch.py b/src/aare/beamline_dispatch/x10sa/beamline_dispatch.py index 356cbe90..86089dad 100644 --- a/src/aare/beamline_dispatch/x10sa/beamline_dispatch.py +++ b/src/aare/beamline_dispatch/x10sa/beamline_dispatch.py @@ -110,11 +110,6 @@ class X10saDispatch(DefaultDispatch): def bec_macros(self) -> BecMacros: return self._bec_macros - @property - def default_rotation_parameters(self) -> dict[str, Any]: - default = super().default_rotation_parameters - return default | {"transmission": 0.1} - @property def default_auto_raster_parameters(self) -> dict[str, Any]: # Full transmission for 20 keV rastering