feat: add beamline dispatch for x06da
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 53s
CI / test (3.11) (pull_request) Successful in 53s
CI / test (3.12) (pull_request) Successful in 52s
CI / test (3.13) (pull_request) Successful in 55s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m4s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 1m4s
CI / test-with-coverage (pull_request) Failing after 1m26s
CI / coverage-analysis (pull_request) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Successful in 1m30s

This commit is contained in:
2026-08-04 10:24:28 +02:00
parent 71d9d07f39
commit dc5169548b
2 changed files with 53 additions and 4 deletions
@@ -1,4 +1,52 @@
from typing import Any
from aare.beamline_dispatch.default.beamline_dispatch import DefaultDispatch
from aare.beamline_dispatch.protocols import BecMacros
class X06daDispatch(DefaultDispatch): ...
class X06daBecMacros(BecMacros):
def __init__(self) -> None:
from pxiii_bec.macros.build_devices import ( # type: ignore
save_and_reload,
save_current_position,
)
from pxiii_bec.macros.init_beamline import init_beamline_environment # type: ignore
from pxiii_bec.macros.pxiii_energy import ( # type: ignore
bl_energy,
get_current_energy,
mono_pitch_scan,
)
self.save_and_reload = save_and_reload
self.save_current_position = save_current_position
self.init_beamline_environment = init_beamline_environment
def _bl_energy(energy_ev, move_gap=True, mono_scan=True, plot=True):
return bl_energy(energy_ev=energy_ev, plot=plot)
self.bl_energy = _bl_energy
self.get_current_energy = get_current_energy
self.mono_pitch_scan = mono_pitch_scan
@staticmethod
def save_and_reload() -> tuple[Any, Any]: ...
@staticmethod
def save_current_position(device, position, axis=None, force=False, max_delta=0.5) -> None: ...
@staticmethod
def init_beamline_environment() -> tuple[Any, Any]: ...
@staticmethod
def bl_energy(energy_ev, move_gap=True, mono_scan=True, plot=True): ...
@staticmethod
def get_current_energy(): ...
@staticmethod
def mono_pitch_scan(plot=True): ...
class X06daDispatch(DefaultDispatch):
def __init__(self) -> None:
super().__init__()
self._bec_macros = X06daBecMacros()
@property
def bec_macros(self) -> BecMacros:
return self._bec_macros
+4 -3
View File
@@ -5,6 +5,7 @@ import pytest
from aare.beamline_dispatch.beamline_dispatch import get_beamline_dispatch
from aare.beamline_dispatch.simulated import SimulatedDispatch
from aare.beamline_dispatch.x06da import X06daDispatch
from aare.beamline_dispatch.x10sa import X10saDispatch
@@ -40,6 +41,6 @@ def test_pxii_dispatch_can_be_instantiated():
importlib.util.find_spec("pxiii_bec") is None, reason="run only for pxiii flavour"
)
def test_pxiii_dispatch_can_be_instantiated():
with patch.dict("os.environ", {"BEAMLINE": "X06DA"}), pytest.raises(TypeError) as e:
_ = get_beamline_dispatch()
assert e.match("Can't instantiate abstract class")
with patch.dict("os.environ", {"BEAMLINE": "X06DA"}):
dispatch = get_beamline_dispatch()
assert isinstance(dispatch, X06daDispatch)