From e1175c9df628660036d721bf8914103a9c61be91 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Mon, 21 Sep 2026 15:22:11 +0200 Subject: [PATCH] Feat: Fixed per-beamline raster parameters in automation The raster in the automated measurement sequence no longer reads exposure/transmission/resolution from the spreadsheet. It uses fixed per-beamline values from the dispatch: - X06DA: 0.04 s, 100% transmission, 150 mm - X10SA: 0.02 s, 10% transmission, 200 mm Co-Authored-By: Claude Opus 5 (1M context) --- .../default/beamline_dispatch.py | 5 ++ src/aare/beamline_dispatch/protocols.py | 3 ++ .../x06da/beamline_dispatch.py | 4 ++ .../x10sa/beamline_dispatch.py | 4 ++ src/aare/daq/daq.py | 52 ++----------------- 5 files changed, 20 insertions(+), 48 deletions(-) diff --git a/src/aare/beamline_dispatch/default/beamline_dispatch.py b/src/aare/beamline_dispatch/default/beamline_dispatch.py index efa8112c..45dba3bb 100644 --- a/src/aare/beamline_dispatch/default/beamline_dispatch.py +++ b/src/aare/beamline_dispatch/default/beamline_dispatch.py @@ -58,3 +58,8 @@ 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} + + @property + def default_auto_raster_parameters(self) -> dict[str, Any]: + """Fixed raster parameters used by the automated measurement sequence.""" + return {"exp_time_s": 0.04, "transmission": 1.0, "dtz": 200} diff --git a/src/aare/beamline_dispatch/protocols.py b/src/aare/beamline_dispatch/protocols.py index 39001d3e..169fc4b4 100644 --- a/src/aare/beamline_dispatch/protocols.py +++ b/src/aare/beamline_dispatch/protocols.py @@ -67,3 +67,6 @@ class BeamlineDispatch(ABC): @property @abstractmethod def default_rotation_parameters(self) -> dict[str, Any]: ... + @property + @abstractmethod + 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 ec52c85e..a106e5a9 100644 --- a/src/aare/beamline_dispatch/x06da/beamline_dispatch.py +++ b/src/aare/beamline_dispatch/x06da/beamline_dispatch.py @@ -124,3 +124,7 @@ class X06daDispatch(DefaultDispatch): 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 160be3df..10e9ba58 100644 --- a/src/aare/beamline_dispatch/x10sa/beamline_dispatch.py +++ b/src/aare/beamline_dispatch/x10sa/beamline_dispatch.py @@ -125,3 +125,7 @@ class X10saDispatch(DefaultDispatch): 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]: + return {"exp_time_s": 0.02, "transmission": 0.1, "dtz": 200} diff --git a/src/aare/daq/daq.py b/src/aare/daq/daq.py index 476fca10..36ae361c 100644 --- a/src/aare/daq/daq.py +++ b/src/aare/daq/daq.py @@ -2346,55 +2346,11 @@ class AareDAQ: ) def get_auto_raster_params(self) -> SimpleScanParameters: - default_params = self.get_beamline_default_raster_params() - if self.status.sample is None: - return default_params + """Raster parameters for the automated measurement sequence. - aaredb_params = ( - self.status.sample.aaredb_params - if hasattr(self.status.sample, "aaredb_params") - else None - ) - - if aaredb_params is None: - return default_params - - params = default_params - - # Exposure - exp = getattr(aaredb_params, "exposure", None) - if exp is not None: - params.exp_time_s = exp - else: - params.exp_time_s = 0.04 # Default - - # Transmission - trans = getattr(aaredb_params, "transmission", None) - if trans is not None: - logger.debug(f"transmission: {trans}") - params.transmission = trans / 100.0 if trans > 1.0 else trans - else: - params.transmission = 1.0 # Default - - # Resolution and DTZ - res = getattr(aaredb_params, "targetresolution", None) - if res is not None: - logger.debug(f"resolution: {res}") - try: - params.dtz = self.diffraction_geometry.calc_dtz_mm(res) - logger.debug(f"dtz: {params.dtz}") - except Exception: - logger.exception(f"Failed to calculate dtz for resolution {res}") - - # Adjust exposure time based on resolution - if res <= 1.5: - params.exp_time_s = 0.02 - elif 1.5 < res <= 3.0: - params.exp_time_s = 0.04 - else: - params.exp_time_s = 0.08 - - return params + Fixed per beamline; spreadsheet parameters only apply to data collection. + """ + return SimpleScanParameters(**self._dispatch.default_auto_raster_parameters) def get_collection_params(self, prefer_smart: bool = False) -> tuple[SimpleScanParameters, str]: spreadsheet_params, _file_prefix = self.spreadsheet_params()