Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/mx_bluesky/common/device_setup_plans/manipulate_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,17 @@ def move_x_y_z(
yield from bps.wait(group)


def move_phi_chi_omega(
def move_phi_chi(
smargon: Smargon,
phi: float | None = None,
chi: float | None = None,
omega: float | None = None,
wait=False,
group="move_phi_chi_omega",
):
"""Move the x, y, and z axes of the given smargon to the specified position. All
"""Move the phi, chi of the given smargon to the specified position. All
axes are optional."""

LOGGER.info(f"Moving smargon to phi, chi, omega: {(phi, chi, omega)}")
yield from bps.abs_set(
smargon, CombinedMove(phi=phi, chi=chi, omega=omega), group=group
)
LOGGER.info(f"Moving smargon to phi, chi: {(phi, chi)}")
yield from bps.abs_set(smargon, CombinedMove(phi=phi, chi=chi), group=group)
if wait:
yield from bps.wait(group)
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def prepare_for_robot_load(

yield from bps.mv(smargon.stub_offsets, StubPosition.RESET_TO_ROBOT_LOAD)

yield from bps.mv(smargon, CombinedMove(x=0, y=0, z=0, chi=0, phi=0, omega=0))
yield from bps.mv(smargon.wrapped_omega.phase, 0)
yield from bps.mv(smargon, CombinedMove(x=0, y=0, z=0, chi=0, phi=0))

yield from bps.wait("prepare_robot_load")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from dodal.common.beamlines.beamline_utils import get_config_client
from dodal.devices.oav.oav_parameters import OAVParameters

from mx_bluesky.common.device_setup_plans.manipulate_sample import move_phi_chi_omega
from mx_bluesky.common.device_setup_plans.manipulate_sample import move_phi_chi
from mx_bluesky.common.experiment_plans.common_grid_detect_then_xray_centre_plan import (
detect_grid_and_do_gridscan,
)
Expand Down Expand Up @@ -74,7 +74,7 @@ def _pin_centre_then_gridscan_and_xrc():
composite.gonio, composite.backlight, composite.aperture_scatterguard
)

yield from move_phi_chi_omega(
yield from move_phi_chi(
composite.gonio,
parameters.phi_start_deg,
parameters.chi_start_deg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,32 @@ async def test_when_robot_unload_called_then_sample_area_prepared_before_load(
),
)

assert_message_and_return_remaining(
msgs = assert_message_and_return_remaining(
msgs,
lambda msg: (
msg.command == "set"
and msg.obj is smargon.wrapped_omega.phase
and msg.args[0] == 0
),
)

msgs = assert_message_and_return_remaining(
msgs,
lambda msg: (
msg.command == "wait" and msg.kwargs["group"] == msgs[0].kwargs["group"]
),
)

msgs = assert_message_and_return_remaining(
msgs,
lambda msg: (
msg.command == "set"
and msg.obj.name == "gonio"
and msg.args[0] == CombinedMove(x=0, y=0, z=0, omega=0, chi=0, phi=0)
and msg.args[0] == CombinedMove(x=0, y=0, z=0, chi=0, phi=0)
),
)

assert_message_and_return_remaining(
msgs = assert_message_and_return_remaining(
msgs,
lambda msg: (
msg.command == "set"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from mx_bluesky.common.device_setup_plans.manipulate_sample import (
move_aperture_if_required,
move_phi_chi_omega,
move_phi_chi,
move_x_y_z,
)

Expand Down Expand Up @@ -80,13 +80,13 @@ def test_move_phi_chi_omega_no_wait(
smargon: Smargon,
sim_run_engine: RunEngineSimulator,
):
msgs = sim_run_engine.simulate_plan(move_phi_chi_omega(smargon, 10.0, 5.0, None))
msgs = sim_run_engine.simulate_plan(move_phi_chi(smargon, 10.0, 5.0))
msgs = assert_message_and_return_remaining(
msgs,
lambda msg: (
msg.command == "set"
and msg.obj.name == smargon.name
and msg.args[0] == CombinedMove(phi=10.0, chi=5.0, omega=None)
and msg.args[0] == CombinedMove(phi=10.0, chi=5.0)
),
)
assert len(msgs) == 1
Expand All @@ -96,15 +96,13 @@ def test_move_phi_chi_omega_wait(
smargon: Smargon,
sim_run_engine: RunEngineSimulator,
):
msgs = sim_run_engine.simulate_plan(
move_phi_chi_omega(smargon, 10.0, 5.0, None, wait=True)
)
msgs = sim_run_engine.simulate_plan(move_phi_chi(smargon, 10.0, 5.0, wait=True))
msgs = assert_message_and_return_remaining(
msgs,
lambda msg: (
msg.command == "set"
and msg.obj.name == smargon.name
and msg.args[0] == CombinedMove(phi=10.0, chi=5.0, omega=None)
and msg.args[0] == CombinedMove(phi=10.0, chi=5.0)
),
)
group = msgs[0].kwargs["group"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,7 @@ def test_pin_centre_then_gridscan_plan_goes_to_the_starting_chi_and_phi(
lambda msg: (
msg.command == "set"
and msg.obj.name == "gonio"
and msg.args[0]
== CombinedMove(phi=expected_phi, chi=expected_chi, omega=None)
and msg.args[0] == CombinedMove(phi=expected_phi, chi=expected_chi)
and msg.kwargs["group"] == CONST.WAIT.READY_FOR_OAV
),
)
Expand Down
4 changes: 2 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading