Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Robot load: Minor fixes from testing (#1415)
Browse files Browse the repository at this point in the history
* Minor fixes from testing
---------

Co-authored-by: Dominic Oram <[email protected]>
  • Loading branch information
olliesilvester and DominicOram authored Jun 4, 2024
1 parent 4bed47e commit a180c07
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ install_requires =
blueapi >= 0.4.3-rc1
dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git


[options.entry_points]
console_scripts =
hyperion = hyperion.__main__:main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def adjust_mirror_stripe(
f"Adjusting mirror stripe for {energy_kev}keV selecting {stripe} stripe"
)
yield from bps.abs_set(mirror.stripe, stripe, wait=True)
yield from bps.abs_set(mirror.apply_stripe, 1)
yield from bps.trigger(mirror.apply_stripe)

LOGGER.info("Adjusting mirror voltages...")
yield from _apply_and_wait_for_voltages_to_settle(stripe, mirror, mirror_voltages)
Expand Down
5 changes: 3 additions & 2 deletions src/hyperion/experiment_plans/robot_load_then_centre_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import bluesky.plan_stubs as bps
import bluesky.preprocessors as bpp
from blueapi.core import BlueskyContext, MsgGenerator
from dodal.devices.aperturescatterguard import AperturePositions, ApertureScatterguard
from dodal.devices.aperturescatterguard import ApertureScatterguard
from dodal.devices.attenuator import Attenuator
from dodal.devices.backlight import Backlight
from dodal.devices.dcm import DCM
Expand Down Expand Up @@ -124,9 +124,10 @@ def take_robot_snapshots(oav: OAV, webcam: Webcam, directory: Path):


def prepare_for_robot_load(composite: RobotLoadThenCentreComposite):
assert composite.aperture_scatterguard.aperture_positions
yield from bps.abs_set(
composite.aperture_scatterguard,
AperturePositions.ROBOT_LOAD,
composite.aperture_scatterguard.aperture_positions.ROBOT_LOAD,
group="prepare_robot_load",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ def test_adjust_mirror_stripe(
new_callable=_all_demands_accepted(vfm_mirror_voltages),
):
vfm.stripe.set = MagicMock(return_value=NullStatus())
vfm.apply_stripe.set = MagicMock() # type: ignore
vfm.apply_stripe.trigger = MagicMock() # type: ignore
parent = MagicMock()
parent.attach_mock(vfm.stripe.set, "stripe_set")
parent.attach_mock(vfm.apply_stripe.set, "apply_stripe") # type: ignore
parent.attach_mock(vfm.apply_stripe.trigger, "apply_stripe") # type: ignore

RE(adjust_mirror_stripe(energy_kev, vfm, vfm_mirror_voltages))

assert parent.method_calls[0] == ("stripe_set", (expected_stripe,))
assert parent.method_calls[1] == ("apply_stripe", (1,))
assert parent.method_calls[1][0] == "apply_stripe"
vfm_mirror_voltages.voltage_channels[0].set.assert_called_once_with( # type: ignore
first_voltage
)
Expand Down Expand Up @@ -208,9 +208,7 @@ def test_adjust_dcm_pitch_roll_vfm_from_lut(
)
messages = sim_run_engine.assert_message_and_return_remaining(
messages[1:],
lambda msg: msg.command == "set"
and msg.obj.name == "vfm-apply_stripe"
and msg.args == (1,),
lambda msg: msg.command == "trigger" and msg.obj.name == "vfm-apply_stripe",
)
for channel, expected_voltage in (
(14, 124),
Expand Down

0 comments on commit a180c07

Please sign in to comment.