Skip to content

Commit

Permalink
restore the thor labs stage and cancel the xpress3 not working one
Browse files Browse the repository at this point in the history
  • Loading branch information
stan-dot committed Jan 16, 2025
1 parent b10215d commit 7349018
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/dodal/beamlines/i18.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from dodal.devices.i18.diode import Diode
from dodal.devices.i18.KBMirror import KBMirror
from dodal.devices.i18.table import Table
from dodal.devices.i18.thor_labs_stage import ThorLabsStage
from dodal.devices.i22.dcm import CrystalMetadata, DoubleCrystalMonochromator
from dodal.devices.slits import Slits
from dodal.devices.synchrotron import Synchrotron
Expand Down Expand Up @@ -103,19 +104,6 @@ def panda1(
)


def xspress3(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> Xspress3:
return device_instantiation(
Xspress3,
prefix="-EA-XSP-02:",
name="xspress3",
num_channels=16,
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
)


# odin detectors are not yet supported.
# There is a controls project in the works,
# not ready anytime soon
Expand All @@ -125,7 +113,7 @@ def xspress3_odin(
) -> Xspress3:
return device_instantiation(
Xspress3,
prefix="-EA-XSP-03:",
prefix="-EA-XSP-02:",
name="xspress3_odin",
num_channels=4,
wait=wait_for_connection,
Expand Down Expand Up @@ -274,3 +262,15 @@ def raster_stage(
wait_for_connection,
fake_with_ophyd_sim,
)


def thor_labs_table(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> ThorLabsStage:
return device_instantiation(
ThorLabsStage,
"table",
"-MO-TABLE-02:",
wait_for_connection,
fake_with_ophyd_sim,
)
24 changes: 24 additions & 0 deletions src/dodal/devices/i18/thor_labs_stage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from ophyd_async.core import (
AsyncStatus,
StandardReadable,
)
from ophyd_async.epics.motor import Motor
from pydantic import BaseModel


class XYPosition(BaseModel):
x: float
y: float


class ThorLabsStage(StandardReadable):
def __init__(self, prefix: str = "", name: str = "") -> None:
with self.add_children_as_readables():
self.x = Motor(prefix + "X")
self.y = Motor(prefix + "Y")
super().__init__(name=name)

@AsyncStatus.wrap
async def set(self, value: XYPosition):
self.x.set(value.x)
self.y.set(value.y)

0 comments on commit 7349018

Please sign in to comment.