Skip to content
Draft
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
4 changes: 1 addition & 3 deletions src/dodal/beamlines/adsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ def path_provider():

@devices.factory()
def stage() -> XThetaStage:
return XThetaStage(
f"{PREFIX.beamline_prefix}-MO-SIMC-01:", x_infix="M1", theta_infix="M2"
)
return XThetaStage(f"{PREFIX.beamline_prefix}-MO-SIMC-01:", x="M1", theta="M2")


@devices.factory()
Expand Down
4 changes: 1 addition & 3 deletions src/dodal/beamlines/b07.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,4 @@ def sm52b() -> B07SampleManipulator52B:
@devices.factory()
def sm21b() -> XYZPolarStage:
"""Sample manipulator. NOTE: The polar attribute is equivalent to GDA roty."""
return XYZPolarStage(
prefix=f"{B_PREFIX.beamline_prefix}-EA-SM-21:", polar_infix="ROTY"
)
return XYZPolarStage(prefix=f"{B_PREFIX.beamline_prefix}-EA-SM-21:", polar="ROTY")
8 changes: 4 additions & 4 deletions src/dodal/beamlines/i15.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from dodal.devices.beamlines.i15.jack import JackX, JackY
from dodal.devices.beamlines.i15.motors import UpstreamDownstreamPair
from dodal.devices.motors import (
SixAxisGonioKappaPhi,
XYStage,
XYZKappaPhiStage,
XYZPitchYawStage,
XYZStage,
)
Expand Down Expand Up @@ -73,10 +73,10 @@ def det2z() -> Motor:


@devices.factory()
def diffractometer() -> SixAxisGonioKappaPhi:
return SixAxisGonioKappaPhi(
def diffractometer() -> XYZKappaPhiStage:
return XYZKappaPhiStage(
prefix=f"{PREFIX.beamline_prefix}-MO-DIFF-01:SAMPLE:",
phi_infix="KPHI",
infix_overrides={"phi": "KPHI"},
)


Expand Down
6 changes: 3 additions & 3 deletions src/dodal/beamlines/i23.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from dodal.common.beamlines.device_helpers import HDF5_SUFFIX
from dodal.common.visit import LocalDirectoryServiceClient, StaticVisitPathProvider
from dodal.device_manager import DeviceManager
from dodal.devices.motors import SixAxisGonio
from dodal.devices.motors import XYZOmegaKappaPhiStage
from dodal.devices.oav.pin_image_recognition import PinTipDetection
from dodal.devices.positioner import Positioner1D
from dodal.devices.zebra.zebra import Zebra
Expand Down Expand Up @@ -73,8 +73,8 @@ def shutter() -> ZebraShutter:


@devices.factory()
def gonio() -> SixAxisGonio:
return SixAxisGonio(f"{PREFIX.beamline_prefix}-MO-GONIO-01:")
def gonio() -> XYZOmegaKappaPhiStage:
return XYZOmegaKappaPhiStage(f"{PREFIX.beamline_prefix}-MO-GONIO-01:")


@devices.factory()
Expand Down
29 changes: 12 additions & 17 deletions src/dodal/devices/aithre_lasershaping/goniometer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
from typing import Annotated

from ophyd_async.epics.motor import Motor

from dodal.devices.motors import XYZOmegaStage, create_axis_perp_to_rotation
from dodal.devices.motors import (
DefaultInfix,
XYZOmegaStage,
create_axis_perp_to_rotation,
)


class Goniometer(XYZOmegaStage):
Expand All @@ -15,28 +21,17 @@ class Goniometer(XYZOmegaStage):
regardless of the current rotation.
"""

sampy: Annotated[Motor, DefaultInfix("SAMPY")]
sampz: Annotated[Motor, DefaultInfix("SAMPZ")]

def __init__(
self,
prefix: str,
name: str = "",
x_infix: str = "X",
y_infix: str = "Y",
z_infix: str = "Z",
omega_infix: str = "OMEGA",
sampy_infix: str = "SAMPY",
sampz_infix: str = "SAMPZ",
**motor_infix_overrides,
) -> None:
super().__init__(
prefix=prefix,
name=name,
x_infix=x_infix,
y_infix=y_infix,
z_infix=z_infix,
omega_infix=omega_infix,
)
super().__init__(prefix=prefix, name=name, **motor_infix_overrides)
with self.add_children_as_readables():
self.sampy = Motor(prefix + sampy_infix)
self.sampz = Motor(prefix + sampz_infix)
self.vertical_position = create_axis_perp_to_rotation(
self.omega, self.sampz, self.sampy
)
44 changes: 12 additions & 32 deletions src/dodal/devices/beamlines/b07/b07_motors.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from typing import Annotated

from bluesky.protocols import Movable
from ophyd_async.core import AsyncStatus, StandardReadable, StandardReadableFormat
from ophyd_async.epics.core import epics_signal_rw_rbv
from ophyd_async.epics.motor import Motor

from dodal.devices.motors import _OMEGA, XYZStage
from dodal.devices.motors import _OMEGA, DefaultInfix, XYZStage


class VirtualAxis(StandardReadable, Movable[float]):
Expand Down Expand Up @@ -49,52 +51,30 @@ class B07SampleManipulator52B(XYZStage):
kappa (VirtualAxis): Virtal rotational axis for the z direction.
"""

roty: Annotated[Motor, DefaultInfix("ROTY")]
rotz: Annotated[Motor, DefaultInfix("ROTZ")]
xp: Annotated[Motor, DefaultInfix("XP")]
yp: Annotated[Motor, DefaultInfix("YP")]
zp: Annotated[Motor, DefaultInfix("ZP")]

def __init__(
self,
prefix: str,
x_infix: str = "XP",
y_infix: str = "YP",
z_infix: str = "ZP",
roty_infix: str = "ROTY",
rotz_infix: str = "ROTZ",
kappa_infix: str = "KAPPA",
phi_infix: str = "PHI",
omega_infix: str = _OMEGA,
name: str = "",
**motor_infix_overrides: str,
):
"""Initialise the device via prefix and infix PV configuration.

Args:
prefix (str): Base PV used for connecting signals.
x_infix (str, optional): Infix between base prefix and x motor record.
y_infix (str, optional): Infix between base prefix and y motor record.
z_infix (str, optional): Infix between base prefix and z motor record.
roty_infix (str, optional): Infix between base prefix and roty motor record.
rotz_infix (str, optional): Infix between base prefix and rotz motor record.
kappa_infix (str, optional): Infix between base prefix and kappa virtual axis.
phi_infix (str, optional): Infix between base prefix and phi virtual axis.
omega_infix (str, optional): Infix between base prefix and omega virtual axis.
name (str, optional): The name of this device.
"""
"""Initialise the device via prefix and infix PV configuration."""
with self.add_children_as_readables():
# Compound motors
self.xp = Motor(prefix + x_infix)
self.yp = Motor(prefix + y_infix)
self.zp = Motor(prefix + z_infix)

# Raw motors
self.roty = Motor(prefix + roty_infix)
self.rotz = Motor(prefix + rotz_infix)

# Not standard motors, virtual axes coordinate system.
self.kappa = VirtualAxis(prefix + kappa_infix)
self.phi = VirtualAxis(prefix + phi_infix)
self.omega = VirtualAxis(prefix + omega_infix)

super().__init__(
prefix=prefix,
x_infix=x_infix,
y_infix=y_infix,
z_infix=z_infix,
name=name,
**motor_infix_overrides,
)
47 changes: 12 additions & 35 deletions src/dodal/devices/beamlines/i11/diff_stages.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from typing import Annotated

from ophyd_async.epics.motor import Motor

from dodal.devices.motors import Stage
from dodal.devices.motors import DefaultInfix, Stage


class DiffractometerStage(Stage):
Expand All @@ -9,22 +11,10 @@ class DiffractometerStage(Stage):
theta, delta, two_theta, sample_position.
"""

def __init__(
self,
prefix: str,
name: str = "",
theta_suffix: str = "THETA",
delta_suffix: str = "DELTA",
two_theta_suffix: str = "2THETA",
sample_pos_suffix: str = "SPOS",
):
with self.add_children_as_readables():
self.theta = Motor(prefix + theta_suffix)
self.delta = Motor(prefix + delta_suffix)
self.two_theta = Motor(prefix + two_theta_suffix)
self.sample_position = Motor(prefix + sample_pos_suffix)

super().__init__(name=name)
theta: Annotated[Motor, DefaultInfix("THETA")]
delta: Annotated[Motor, DefaultInfix("DELTA")]
two_theta: Annotated[Motor, DefaultInfix("2THETA")]
sample_position: Annotated[Motor, DefaultInfix("SPOS")]


class DiffractometerBase(Stage):
Expand All @@ -33,21 +23,8 @@ class DiffractometerBase(Stage):
x1, x2, y1, y2, y3. Used for aligning the detector to the beam/sample.
"""

def __init__(
self,
prefix: str,
name: str = "",
x1_suffix: str = "X1",
x2_suffix: str = "X2",
y1_suffix: str = "Y1",
y2_suffix: str = "Y2",
y3_suffix: str = "Y3",
):
with self.add_children_as_readables():
self.x1 = Motor(prefix + x1_suffix)
self.x2 = Motor(prefix + x2_suffix)
self.y1 = Motor(prefix + y1_suffix)
self.y2 = Motor(prefix + y2_suffix)
self.y3 = Motor(prefix + y3_suffix)

super().__init__(name=name)
x1: Annotated[Motor, DefaultInfix("X1")]
x2: Annotated[Motor, DefaultInfix("X2")]
y1: Annotated[Motor, DefaultInfix("Y1")]
y2: Annotated[Motor, DefaultInfix("Y2")]
y3: Annotated[Motor, DefaultInfix("Y3")]
27 changes: 8 additions & 19 deletions src/dodal/devices/beamlines/i15/motors.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
from typing import Annotated

from ophyd_async.epics.motor import Motor

from dodal.devices.motors import Stage
from dodal.devices.motors import DefaultInfix, Stage


class UpstreamDownstreamPair(Stage):
def __init__(self, prefix: str, name: str = ""):
with self.add_children_as_readables():
self.upstream = Motor(prefix + "US")
self.downstream = Motor(prefix + "DS")
super().__init__(name=name)
upstream: Annotated[Motor, DefaultInfix("US")]
downstream: Annotated[Motor, DefaultInfix("DS")]


class NumberedTripleAxisStage(Stage):
def __init__(
self,
prefix: str,
name: str = "",
axis1_infix: str = "AXIS1",
axis2_infix: str = "AXIS2",
axis3_infix: str = "AXIS3",
):
with self.add_children_as_readables():
self.axis1 = Motor(prefix + axis1_infix)
self.axis2 = Motor(prefix + axis2_infix)
self.axis3 = Motor(prefix + axis3_infix)
super().__init__(name=name)
axis1: Annotated[Motor, DefaultInfix("AXIS1")]
axis2: Annotated[Motor, DefaultInfix("AXIS2")]
axis3: Annotated[Motor, DefaultInfix("AXIS3")]
Loading
Loading