diff --git a/src/dodal/beamlines/i03.py b/src/dodal/beamlines/i03.py index 964c2aef87f..9a4d30e1f54 100644 --- a/src/dodal/beamlines/i03.py +++ b/src/dodal/beamlines/i03.py @@ -9,6 +9,7 @@ from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline from dodal.common.beamlines.beamline_utils import set_path_provider from dodal.common.beamlines.commissioning_mode import set_commissioning_signal +from dodal.common.beamlines.config_client import get_config_client from dodal.common.udc_directory_provider import PandASubpathProvider from dodal.device_manager import DeviceManager from dodal.devices.aperturescatterguard import ( @@ -226,6 +227,7 @@ def synchrotron() -> Synchrotron: def undulator(baton: Baton, daq_configuration_path: str) -> UndulatorInKeV: return UndulatorInKeV( f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-01:", + config_client=get_config_client(BL), id_gap_lookup_table_path=f"{daq_configuration_path}/lookup/BeamLine_Undulator_toGap.txt", baton=baton, ) diff --git a/src/dodal/beamlines/i04.py b/src/dodal/beamlines/i04.py index 95e0cc6c0e7..b69f621fe59 100644 --- a/src/dodal/beamlines/i04.py +++ b/src/dodal/beamlines/i04.py @@ -2,6 +2,7 @@ from dodal.common.beamlines.beamline_parameters import get_beamline_parameters from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline +from dodal.common.beamlines.config_client import get_config_client from dodal.device_manager import DeviceManager from dodal.devices.aperturescatterguard import ( AperturePosition, @@ -182,6 +183,7 @@ def daq_configuration_path() -> str: def undulator(baton: Baton, daq_configuration_path: str) -> UndulatorInKeV: return UndulatorInKeV( prefix=f"{PREFIX.insertion_prefix}-MO-SERVC-01:", + config_client=get_config_client(BL), id_gap_lookup_table_path=f"{daq_configuration_path}/lookup/BeamLine_Undulator_toGap.txt", baton=baton, ) diff --git a/src/dodal/beamlines/i07.py b/src/dodal/beamlines/i07.py index df344f25657..0ec3137ee19 100644 --- a/src/dodal/beamlines/i07.py +++ b/src/dodal/beamlines/i07.py @@ -1,4 +1,5 @@ from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline +from dodal.common.beamlines.config_client import get_config_client from dodal.device_manager import DeviceManager from dodal.devices.beamlines.i07.dcm import DCM from dodal.devices.beamlines.i07.id import InsertionDevice @@ -35,5 +36,6 @@ def id(harmonic: UndulatorOrder) -> InsertionDevice: return InsertionDevice( f"{PREFIX.insertion_prefix}-MO-SERVC-01:", harmonic, + get_config_client(BL), id_gap_lookup_table_path="/dls_sw/i07/software/gda/config/lookupTables/IIDCalibrationTable.txt", ) diff --git a/src/dodal/beamlines/i18.py b/src/dodal/beamlines/i18.py index f52772220d4..8698bba157d 100644 --- a/src/dodal/beamlines/i18.py +++ b/src/dodal/beamlines/i18.py @@ -8,6 +8,7 @@ set_path_provider, ) from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline +from dodal.common.beamlines.config_client import get_config_client from dodal.common.visit import ( LocalDirectoryServiceClient, StaticVisitPathProvider, @@ -54,7 +55,9 @@ def synchrotron() -> Synchrotron: @device_factory() def undulator() -> UndulatorInKeV: - return UndulatorInKeV(f"{PREFIX.insertion_prefix}-MO-SERVC-01:") + return UndulatorInKeV( + f"{PREFIX.insertion_prefix}-MO-SERVC-01:", get_config_client(BL) + ) # See https://github.com/DiamondLightSource/dodal/issues/1180 diff --git a/src/dodal/beamlines/i22.py b/src/dodal/beamlines/i22.py index 2373220569c..d09c8ab2cc6 100644 --- a/src/dodal/beamlines/i22.py +++ b/src/dodal/beamlines/i22.py @@ -12,6 +12,7 @@ from ophyd_async.fastcs.panda import HDFPanda from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline +from dodal.common.beamlines.config_client import get_config_client from dodal.common.beamlines.device_helpers import CAM_SUFFIX, DET_SUFFIX, HDF5_SUFFIX from dodal.common.crystal_metadata import ( MaterialsEnum, @@ -181,6 +182,7 @@ def dcm() -> DCM: def undulator() -> UndulatorInKeV: return UndulatorInKeV( prefix=f"{PREFIX.insertion_prefix}-MO-SERVC-01:", + config_client=get_config_client(BL), id_gap_lookup_table_path="/dls_sw/i22/software/daq_configuration/lookup/BeamLine_Undulator_toGap.txt", poles=80, length=2.0, diff --git a/src/dodal/beamlines/p38.py b/src/dodal/beamlines/p38.py index c4fc10f0a31..a750bc8d722 100644 --- a/src/dodal/beamlines/p38.py +++ b/src/dodal/beamlines/p38.py @@ -9,6 +9,7 @@ set_path_provider, ) from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline +from dodal.common.beamlines.config_client import get_config_client from dodal.common.beamlines.device_helpers import HDF5_SUFFIX from dodal.common.crystal_metadata import ( MaterialsEnum, @@ -160,6 +161,7 @@ def dcm() -> DCM: def undulator() -> UndulatorInKeV: return UndulatorInKeV( f"{PREFIX.insertion_prefix}-MO-SERVC-01:", + get_config_client(BL), poles=80, length=2.0, ) diff --git a/src/dodal/common/beamlines/config_client.py b/src/dodal/common/beamlines/config_client.py index 6bd66bf3fee..1194573e61e 100644 --- a/src/dodal/common/beamlines/config_client.py +++ b/src/dodal/common/beamlines/config_client.py @@ -4,12 +4,14 @@ BEAMLINE_CONFIG_SERVER_ENDPOINTS = { "i03": "https://i03-daq-config.diamond.ac.uk", - "i04": "https://daq-config.diamond.ac.uk", + "i04": "https://i04-daq-config.diamond.ac.uk", } @cache def get_config_client(beamline: str) -> ConfigClient: + print(beamline) + print(BEAMLINE_CONFIG_SERVER_ENDPOINTS) url = BEAMLINE_CONFIG_SERVER_ENDPOINTS.get( beamline, "https://daq-config.diamond.ac.uk" ) diff --git a/src/dodal/devices/beamlines/i07/id.py b/src/dodal/devices/beamlines/i07/id.py index f33e12c042f..dd2334a281f 100644 --- a/src/dodal/devices/beamlines/i07/id.py +++ b/src/dodal/devices/beamlines/i07/id.py @@ -1,4 +1,5 @@ import numpy as np +from daq_config_server import ConfigClient from dodal.devices.undulator import UndulatorInKeV, UndulatorOrder from dodal.devices.util.lookup_tables import energy_distance_table @@ -13,11 +14,12 @@ def __init__( self, prefix: str, harmonic: UndulatorOrder, + config_client: ConfigClient, id_gap_lookup_table_path: str = "/dls_sw/i07/software/gda/config/lookupTables/" + "IIDCalibrationTable.txt", name: str = "", ): - super().__init__(prefix, id_gap_lookup_table_path, name=name) + super().__init__(prefix, config_client, id_gap_lookup_table_path, name=name) self.harmonic = harmonic async def _get_gap_to_match_energy(self, energy_kev: float) -> float: diff --git a/src/dodal/devices/undulator.py b/src/dodal/devices/undulator.py index 962ad2013fe..b465352845b 100644 --- a/src/dodal/devices/undulator.py +++ b/src/dodal/devices/undulator.py @@ -3,6 +3,10 @@ import numpy as np from bluesky.protocols import Locatable, Location, Movable +from daq_config_server import ConfigClient +from daq_config_server.models.lookup_tables.insertion_device import ( + UndulatorEnergyGapLookupTable, +) from numpy import ndarray from ophyd_async.core import ( AsyncStatus, @@ -19,7 +23,6 @@ from dodal.log import LOGGER from .baton import Baton -from .util.lookup_tables import energy_distance_table class AccessError(Exception): @@ -172,6 +175,7 @@ class UndulatorInKeV(BaseUndulator): def __init__( self, prefix: str, + config_client: ConfigClient, id_gap_lookup_table_path: str = os.devnull, poles: int | None = None, length: float | None = None, @@ -179,6 +183,8 @@ def __init__( baton: Baton | None = None, name: str = "", ) -> None: + self.config_server = config_client + self.id_gap_lookup_table_path = id_gap_lookup_table_path super().__init__( prefix=prefix, @@ -207,14 +213,16 @@ async def _get_gap_to_match_energy(self, energy_kev: float) -> float: """Get a 2d np.array from lookup table that converts energies to undulator gap distance. """ - energy_to_distance_table: np.ndarray = await energy_distance_table( - self.id_gap_lookup_table_path + energy_to_distance_table = self.config_server.get_file_contents( + self.id_gap_lookup_table_path, + UndulatorEnergyGapLookupTable, + reset_cached_result=True, ) # Use the lookup table to get the undulator gap associated with this dcm energy return _get_gap_for_energy( energy_kev * 1000, - energy_to_distance_table, + np.array(energy_to_distance_table.rows), ) diff --git a/tests/common/beamlines/test_config_client.py b/tests/common/beamlines/test_config_client.py index ef5674cb34b..a9420cac89e 100644 --- a/tests/common/beamlines/test_config_client.py +++ b/tests/common/beamlines/test_config_client.py @@ -1,5 +1,7 @@ from unittest.mock import MagicMock, patch +import pytest + from dodal.common.beamlines.config_client import get_config_client @@ -11,22 +13,20 @@ def test_by_default_get_config_client_uses_centrally_deployed_config_server( mock_config_client.assert_called_once_with(url="https://daq-config.diamond.ac.uk") +@pytest.mark.parametrize( + "beamline, expected_url", + [ + ("i03", "https://i03-daq-config.diamond.ac.uk"), + ("i04", "https://i04-daq-config.diamond.ac.uk"), + ("default", "https://daq-config.diamond.ac.uk"), + ], +) @patch("dodal.common.beamlines.config_client.ConfigClient") -def test_get_config_client_uses_i03_beamline_cluster_server_for_i03( - mock_config_client: MagicMock, +def test_get_config_client_uses_correct_url_for_each_beamline( + mock_config_client: MagicMock, beamline: str, expected_url: str ): - get_config_client("i03") - mock_config_client.assert_called_once_with( - url="https://i03-daq-config.diamond.ac.uk" - ) - - -@patch("dodal.common.beamlines.config_client.ConfigClient") -def test_get_config_client_uses_centrally_deployed_config_server_for_i04( - mock_config_client: MagicMock, -): - get_config_client("i04") - mock_config_client.assert_called_once_with(url="https://daq-config.diamond.ac.uk") + get_config_client(beamline) + mock_config_client.assert_called_once_with(url=expected_url) @patch("dodal.common.beamlines.config_client.ConfigClient") @@ -45,7 +45,9 @@ def test_get_config_client_resets_cache_if_called_with_same_beamline( ): assert mock_config_client.assert_not_called get_config_client("i04") - mock_config_client.assert_called_once_with(url="https://daq-config.diamond.ac.uk") + mock_config_client.assert_called_once_with( + url="https://i04-daq-config.diamond.ac.uk" + ) get_config_client("i03") assert mock_config_client.call_count == 2 mock_config_client.assert_called_with(url="https://i03-daq-config.diamond.ac.uk") diff --git a/tests/conftest.py b/tests/conftest.py index 7c83dd8a692..46e5ed9306a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -177,3 +177,8 @@ def eiger_params(tmp_path: Path) -> DetectorParams: @pytest.fixture(autouse=True) def clear_cache(): get_config_client.cache_clear() + + +@pytest.fixture +def set_beamline_env_variable(monkeypatch): + monkeypatch.setenv("BEAMLINE", "test") diff --git a/tests/devices/beamlines/i03/test_undulator_dcm.py b/tests/devices/beamlines/i03/test_undulator_dcm.py index a6b9273cf34..670e70a09c0 100644 --- a/tests/devices/beamlines/i03/test_undulator_dcm.py +++ b/tests/devices/beamlines/i03/test_undulator_dcm.py @@ -3,6 +3,10 @@ import numpy as np import pytest +from daq_config_server import ConfigClient +from daq_config_server.models.lookup_tables.insertion_device import ( + UndulatorEnergyGapLookupTable, +) from ophyd_async.core import AsyncStatus, get_mock_put, init_devices, set_mock_value from dodal.common.enums import EnabledDisabledUpper @@ -48,6 +52,7 @@ async def fake_undulator_dcm() -> UndulatorDCM: baton = Baton("BATON-01:") undulator = UndulatorInKeV( "UND-01", + ConfigClient(""), name="undulator", poles=80, id_gap_lookup_table_path=TEST_BEAMLINE_UNDULATOR_TO_GAP_LUT, @@ -89,16 +94,26 @@ async def test_fixed_offset_decoded(fake_undulator_dcm: UndulatorDCM): assert fake_undulator_dcm.dcm_fixed_offset_mm == 25.6 -@patch("dodal.devices.util.lookup_tables.loadtxt") @patch("dodal.devices.undulator.LOGGER") async def test_if_gap_is_wrong_then_logger_info_is_called_and_gap_is_set_correctly( - mock_logger: MagicMock, mock_load: MagicMock, fake_undulator_dcm: UndulatorDCM + mock_logger: MagicMock, + fake_undulator_dcm: UndulatorDCM, ): + mock_config_server = MagicMock() + mock_config_server.get_file_contents = MagicMock( + return_value=UndulatorEnergyGapLookupTable( + rows=[ + [5700, 5.4606], + [7000, 6.045], + [9700, 6.404], + ], + ) + ) + fake_undulator_dcm.undulator_ref().config_server = mock_config_server + set_mock_value(fake_undulator_dcm.undulator_ref().current_gap, 5.3) set_mock_value(fake_undulator_dcm.dcm_ref().energy_in_keV.user_readback, 5.7) - mock_load.return_value = np.array([[5700, 5.4606], [7000, 6.045], [9700, 6.404]]) - await fake_undulator_dcm.set(6.9) assert ( diff --git a/tests/devices/beamlines/i07/test_id.py b/tests/devices/beamlines/i07/test_id.py index 999081b5219..07554ae898e 100644 --- a/tests/devices/beamlines/i07/test_id.py +++ b/tests/devices/beamlines/i07/test_id.py @@ -1,4 +1,5 @@ import pytest +from daq_config_server import ConfigClient from ophyd_async.core import init_devices from dodal.devices.beamlines.i07.id import InsertionDevice @@ -19,6 +20,7 @@ async def id(harmonic: UndulatorOrder) -> InsertionDevice: id = InsertionDevice( "ID-01", harmonic, + ConfigClient(""), TEST_LOOKUP_TABLE_PATH, ) return id diff --git a/tests/devices/test_daq_configuration/lookup/BeamLineEnergy_DCM_Pitch_converter.txt b/tests/devices/test_daq_configuration/lookup/BeamLineEnergy_DCM_Pitch_converter.txt index 449e920f738..54d32ddbe2b 100644 --- a/tests/devices/test_daq_configuration/lookup/BeamLineEnergy_DCM_Pitch_converter.txt +++ b/tests/devices/test_daq_configuration/lookup/BeamLineEnergy_DCM_Pitch_converter.txt @@ -1,25 +1,23 @@ -# Bragg pitch -# Degree values for pitch are interpreted as mrad -# The values cannot change direction. -# last update 2023/06/26 NP -Units Deg mrad -Units Deg Deg -19.24347 -0.79775 -16.40949 -0.78679 -14.31123 -0.77838 -12.69287 -0.77276 -11.40555 -0.77276 -10.35662 -0.77031 -9.48522 -0.76693 -8.95826 -0.76387 -8.74953 -0.76387 -8.12020 -0.76387 -7.57556 -0.76354 -7.09950 -0.76166 -6.67997 -0.76044 -6.30732 -0.75953 -5.97411 -0.75845 -5.67434 -0.75796 -5.40329 -0.75789 -5.15700 -0.75551 -4.93218 -0.75513 +{ + "rows": [ + [19.24347, -0.79775], + [16.40949, -0.78679], + [14.31123, -0.77838], + [12.69287, -0.77276], + [11.40555, -0.77276], + [10.35662, -0.77031], + [9.48522, -0.76693], + [8.95826, -0.76387], + [8.74953, -0.76387], + [8.1202, -0.76387], + [7.57556, -0.76354], + [7.0995, -0.76166], + [6.67997, -0.76044], + [6.30732, -0.75953], + [5.97411, -0.75845], + [5.67434, -0.75796], + [5.40329, -0.75789], + [5.157, -0.75551], + [4.93218, -0.75513] + ] +} diff --git a/tests/devices/test_daq_configuration/lookup/BeamLineEnergy_DCM_Roll_converter.txt b/tests/devices/test_daq_configuration/lookup/BeamLineEnergy_DCM_Roll_converter.txt index 9b5b52dcb78..7f2a6fc2f95 100644 --- a/tests/devices/test_daq_configuration/lookup/BeamLineEnergy_DCM_Roll_converter.txt +++ b/tests/devices/test_daq_configuration/lookup/BeamLineEnergy_DCM_Roll_converter.txt @@ -1,6 +1,6 @@ -#Bragg angle against roll( absolute number) -#reloadLookupTables() -# last update 2023/01/19 NP -Units Deg mrad -26.4095 -0.2799 -6.3075 -0.2799 +{ + "rows": [ + [26.4095, -0.2799], + [6.3075, -0.2799] + ] +} diff --git a/tests/devices/test_data/test_beamline_undulator_to_gap_lookup_table.txt b/tests/devices/test_data/test_beamline_undulator_to_gap_lookup_table.txt index 66a4fb684ee..21f20e04948 100644 --- a/tests/devices/test_data/test_beamline_undulator_to_gap_lookup_table.txt +++ b/tests/devices/test_data/test_beamline_undulator_to_gap_lookup_table.txt @@ -1,60 +1,54 @@ -####################### -# # -# 5.5mm CPMU 20/11/22 # -# # -####################### -# Used to convert from energy to gap. Constructed from tables for 3rd, 5th and 7th harmonic. -# It is important that at the point of change from one harmonic to another that there is -# point for the same energy from both harmomics to prevent invalid interpolation. -# run reloadLookupTables() when done -Units eV mm -5700 5.4606 -5760 5.5 -6000 5.681 -6500 6.045 -7000 6.404 -7500 6.765 -8000 7.124 -8500 7.491 -9000 7.872 -9500 8.258 -9700 8.424 -9700 5.542 -10000 5.675 -10500 5.895 -11000 6.113 -11500 6.328 -12000 6.545 -12500 6.758 -12700 6.843 -13000 6.98 -13443 7.168 -13443 5.5 -13500 5.517 -14000 5.674 -14500 5.831 -15000 5.987 -15500 6.139 -16000 6.294 -16500 6.447 -17000 6.603 -17320 6.697 -17320 5.5 -17500 5.552 -18000 5.674 -18500 5.794 -19000 5.912 -19500 6.037 -20000 6.157 -20500 6.277 -20939 6.378 -20939 5.5 -21000 5.517 -21500 5.577 -22000 5.674 -22500 5.773 -23000 5.871 -23500 5.97 -24000 6.072 -24500 6.167 -25000 6.264 +{ + "rows": [ + [5700, 5.4606], + [5760, 5.5], + [6000, 5.681], + [6500, 6.045], + [7000, 6.404], + [7500, 6.765], + [8000, 7.124], + [8500, 7.491], + [9000, 7.872], + [9500, 8.258], + [9700, 8.424], + [9700, 5.542], + [10000, 5.675], + [10500, 5.895], + [11000, 6.113], + [11500, 6.328], + [12000, 6.545], + [12500, 6.758], + [12700, 6.843], + [13000, 6.98], + [13443, 7.168], + [13443, 5.5], + [13500, 5.517], + [14000, 5.674], + [14500, 5.831], + [15000, 5.987], + [15500, 6.139], + [16000, 6.294], + [16500, 6.447], + [17000, 6.603], + [17320, 6.697], + [17320, 5.5], + [17500, 5.552], + [18000, 5.674], + [18500, 5.794], + [19000, 5.912], + [19500, 6.037], + [20000, 6.157], + [20500, 6.277], + [20939, 6.378], + [20939, 5.5], + [21000, 5.517], + [21500, 5.577], + [22000, 5.674], + [22500, 5.773], + [23000, 5.871], + [23500, 5.97], + [24000, 6.072], + [24500, 6.167], + [25000, 6.264] + ] +} diff --git a/tests/devices/test_undulator.py b/tests/devices/test_undulator.py index 846e6b93665..c04e1fd4317 100644 --- a/tests/devices/test_undulator.py +++ b/tests/devices/test_undulator.py @@ -1,10 +1,14 @@ from collections.abc import Generator -from unittest.mock import AsyncMock, patch +from unittest.mock import MagicMock import numpy as np import pytest from bluesky import RunEngine from bluesky.plan_stubs import mv +from daq_config_server import ConfigClient +from daq_config_server.models.lookup_tables.insertion_device import ( + UndulatorEnergyGapLookupTable, +) from ophyd_async.core import get_mock_put, init_devices, set_mock_value from ophyd_async.testing import ( assert_configuration, @@ -34,6 +38,7 @@ async def undulator() -> UndulatorInKeV: baton = Baton("BATON-01") undulator = UndulatorInKeV( "UND-01", + ConfigClient(""), name="undulator", poles=80, length=2.0, @@ -112,6 +117,7 @@ async def test_poles_not_propagated_if_not_supplied(): async with init_devices(mock=True): undulator = UndulatorInKeV( "UND-01", + ConfigClient(""), name="undulator", length=2.0, id_gap_lookup_table_path=TEST_BEAMLINE_UNDULATOR_TO_GAP_LUT, @@ -124,6 +130,7 @@ async def test_length_not_propagated_if_not_supplied(): async with init_devices(mock=True): undulator = UndulatorInKeV( "UND-01", + ConfigClient(""), name="undulator", poles=80, id_gap_lookup_table_path=TEST_BEAMLINE_UNDULATOR_TO_GAP_LUT, @@ -151,13 +158,12 @@ async def test_when_gap_access_is_disabled_set_then_error_is_raised( await undulator.set(5) -@patch( - "dodal.devices.undulator.energy_distance_table", - AsyncMock(return_value=np.array([[0, 10], [10, 20]])), -) async def test_gap_access_check_disabled_and_move_inhibited_when_commissioning_mode_enabled( undulator_in_commissioning_mode: UndulatorInKeV, ): + undulator_in_commissioning_mode.config_server.get_file_contents = MagicMock( + return_value=UndulatorEnergyGapLookupTable(rows=[[0, 10], [10, 20]]) + ) set_mock_value( undulator_in_commissioning_mode.gap_access, EnabledDisabledUpper.DISABLED ) @@ -168,13 +174,12 @@ async def test_gap_access_check_disabled_and_move_inhibited_when_commissioning_m ).assert_not_called() -@patch( - "dodal.devices.undulator.energy_distance_table", - AsyncMock(return_value=np.array([[0, 10], [10000, 20]])), -) async def test_gap_access_check_move_not_inhibited_when_commissioning_mode_disabled( undulator: UndulatorInKeV, ): + undulator.config_server.get_file_contents = MagicMock( + return_value=UndulatorEnergyGapLookupTable(rows=[[0, 10], [10000, 20]]) + ) set_mock_value(undulator.gap_access, EnabledDisabledUpper.ENABLED) await undulator.set(5) diff --git a/tests/devices/util/test_lookup_tables.py b/tests/devices/util/test_lookup_tables.py index 35a78a0f036..d18d62e8964 100644 --- a/tests/devices/util/test_lookup_tables.py +++ b/tests/devices/util/test_lookup_tables.py @@ -1,8 +1,12 @@ +import numpy as np import pytest +from daq_config_server import ConfigClient +from daq_config_server.models.lookup_tables.insertion_device import ( + UndulatorEnergyGapLookupTable, +) from pytest import mark from dodal.devices.util.lookup_tables import ( - energy_distance_table, linear_extrapolation_lut, linear_interpolation_lut, parse_lookup_table, @@ -21,7 +25,12 @@ async def test_energy_to_distance_table_correct_format(): - table = await energy_distance_table(TEST_BEAMLINE_UNDULATOR_TO_GAP_LUT) + config_server = ConfigClient("") + table = np.array( + config_server.get_file_contents( + TEST_BEAMLINE_UNDULATOR_TO_GAP_LUT, UndulatorEnergyGapLookupTable + ).rows + ) assert table[0][0] == 5700 assert table[49][1] == 6.264 assert table.shape == (50, 2) diff --git a/tests/plans/conftest.py b/tests/plans/conftest.py index 38369eac5df..8cc97adb658 100644 --- a/tests/plans/conftest.py +++ b/tests/plans/conftest.py @@ -3,6 +3,7 @@ from unittest.mock import patch import pytest +from daq_config_server import ConfigClient from ophyd_async.core import PathProvider, StandardDetector, init_devices from ophyd_async.sim import PatternGenerator, SimBlobDetector, SimMotor @@ -25,6 +26,7 @@ async def mock_undulator_and_dcm() -> UndulatorGapCheckDevices: async with init_devices(mock=True): undulator = UndulatorInKeV( "", + ConfigClient(""), id_gap_lookup_table_path=TEST_BEAMLINE_UNDULATOR_TO_GAP_LUT, ) dcm = DCM("")