Skip to content

Commit

Permalink
Add a dcm device for I24 (#652)
Browse files Browse the repository at this point in the history
* First dcm commit

* Add basic dcm device for i24
  • Loading branch information
noemifrisina authored Jul 19, 2024
1 parent a5b3fc5 commit e4c3d5a
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/dodal/beamlines/i24.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from dodal.devices.hutch_shutter import HutchShutter
from dodal.devices.i24.aperture import Aperture
from dodal.devices.i24.beamstop import Beamstop
from dodal.devices.i24.dcm import DCM
from dodal.devices.i24.dual_backlight import DualBacklight
from dodal.devices.i24.I24_detector_motion import DetectorMotion
from dodal.devices.i24.i24_vgonio import VGonio
Expand Down Expand Up @@ -82,6 +83,19 @@ def detector_motion(
)


def dcm(wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False) -> DCM:
"""Get the i24 DCM device, instantiate it if it hasn't already been.
If this is called when already instantiated in i24, it will return the existing object.
"""
return device_instantiation(
device_factory=DCM,
name="dcm",
prefix="",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
)


@skip_device(lambda: BL == "s24")
def eiger(
wait_for_connection: bool = True,
Expand Down
42 changes: 42 additions & 0 deletions src/dodal/devices/i24/dcm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from ophyd_async.core import StandardReadable
from ophyd_async.epics.motion import Motor
from ophyd_async.epics.signal import epics_signal_r


class DCM(StandardReadable):
"""
A double crystal monocromator device, used to select the beam energy.
"""

def __init__(self, prefix: str, name: str = "") -> None:
with self.add_children_as_readables():
# Motors
self.bragg_in_degrees = Motor(prefix + "-MO-DCM-01:BRAGG")
self.x_translation_in_mm = Motor(prefix + "-MO-DCM-01:X")
self.offset_in_mm = Motor(prefix + "-MO-DCM-01:OFFSET")
self.gap_in_mm = Motor(prefix + "-MO-DCM-01:GAP")
self.energy_in_kev = Motor(prefix + "-MO-DCM-01:ENERGY")
self.xtal1_roll = Motor(prefix + "-MO-DCM-01:XTAL1:ROLL")
self.xtal2_roll = Motor(prefix + "-MO-DCM-01:XTAL2:ROLL")
self.xtal2_pitch = Motor(prefix + "-MO-DCM-01:XTAL2:PITCH")

# Wavelength is calculated in epics from the energy
self.wavelength_in_a = epics_signal_r(float, prefix + "-MO-DCM-01:LAMBDA")

# Temperatures
self.xtal1_temp = epics_signal_r(float, prefix + "-DI-DCM-01:PT100-1")
self.xtal1_heater_temp = epics_signal_r(
float, prefix + "-DI-DCM-01:PT100-2"
)
self.xtal2_temp = epics_signal_r(float, prefix + "-DI-DCM-01:PT100-4")
self.xtal2_heater_temp = epics_signal_r(
float, prefix + "-DI-DCM-01:PT100-5"
)

self.roll_plate_temp = epics_signal_r(float, prefix + "-DI-DCM-01:PT100-3")
self.pitch_plate_temp = epics_signal_r(float, prefix + "-DI-DCM-01:PT100-6")
self.backplate_temp = epics_signal_r(float, prefix + "-DI-DCM-01:PT100-7")
self.b1_plate_temp = epics_signal_r(float, prefix + "-DI-DCM-01:PT100-7")
self.gap_temp = epics_signal_r(float, prefix + "-DI-DCM-01:TC-1")

super().__init__(name)

0 comments on commit e4c3d5a

Please sign in to comment.