Skip to content
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

Add a plan to exercise sample stages #23

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
50 changes: 50 additions & 0 deletions src/mx_bluesky/I24/exercise_smaract_motors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from __future__ import annotations

from collections import namedtuple

import bluesky.plan_stubs as bps

# from bluesky import RunEngine
from dodal.devices.i24.i24_vgonio import VGonio

Point3D = namedtuple("Point3D", ("x", "y", "z"))


def check_motor_position(motor):
current_pos = yield from bps.rd(motor)
print(current_pos)
pass

Check warning on line 16 in src/mx_bluesky/I24/exercise_smaract_motors.py

View check run for this annotation

Codecov / codecov/patch

src/mx_bluesky/I24/exercise_smaract_motors.py#L14-L16

Added lines #L14 - L16 were not covered by tests


def exercise_motor(motor, min_pos, max_pos):
yield from bps.mv(motor, max_pos)

Check warning on line 20 in src/mx_bluesky/I24/exercise_smaract_motors.py

View check run for this annotation

Codecov / codecov/patch

src/mx_bluesky/I24/exercise_smaract_motors.py#L20

Added line #L20 was not covered by tests
# check
yield from bps.mv(motor, min_pos)

Check warning on line 22 in src/mx_bluesky/I24/exercise_smaract_motors.py

View check run for this annotation

Codecov / codecov/patch

src/mx_bluesky/I24/exercise_smaract_motors.py#L22

Added line #L22 was not covered by tests


def move_xz_motors(smaract_motors: VGonio, pos: float, iter: int = 10):
yield from bps.mv()

Check warning on line 26 in src/mx_bluesky/I24/exercise_smaract_motors.py

View check run for this annotation

Codecov / codecov/patch

src/mx_bluesky/I24/exercise_smaract_motors.py#L26

Added line #L26 was not covered by tests
# exercise_motor
# 10 times
# move back to 0


def move_omega(smaract_motors: VGonio, pos: float = 0.0):
yield from bps.mv(smaract_motors.omega, pos, wait=True)

Check warning on line 33 in src/mx_bluesky/I24/exercise_smaract_motors.py

View check run for this annotation

Codecov / codecov/patch

src/mx_bluesky/I24/exercise_smaract_motors.py#L33

Added line #L33 was not covered by tests
# check that it actually arrived


def exercise_plan(smaract: VGonio):
yield from move_omega(smaract, 45.0)

Check warning on line 38 in src/mx_bluesky/I24/exercise_smaract_motors.py

View check run for this annotation

Codecov / codecov/patch

src/mx_bluesky/I24/exercise_smaract_motors.py#L38

Added line #L38 was not covered by tests
# exercise x and z here
yield from move_omega(smaract, 0.0)
pass

Check warning on line 41 in src/mx_bluesky/I24/exercise_smaract_motors.py

View check run for this annotation

Codecov / codecov/patch

src/mx_bluesky/I24/exercise_smaract_motors.py#L40-L41

Added lines #L40 - L41 were not covered by tests


def main():
# RE = RunEngine()
# RE(exercise_plan())
pass


main()