From b09b3743300735ace7ad80acaf8ebd1179f051b3 Mon Sep 17 00:00:00 2001 From: Jacob Williamson Date: Thu, 11 Jun 2026 17:23:04 +0100 Subject: [PATCH 1/3] Add xtal to baseline devices --- src/crystallography_bluesky/i15_1/plans/generic_collection.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/crystallography_bluesky/i15_1/plans/generic_collection.py b/src/crystallography_bluesky/i15_1/plans/generic_collection.py index 3a045a5..7893b26 100644 --- a/src/crystallography_bluesky/i15_1/plans/generic_collection.py +++ b/src/crystallography_bluesky/i15_1/plans/generic_collection.py @@ -5,6 +5,7 @@ import pydantic from bluesky.utils import MsgGenerator from dodal.common import inject +from dodal.devices.beamlines.i15_1.laue import LaueMonochrometer from dodal.devices.beamlines.i15_1.robot import Robot from dodal.devices.tetramm import TetrammDetector from dodal.devices.zebra.zebra import Zebra @@ -25,6 +26,7 @@ class GenericCollectionDevices: robot: Robot tth: Motor fast_shutter: ZebraFastShutter + xtal: LaueMonochrometer def generic_collection( @@ -46,7 +48,7 @@ def generic_collection( baseline_devices (list[StandardReadable] | None, optional): Any other devices to record metadata from. Defaults to None. """ - DEFAULT_BASELINE_DEVICES = [devices.robot.spinner, devices.tth] + DEFAULT_BASELINE_DEVICES = [devices.robot.spinner, devices.tth, devices.xtal] TIME_BETWEEN_FRAMES = 0.1 I0_DEADTIME = 0.0001 From 0acde810da27b2c06f322bf3ba76da32c4b62cef Mon Sep 17 00:00:00 2001 From: Jacob Williamson Date: Thu, 11 Jun 2026 17:29:49 +0100 Subject: [PATCH 2/3] Update tests --- tests/unit_tests/i15_1/conftest.py | 12 +++++++++++- tests/unit_tests/i15_1/test_centre_sample.py | 8 ++++++++ tests/unit_tests/i15_1/test_static_collection.py | 15 +++++++++++++-- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/tests/unit_tests/i15_1/conftest.py b/tests/unit_tests/i15_1/conftest.py index 73a8b24..1371e2f 100644 --- a/tests/unit_tests/i15_1/conftest.py +++ b/tests/unit_tests/i15_1/conftest.py @@ -2,6 +2,8 @@ import pytest from bluesky import RunEngine +from daq_config_server import ConfigClient +from dodal.devices.beamlines.i15_1.laue import LaueMonochrometer from dodal.devices.beamlines.i15_1.robot import Robot from dodal.devices.motors import XYZStage from dodal.devices.tetramm import TetrammDetector @@ -89,6 +91,13 @@ async def hexapod() -> XYZStage: return hexapod +@pytest.fixture +async def xtal() -> LaueMonochrometer: + async with init_devices(mock=True): + xtal = LaueMonochrometer("", ConfigClient(""), "") + return xtal + + @pytest.fixture async def common_collection_devices( eiger: EigerDetector, @@ -97,5 +106,6 @@ async def common_collection_devices( robot: Robot, tth: Motor, fast_shutter: ZebraFastShutter, + xtal: LaueMonochrometer, ) -> GenericCollectionDevices: - return GenericCollectionDevices(eiger, i0, zebra, robot, tth, fast_shutter) + return GenericCollectionDevices(eiger, i0, zebra, robot, tth, fast_shutter, xtal) diff --git a/tests/unit_tests/i15_1/test_centre_sample.py b/tests/unit_tests/i15_1/test_centre_sample.py index f8ecb0b..349ff8f 100644 --- a/tests/unit_tests/i15_1/test_centre_sample.py +++ b/tests/unit_tests/i15_1/test_centre_sample.py @@ -57,6 +57,10 @@ def test_centre_sample_plan_makes_expected_calls( msgs, predicate=lambda msg: msg.command == "read" and msg.obj.name == "tth", ) + msgs = assert_message_and_return_remaining( + msgs, + predicate=lambda msg: msg.command == "read" and msg.obj.name == "xtal", + ) msgs = assert_message_and_return_remaining( msgs, predicate=lambda msg: ( @@ -126,6 +130,10 @@ def test_centre_sample_plan_makes_expected_calls( msgs, predicate=lambda msg: msg.command == "read" and msg.obj.name == "tth", ) + msgs = assert_message_and_return_remaining( + msgs, + predicate=lambda msg: msg.command == "read" and msg.obj.name == "xtal", + ) msgs = assert_message_and_return_remaining( msgs, predicate=lambda msg: msg.command == "close_run", diff --git a/tests/unit_tests/i15_1/test_static_collection.py b/tests/unit_tests/i15_1/test_static_collection.py index 75faf7f..0563e92 100644 --- a/tests/unit_tests/i15_1/test_static_collection.py +++ b/tests/unit_tests/i15_1/test_static_collection.py @@ -3,6 +3,7 @@ import pytest from bluesky.run_engine import RunEngine from bluesky.simulators import RunEngineSimulator, assert_message_and_return_remaining +from dodal.devices.beamlines.i15_1.laue import LaueMonochrometer from dodal.devices.beamlines.i15_1.robot import Robot from dodal.devices.tetramm import TetrammDetector from dodal.devices.zebra.zebra import Zebra @@ -62,6 +63,10 @@ def test_static_collection_plan_makes_expected_calls( msgs, predicate=lambda msg: msg.command == "read" and msg.obj.name == "tth", ) + msgs = assert_message_and_return_remaining( + msgs, + predicate=lambda msg: msg.command == "read" and msg.obj.name == "xtal", + ) msgs = assert_message_and_return_remaining( msgs, predicate=lambda msg: ( @@ -121,6 +126,10 @@ def test_static_collection_plan_makes_expected_calls( msgs, predicate=lambda msg: msg.command == "read" and msg.obj.name == "tth", ) + msgs = assert_message_and_return_remaining( + msgs, + predicate=lambda msg: msg.command == "read" and msg.obj.name == "xtal", + ) msgs = assert_message_and_return_remaining( msgs, predicate=lambda msg: msg.command == "close_run", @@ -194,8 +203,9 @@ async def test_given_plan_throws_exception_then_shutters_closed( tth: Motor, fast_shutter: ZebraFastShutter, run_engine: RunEngine, + xtal: LaueMonochrometer, ): - devices = GenericCollectionDevices(eiger, i0, zebra, robot, tth, fast_shutter) + devices = GenericCollectionDevices(eiger, i0, zebra, robot, tth, fast_shutter, xtal) run_engine = RunEngine() zebra.inputs.soft_in_1.set = AsyncMock(ValueError) @@ -217,8 +227,9 @@ def test_if_plan_fails_during_trigger_then_soft_in_cleaned_up( robot: Robot, tth: Motor, fast_shutter: ZebraFastShutter, + xtal: LaueMonochrometer, ): - devices = GenericCollectionDevices(eiger, i0, zebra, robot, tth, fast_shutter) + devices = GenericCollectionDevices(eiger, i0, zebra, robot, tth, fast_shutter, xtal) run_engine = RunEngineSimulator() From 998529b350c6486c1a4221ea9e5ec142cb72e274 Mon Sep 17 00:00:00 2001 From: Jacob Williamson Date: Thu, 11 Jun 2026 17:30:51 +0100 Subject: [PATCH 3/3] Pin dodal --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9b1dbed..42263c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ dependencies = [ "ophyd-async[ca,pva]==v0.17a5", "bluesky >= 1.13.1", "daq-config-server>=1.3.1", - "dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@main", + "dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@fix_xtal", ] dynamic = ["version"]