Skip to content

Commit

Permalink
add initial devices
Browse files Browse the repository at this point in the history
  • Loading branch information
stan-dot committed Jul 17, 2024
1 parent 96a5b31 commit e447c84
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ classifiers = [
"Programming Language :: Python :: 3.11",
]
description = "visible light experiments at the ViSR mini-beamline"
dependencies = [] # Add project dependencies here, e.g. ["click", "numpy"]
dependencies = [
"dls_dodal @ git+https://github.com/DiamondLightSource/dodal",
"ophyd_async",
"numpy<2.0.0",
] # Add project dependencies here, e.g. ["click", "numpy"]
dynamic = ["version"]
license.file = "LICENSE"
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.10"

[project.optional-dependencies]
dev = [
Expand Down
8 changes: 8 additions & 0 deletions src/visr/devices/mirror.py
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
9 changes: 9 additions & 0 deletions src/visr/devices/stage2d.py
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)
66 changes: 66 additions & 0 deletions src/visr/plans/basic_plan.py
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

0 comments on commit e447c84

Please sign in to comment.