Skip to content
Open
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
6 changes: 6 additions & 0 deletions src/dodal/beamlines/i19_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
AccessControlledPiezoActuator,
FocusingMirrorName,
)
from dodal.devices.beamlines.i19.access_controlled.read_only_dcm import ReadOnlyDCM
from dodal.devices.beamlines.i19.access_controlled.shutter import (
AccessControlledShutter,
)
Expand Down Expand Up @@ -67,6 +68,11 @@ def config_client() -> ConfigClient:
return client


@devices.factory()
def read_only_dcm() -> ReadOnlyDCM:
return ReadOnlyDCM(prefix=f"{PREFIX.beamline_prefix}-MO-DCM-01:")


@devices.factory()
def attenuator_motor_squad() -> AttenuatorMotorSquad:
return AttenuatorMotorSquad(
Expand Down
6 changes: 6 additions & 0 deletions src/dodal/beamlines/i19_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
AccessControlledPiezoActuator,
FocusingMirrorName,
)
from dodal.devices.beamlines.i19.access_controlled.read_only_dcm import ReadOnlyDCM
from dodal.devices.beamlines.i19.access_controlled.shutter import (
AccessControlledShutter,
)
Expand Down Expand Up @@ -73,6 +74,11 @@ def path_provider() -> PathProvider:
)


@devices.factory()
def read_only_dcm() -> ReadOnlyDCM:
return ReadOnlyDCM(prefix=f"{PREFIX.beamline_prefix}-MO-DCM-01:")


@devices.factory()
def attenuator_motor_squad() -> AttenuatorMotorSquad:
return AttenuatorMotorSquad(
Expand Down
14 changes: 14 additions & 0 deletions src/dodal/beamlines/i19_optics.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
ACCESS_DEVICE_NAME,
HutchAccessControl,
)
from dodal.devices.common_dcm import (
DoubleCrystalMonochromatorWithDSpacing,
PitchAndRollCrystal,
StationaryCrystal,
)
from dodal.devices.focusing_mirror import FocusingMirrorWithPiezo
from dodal.devices.hutch_shutter import InterlockedHutchShutter
from dodal.devices.interlocks import PSSInterlock
Expand All @@ -24,6 +29,15 @@
devices = DeviceManager()


@devices.factory()
def dcm() -> DoubleCrystalMonochromatorWithDSpacing:
return DoubleCrystalMonochromatorWithDSpacing(
prefix=f"{PREFIX.beamline_prefix}-MO-DCM-01:",
xtal_1=StationaryCrystal,
xtal_2=PitchAndRollCrystal,
)


@devices.factory()
def access_control() -> HutchAccessControl:
"""Device factory for access control device.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from ophyd_async.core import StandardReadable
from ophyd_async.epics.core import epics_signal_r


class ReadOnlyDCM(StandardReadable):
def __init__(
Comment thread
Matt-Carre marked this conversation as resolved.
self,
prefix: str,
name: str = "",
) -> None:
with self.add_children_as_readables():
self.energy_in_eV = epics_signal_r(float, f"{prefix}ENERGY")
self.wavelength_in_a = epics_signal_r(float, f"{prefix}WAVELENGTH")

super().__init__(prefix)
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import pytest
from bluesky.run_engine import RunEngine
from ophyd_async.core import set_mock_value
from ophyd_async.testing import assert_reading, partial_reading

from dodal.devices.beamlines.i19.access_controlled.read_only_dcm import ReadOnlyDCM


@pytest.fixture
async def mock_dcm() -> ReadOnlyDCM:
mock_dcm = ReadOnlyDCM(prefix="FOO-MO")
await mock_dcm.connect(mock=True)
set_mock_value(mock_dcm.energy_in_eV, 1)
set_mock_value(mock_dcm.wavelength_in_a, 100)
return mock_dcm


async def test_reading(mock_dcm: ReadOnlyDCM, run_engine: RunEngine):
prefix = "FOO-MO"
await assert_reading(
mock_dcm,
{
f"{prefix}-energy_in_eV": partial_reading(1.0),
f"{prefix}-wavelength_in_a": partial_reading(100.0),
},
False,
)
Loading