-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
87 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from ophyd_async.epics.motion import Motor | ||
|
||
|
||
class Mirror(Motor): | ||
def __init__(self, prefix: str, name: str = "") -> None: | ||
self.prefix = prefix | ||
super().__init__(name) | ||
self._mirror = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from ophyd_async.epics.signal import epics_signal_rw | ||
|
||
|
||
class Stage2d: | ||
def __init__(self, prefix: str, name: str = "") -> None: | ||
self.x = epics_signal_rw(name + "_x", prefix + ":x") | ||
self.y = epics_signal_rw(name + "_y", prefix + ":y") | ||
self.prefix = prefix | ||
super().__init__(name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
from pathlib import Path | ||
from typing import Any | ||
|
||
import bluesky.preprocessors as bpp | ||
from dodal.common import MsgGenerator, inject | ||
from ophyd_async.core import HardwareTriggeredFlyable, StandardDetector | ||
from ophyd_async.core.device_save_loader import Device, load_device | ||
from ophyd_async.panda import HDFPanda, StaticSeqTableTriggerLogic | ||
|
||
DEFAULT_WEBCAM = inject("webcam") | ||
DEFAULT_PANDA = inject("panda1") | ||
|
||
ROOT_CONFIG_SAVES_DIR = Path(__file__).parent.parent.parent / "pvs" / "basic_plan" | ||
|
||
|
||
def basic_plan( | ||
panda: HDFPanda = DEFAULT_PANDA, | ||
metadata: dict[str, Any] | None = None, | ||
webcam: Device = DEFAULT_WEBCAM, | ||
exposure: float = 1.0, | ||
) -> MsgGenerator: | ||
""" | ||
Description | ||
Args: | ||
panda: PandA for controlling flyable motion | ||
exposure: exposure time of detectors | ||
metadata: metadata: Key-value metadata to include in exported data, | ||
defaults to None. | ||
Returns: | ||
MsgGenerator: Plan | ||
Yields: | ||
Iterator[MsgGenerator]: Bluesky messages | ||
""" | ||
detectors = {webcam} | ||
|
||
plan_args = { | ||
"exposure": exposure, | ||
"panda": repr(panda), | ||
} | ||
_md = { | ||
"detectors": {device.name for device in detectors}, | ||
"motors": {linkam.name}, | ||
"plan_args": plan_args, | ||
# TODO: Can we pass dimensional hint? motors? shape? | ||
"hints": {}, | ||
} | ||
_md.update(metadata or {}) | ||
|
||
for device in detectors: | ||
yield from load_device(device, ROOT_CONFIG_SAVES_DIR / device.__name__) | ||
|
||
load_device(panda, ROOT_CONFIG_SAVES_DIR, panda.__name__) | ||
|
||
devices = detectors | ||
|
||
@bpp.stage_decorator(devices) | ||
@bpp.run_decorator(md=_md) | ||
def inner_plan(): | ||
yield from {} | ||
|
||
rs_uid = yield from inner_plan() | ||
return rs_uid |