diff --git a/src/mx_bluesky/i04/__init__.py b/src/mx_bluesky/i04/__init__.py index e69de29bb..674407e94 100644 --- a/src/mx_bluesky/i04/__init__.py +++ b/src/mx_bluesky/i04/__init__.py @@ -0,0 +1,3 @@ +from mx_bluesky.i04.thawing_plan import thaw + +__all__ = ["thaw"] \ No newline at end of file diff --git a/src/mx_bluesky/i04/thawing_plan.py b/src/mx_bluesky/i04/thawing_plan.py index ce504b885..f040196a9 100644 --- a/src/mx_bluesky/i04/thawing_plan.py +++ b/src/mx_bluesky/i04/thawing_plan.py @@ -1,6 +1,7 @@ import bluesky.plan_stubs as bps import bluesky.preprocessors as bpp -from dodal.common import MsgGenerator, inject +from dodal.common import inject +from dls_bluesky_core.core import MsgGenerator from dodal.devices.smargon import Smargon from dodal.devices.thawer import Thawer, ThawerStates @@ -22,12 +23,13 @@ def thaw( Defaults to inject("smargon") """ inital_velocity = yield from bps.rd(smargon.omega.velocity) - new_velocity = abs(rotation / time_to_thaw) + new_velocity = abs(rotation / time_to_thaw) * 2.0 def do_thaw(): yield from bps.abs_set(smargon.omega.velocity, new_velocity, wait=True) yield from bps.abs_set(thawer.control, ThawerStates.ON, wait=True) yield from bps.rel_set(smargon.omega, rotation, wait=True) + yield from bps.rel_set(smargon.omega, -rotation, wait=True) def cleanup(): yield from bps.abs_set(smargon.omega.velocity, inital_velocity, wait=True) @@ -37,4 +39,4 @@ def cleanup(): yield from bpp.contingency_wrapper( do_thaw(), final_plan=cleanup, - ) + ) \ No newline at end of file diff --git a/tests/i04/test_thawing.py b/tests/i04/test_thawing.py index b4feb8aad..ad09dfda7 100644 --- a/tests/i04/test_thawing.py +++ b/tests/i04/test_thawing.py @@ -86,9 +86,9 @@ def do_thaw_func(): @pytest.mark.parametrize( "time, rotation, expected_speed", [ - (10, 360, 36), - (3.5, 100, pytest.approx(28.5714285)), - (50, -100, 2), + (10, 360, 72), + (3.5, 100, pytest.approx(57.142857)), + (50, -100, 4), ], ) def test_given_different_rotations_and_times_then_velocity_correct( @@ -114,6 +114,7 @@ def test_given_different_rotations_then_motor_moved_relative( set_mock_value(smargon.omega.user_readback, start_pos) RE = RunEngine() RE(thaw(10, rotation, thawer=thawer, smargon=smargon)) - get_mock_put(smargon.omega.user_setpoint).assert_called_with( - expected_end, wait=ANY, timeout=ANY - ) + assert get_mock_put(smargon.omega.user_setpoint).call_args_list == [ + call(expected_end, wait=ANY, timeout=ANY), + call(start_pos, wait=ANY, timeout=ANY), + ]