-
Notifications
You must be signed in to change notification settings - Fork 5
Added new move on click plan #1637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
| focus_on_oav_view, | ||
| move_block_on_arrow_click, | ||
| move_nudge_on_arrow_click, | ||
| move_on_oav_view_click, | ||
| move_window_on_arrow_click, | ||
| ) | ||
|
|
||
|
|
@@ -103,3 +104,43 @@ async def test_focus_on_oav_view( | |
| ): | ||
| run_engine(focus_on_oav_view(FocusDirection(direction), MoveSize(move_size), pmac)) | ||
| assert await pmac.z.user_readback.get_value() == expected_value | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "coordinates, microns_per_pixel_x, microns_per_pixel_y, expected_x, expected_y", | ||
| [ | ||
| ((568, 321), 1.0, 1.0, 0.568, 0.321), | ||
| ((123, 789), 1.0, 1.0, 0.123, 0.789), | ||
| ((568, 321), 0.5, 2.0, 0.284, 0.642), | ||
| ((123, 789), 2.0, 0.5, 0.246, 0.3945), | ||
| ], | ||
| ) | ||
| def test_move_on_oav_view_click( | ||
| coordinates, | ||
| microns_per_pixel_x, | ||
| microns_per_pixel_y, | ||
| expected_x, | ||
| expected_y, | ||
| oav, | ||
| pmac, | ||
| run_engine, | ||
| ): | ||
| def fake_rd(_signal): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to parametrize here on a couple of different values of microns per pixel x/y just to ensure that the calculation does actually use them correctly |
||
| if _signal == oav.microns_per_pixel_x: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should really be |
||
| return microns_per_pixel_x | ||
| if _signal == oav.microns_per_pixel_y: | ||
| return microns_per_pixel_y | ||
| return 1.0 | ||
| yield | ||
|
|
||
| with ( | ||
| patch( | ||
| "mx_bluesky.beamlines.i24.web_gui_plans.oav_plans.bps.mv", | ||
| ) as mock_bps_mv, | ||
| patch( | ||
| "mx_bluesky.beamlines.i24.web_gui_plans.oav_plans.bps.rd", | ||
| side_effect=fake_rd, | ||
| ), | ||
| ): | ||
| run_engine(move_on_oav_view_click(coordinates, oav, pmac)) | ||
| mock_bps_mv.assert_any_call(pmac.x, expected_x, pmac.y, expected_y, wait=True) | ||
Uh oh!
There was an error while loading. Please reload this page.