Skip to content

Commit

Permalink
cleaning up
Browse files Browse the repository at this point in the history
  • Loading branch information
Relm-Arrowny committed Dec 20, 2024
1 parent 80a2e1d commit 52a3fe3
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions src/i10_bluesky/plans/utils/alignments.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from collections.abc import Callable
from enum import Enum

from bluesky import preprocessors as bpp
Expand All @@ -15,23 +16,36 @@ class PeakPosition(int, Enum):
CEN = 3


def scan_and_move_cen(
def scan_and_move_cen(funcs) -> Callable:
def inner(**kwargs):
ps = PeakStats(

Check warning on line 21 in src/i10_bluesky/plans/utils/alignments.py

View check run for this annotation

Codecov / codecov/patch

src/i10_bluesky/plans/utils/alignments.py#L21

Added line #L21 was not covered by tests
f"{kwargs['motor'].name}",
f"{kwargs['det'].name}",
calc_derivative_and_stats=True,
)

yield from bpp.subs_wrapper(

Check warning on line 27 in src/i10_bluesky/plans/utils/alignments.py

View check run for this annotation

Codecov / codecov/patch

src/i10_bluesky/plans/utils/alignments.py#L27

Added line #L27 was not covered by tests
funcs(**kwargs),
ps,
)
yield from abs_set(kwargs["motor"], ps["stats"][kwargs["loc"]], wait=True)

Check warning on line 31 in src/i10_bluesky/plans/utils/alignments.py

View check run for this annotation

Codecov / codecov/patch

src/i10_bluesky/plans/utils/alignments.py#L31

Added line #L31 was not covered by tests

return inner


@scan_and_move_cen
def step_scan_and_move_cen(
det: StandardReadable,
motor: Motor,
start: float,
end: float,
num: int,
loc: PeakPosition = PeakPosition.CEN,
) -> MsgGenerator:
ps = PeakStats(f"{motor.name}", f"{det.name}")

yield from bpp.subs_wrapper(
scan([det], motor, start, end, num=num),
ps,
)
yield from abs_set(motor, ps["stats"][loc], wait=True)
return scan([det], motor, start, end, num=num)

Check warning on line 45 in src/i10_bluesky/plans/utils/alignments.py

View check run for this annotation

Codecov / codecov/patch

src/i10_bluesky/plans/utils/alignments.py#L45

Added line #L45 was not covered by tests


@scan_and_move_cen
def fast_scan_and_move_cen(
det: StandardReadable,
motor: Motor,
Expand All @@ -40,12 +54,4 @@ def fast_scan_and_move_cen(
motor_speed: float | None = None,
loc: PeakPosition = PeakPosition.CEN,
) -> MsgGenerator:
ps = PeakStats(f"{motor.name}", f"{det.name}")

yield from bpp.subs_wrapper(
fast_scan_1d(
dets=[det], motor=motor, start=start, end=end, motor_speed=motor_speed
),
ps,
)
yield from abs_set(motor, ps["stats"][loc], wait=True)
return fast_scan_1d([det], motor, start, end, motor_speed=motor_speed)

Check warning on line 57 in src/i10_bluesky/plans/utils/alignments.py

View check run for this annotation

Codecov / codecov/patch

src/i10_bluesky/plans/utils/alignments.py#L57

Added line #L57 was not covered by tests

0 comments on commit 52a3fe3

Please sign in to comment.