feat: guard beam steering and auto exposure
CI / lint (push) Skipped
CI / test (3.11) (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
CI / lint (pull_request) Failing after 45s
CI / test (3.11) (pull_request) Failing after 1m15s
CI / test (3.13) (pull_request) Failing after 1m13s
CI / test (3.12) (pull_request) Canceled after 1m15s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Canceled after 1m10s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Canceled after 1m9s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Canceled after 1m5s
CI / test-with-coverage (pull_request) Canceled after 1m4s
CI / coverage-analysis (pull_request) Canceled after 0s

This commit is contained in:
David Perl
2026-08-25 11:51:12 +02:00
parent 5610a9737b
commit 8a31ffbfcb
4 changed files with 21 additions and 3 deletions
+3
View File
@@ -28,6 +28,9 @@ class BecMacros(ABC):
@staticmethod
@abstractmethod
def mono_pitch_scan(plot=True): ...
@staticmethod
@abstractmethod
def auto_exposure(): ...
class Geometry(ABC):
@@ -20,6 +20,7 @@ class X06daBecMacros(BecMacros):
get_current_energy,
mono_pitch_scan,
)
from pxiii_bec.macros.katscripts import auto_exposure # pyright: ignore[reportMissingImports, reportMissingModuleSource]
self.save_and_reload = save_and_reload
self.save_current_position = save_current_position
@@ -31,6 +32,7 @@ class X06daBecMacros(BecMacros):
self.bl_energy = _bl_energy
self.get_current_energy = get_current_energy
self.mono_pitch_scan = mono_pitch_scan
self.auto_exposure = auto_exposure
@staticmethod
def save_and_reload() -> tuple[Any, Any]: ...
@@ -44,6 +46,8 @@ class X06daBecMacros(BecMacros):
def get_current_energy(): ...
@staticmethod
def mono_pitch_scan(plot=True): ...
@staticmethod
def auto_exposure(): ...
class X06daDispatch(DefaultDispatch):
@@ -8,16 +8,17 @@ from aare.beamline_dispatch.protocols import BecMacros
class X10SaBecMacros(BecMacros):
def __init__(self) -> None:
from pxii_bec.macros.build_devices import ( # type: ignore
from pxii_bec.macros.build_devices import ( # pyright: ignore[reportMissingImports, reportMissingModuleSource]
save_and_reload,
save_current_position,
)
from pxii_bec.macros.init_beamline import init_beamline_environment # type: ignore
from pxii_bec.macros.pxii_energy import ( # type: ignore
from pxii_bec.macros.init_beamline import init_beamline_environment # pyright: ignore[reportMissingImports, reportMissingModuleSource]
from pxii_bec.macros.pxii_energy import ( # pyright: ignore[reportMissingImports, reportMissingModuleSource]
bl_energy,
get_current_energy,
mono_pitch_scan,
)
from pxii_bec.macros.katscripts import auto_exposure # pyright: ignore[reportMissingImports, reportMissingModuleSource]
self.save_and_reload = save_and_reload
self.save_current_position = save_current_position
@@ -25,6 +26,7 @@ class X10SaBecMacros(BecMacros):
self.bl_energy = bl_energy
self.get_current_energy = get_current_energy
self.mono_pitch_scan = mono_pitch_scan
self.auto_exposure = auto_exposure
@staticmethod
def save_and_reload() -> tuple[Any, Any]: ...
@@ -38,6 +40,8 @@ class X10SaBecMacros(BecMacros):
def get_current_energy(): ...
@staticmethod
def mono_pitch_scan(plot=True): ...
@staticmethod
def auto_exposure(): ...
class X10saDispatch(DefaultDispatch):
+7
View File
@@ -17,6 +17,7 @@ from aarecommon.config.logger_events import (
sample_log_context,
)
from aarecommon.errors.exception_handler import (
AareException,
AerotechCommunicationError,
AutoRasterSampleSkipped,
BeamlineBusyException,
@@ -3471,7 +3472,13 @@ class AareDAQ:
if "beam_steering" not in self._devs.bec_worker.dev:
raise BECCommunicationError("Beam steering device does not exist in the BEC config.")
self._cfg.try_set_busy(timeout=360)
try:
if not self.shutter:
raise AareException(
"Shutter not open! Please open the shutter before running beam steering."
)
self._dispatch.bec_macros.auto_exposure()
if x is not None:
self._devs.bec_worker.dev.beam_steering.sample_loc_x_px.set(x).wait()
if y is not None: