diff --git a/src/dodal/beamlines/i19_optics.py b/src/dodal/beamlines/i19_optics.py index 16f210a73f..8378721845 100644 --- a/src/dodal/beamlines/i19_optics.py +++ b/src/dodal/beamlines/i19_optics.py @@ -1,8 +1,14 @@ +from functools import cache + +from daq_config_server import ConfigClient from ophyd_async.epics.motor import Motor from dodal.common.beamlines.beamline_utils import ( set_beamline as set_utils_beamline, ) +from dodal.common.beamlines.beamline_utils import ( + set_config_client, +) from dodal.device_manager import DeviceManager from dodal.devices.attenuator.filter import FilterWheel from dodal.devices.attenuator.filter_selections import I19FilterOneSelections @@ -18,6 +24,7 @@ from dodal.devices.focusing_mirror import FocusingMirrorWithPiezo from dodal.devices.hutch_shutter import InterlockedHutchShutter from dodal.devices.interlocks import PSSInterlock +from dodal.devices.undulator import UndulatorInKeV from dodal.log import set_beamline as set_log_beamline from dodal.utils import BeamlinePrefix @@ -26,16 +33,25 @@ set_log_beamline(BL) set_utils_beamline(BL) +# For the moment pointing to the daq_configuration path in i19-1 which has links to the +# common optics configuration, as it's already present in the daq-config-server. +# The correct path will have to wait for this PR +# https://github.com/DiamondLightSource/daq-config-server/pull/186 to be merged and +# a subsequent release +DAQ_CONFIGURATION_PATH = "/dls_sw/i19-1/software/daq_configuration" +ID_GAP_LOOKUP = ( + f"{DAQ_CONFIGURATION_PATH}/lookup-shared/energy_to_id_gap_look_up_table.txt" +) + devices = DeviceManager() -@devices.factory() -def dcm() -> DoubleCrystalMonochromatorWithDSpacing: - return DoubleCrystalMonochromatorWithDSpacing( - prefix=f"{PREFIX.beamline_prefix}-MO-DCM-01:", - xtal_1=StationaryCrystal, - xtal_2=PitchAndRollCrystal, - ) +@devices.fixture +@cache +def config_client() -> ConfigClient: + client = ConfigClient() + set_config_client(client) + return client @devices.factory() @@ -88,6 +104,15 @@ def attenuator_y_motor() -> Motor: return Motor(f"{PREFIX.beamline_prefix}-OP-ATTN-05:Y", "attenuator_y") +@devices.factory() +def dcm() -> DoubleCrystalMonochromatorWithDSpacing: + return DoubleCrystalMonochromatorWithDSpacing( + prefix=f"{PREFIX.beamline_prefix}-MO-DCM-01:", + xtal_1=StationaryCrystal, + xtal_2=PitchAndRollCrystal, + ) + + # Temporarily skipping as the IOC is being worked on and not in use @devices.factory(skip=True) def filter_wheel() -> FilterWheel: @@ -143,6 +168,15 @@ def shutter() -> InterlockedHutchShutter: ) +@devices.factory() +def undulator(config_client: ConfigClient) -> UndulatorInKeV: + return UndulatorInKeV( + f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-01:", + config_client=config_client, + id_gap_lookup_table_path=ID_GAP_LOOKUP, + ) + + @devices.factory() def vfm() -> FocusingMirrorWithPiezo: """Device factory for the I19 Vertical Focus Mirror (VFM) Piezo Device.