Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions src/dodal/plan_stubs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
from .wrapped import move, move_relative, set_absolute, set_relative, sleep, wait
from .wrapped import (
move,
move_relative,
rd,
set_absolute,
set_relative,
sleep,
stop,
wait,
)

__all__ = ["move", "move_relative", "set_absolute", "set_relative", "sleep", "wait"]
__all__ = [
"move",
"move_relative",
"rd",
"set_absolute",
"set_relative",
"sleep",
"stop",
"wait",
]
34 changes: 29 additions & 5 deletions src/dodal/plan_stubs/wrapped.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Annotated, TypeVar

import bluesky.plan_stubs as bps
from bluesky.protocols import Movable
from bluesky.protocols import Movable, Readable, Stoppable
from bluesky.utils import MsgGenerator

"""
Expand All @@ -16,7 +16,7 @@


def set_absolute(
movable: Movable[T], value: T, group: Group | None = None, wait: bool = False
movable: Movable[T], value: T, group: Group | None = None, wait: bool = True
) -> MsgGenerator:
"""
Set a device, wrapper for `bp.abs_set`.
Expand All @@ -27,7 +27,7 @@ def set_absolute(
group (Group | None, optional): The message group to associate with the
setting, for sequencing. Defaults to None.
wait (bool, optional): The group should wait until all setting is complete
(e.g. a motor has finished moving). Defaults to False.
(e.g. a motor has finished moving). Defaults to True.

Returns:
MsgGenerator: Plan
Expand All @@ -39,7 +39,7 @@ def set_absolute(


def set_relative(
movable: Movable[T], value: T, group: Group | None = None, wait: bool = False
movable: Movable[T], value: T, group: Group | None = None, wait: bool = True
) -> MsgGenerator:
"""
Change a device, wrapper for `bp.rel_set`.
Expand All @@ -50,7 +50,7 @@ def set_relative(
group (Group | None, optional): The message group to associate with the
setting, for sequencing. Defaults to None.
wait (bool, optional): The group should wait until all setting is complete
(e.g. a motor has finished moving). Defaults to False.
(e.g. a motor has finished moving). Defaults to True.

Returns:
MsgGenerator: Plan
Expand Down Expand Up @@ -146,3 +146,27 @@ def wait(
"""

return (yield from bps.wait(group, timeout=timeout))


def rd(readable: Readable) -> MsgGenerator:
"""Reads a single-value non-triggered object, wrapper for `bp.rd`.

Args:
readable (Readable): The device to be read

Returns:
Iterator[MsgGenerator]: Bluesky messages
"""
return (yield from bps.rd(readable))


def stop(stoppable: Stoppable) -> MsgGenerator:
"""Stop a device, wrapper for `bp.stop`.

Args:
stoppable (Stoppable): Device to be stopped

Returns:
Iterator[MsgGenerator]: Bluesky messages
"""
return (yield from bps.stop(stoppable))
33 changes: 31 additions & 2 deletions src/dodal/plans/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,33 @@
from .spec_path import spec_scan
from .wrapped import count
from .wrapped import (
count,
list_grid_rscan,
list_grid_scan,
list_rscan,
list_scan,
num_grid_rscan,
num_grid_scan,
num_rscan,
num_scan,
step_grid_rscan,
step_grid_scan,
step_rscan,
step_scan,
)

__all__ = ["count", "spec_scan"]
__all__ = [
"count",
"list_grid_rscan",
"list_grid_scan",
"list_rscan",
"list_scan",
"num_grid_rscan",
"num_grid_scan",
"num_rscan",
"num_scan",
"spec_scan",
"step_grid_rscan",
"step_grid_scan",
"step_rscan",
"step_scan",
]
Loading