From 5ab57dbdc91e15317b89a5f570a50cc9ceff2c0f Mon Sep 17 00:00:00 2001 From: Robert Tuck Date: Tue, 28 May 2024 09:21:43 +0100 Subject: [PATCH] (#1406) Remove detector string from params --- src/hyperion/parameters/components.py | 1 - src/hyperion/parameters/gridscan.py | 4 ++-- ...good_test_grid_with_edge_detect_parameters.json | 1 - ...est_pin_centre_then_xray_centre_parameters.json | 1 - .../good_test_rotation_scan_parameters.json | 1 - .../good_test_rotation_scan_parameters_nomove.json | 1 - .../ispyb_gridscan_system_test_parameters.json | 1 - .../test_flyscan_xray_centre_plan.py | 10 +--------- .../test_panda_flyscan_xray_centre_plan.py | 14 ++------------ 9 files changed, 5 insertions(+), 29 deletions(-) diff --git a/src/hyperion/parameters/components.py b/src/hyperion/parameters/components.py index 25a937e33..65ab08660 100644 --- a/src/hyperion/parameters/components.py +++ b/src/hyperion/parameters/components.py @@ -152,7 +152,6 @@ class DiffractionExperiment(HyperionParameters): default=CONST.PARAM.DETECTOR.BEAM_XY_LUT_PATH ) zocalo_environment: str = Field(default=CONST.ZOCALO_ENV) - detector: str = Field(default=CONST.I03.DETECTOR) trigger_mode: TriggerMode = Field(default=TriggerMode.FREE_RUN) detector_distance_mm: float | None = Field(default=None, gt=0) demand_energy_ev: float | None = Field(default=None, gt=0) diff --git a/src/hyperion/parameters/gridscan.py b/src/hyperion/parameters/gridscan.py index bff47c574..ec345f34d 100644 --- a/src/hyperion/parameters/gridscan.py +++ b/src/hyperion/parameters/gridscan.py @@ -25,7 +25,7 @@ WithScan, XyzStarts, ) -from hyperion.parameters.constants import CONST +from hyperion.parameters.constants import CONST, I03Constants class GridCommon( @@ -73,7 +73,7 @@ def detector_params(self): ), "Detector distance must be filled before generating DetectorParams" os.makedirs(self.storage_directory, exist_ok=True) return DetectorParams( - detector_size_constants=self.detector, # type: ignore # Will be cleaned up in #1307 + detector_size_constants=I03Constants.DETECTOR, expected_energy_ev=self.demand_energy_ev, exposure_time=self.exposure_time_s, directory=self.storage_directory, diff --git a/tests/test_data/parameter_json_files/good_test_grid_with_edge_detect_parameters.json b/tests/test_data/parameter_json_files/good_test_grid_with_edge_detect_parameters.json index 7084cdf39..e6492a1d8 100644 --- a/tests/test_data/parameter_json_files/good_test_grid_with_edge_detect_parameters.json +++ b/tests/test_data/parameter_json_files/good_test_grid_with_edge_detect_parameters.json @@ -2,7 +2,6 @@ "parameter_model_version": "5.0.0", "beamline": "BL03S", "insertion_prefix": "SR03S", - "detector": "EIGER2_X_16M", "zocalo_environment": "devrmq", "storage_directory": "/tmp", "file_name": "file_name", diff --git a/tests/test_data/parameter_json_files/good_test_pin_centre_then_xray_centre_parameters.json b/tests/test_data/parameter_json_files/good_test_pin_centre_then_xray_centre_parameters.json index 9aaf5ad10..e0c67f70d 100644 --- a/tests/test_data/parameter_json_files/good_test_pin_centre_then_xray_centre_parameters.json +++ b/tests/test_data/parameter_json_files/good_test_pin_centre_then_xray_centre_parameters.json @@ -2,7 +2,6 @@ "parameter_model_version": "5.0.0", "beamline": "BL03S", "insertion_prefix": "SR03S", - "detector": "EIGER2_X_16M", "zocalo_environment": "devrmq", "storage_directory": "/tmp", "file_name": "file_name", diff --git a/tests/test_data/parameter_json_files/good_test_rotation_scan_parameters.json b/tests/test_data/parameter_json_files/good_test_rotation_scan_parameters.json index b89e3691a..d084f8f40 100644 --- a/tests/test_data/parameter_json_files/good_test_rotation_scan_parameters.json +++ b/tests/test_data/parameter_json_files/good_test_rotation_scan_parameters.json @@ -4,7 +4,6 @@ "det_dist_to_beam_converter_path": "tests/test_data/test_lookup_table.txt", "storage_directory": "/tmp/dls/i03/data/2024/cm31105-4/auto/123456/", "detector_distance_mm": 100.0, - "detector": "EIGER2_X_16M", "demand_energy_ev": 100, "exposure_time_s": 0.1, "insertion_prefix": "SR03S", diff --git a/tests/test_data/parameter_json_files/good_test_rotation_scan_parameters_nomove.json b/tests/test_data/parameter_json_files/good_test_rotation_scan_parameters_nomove.json index ca0b04c16..c91be9214 100644 --- a/tests/test_data/parameter_json_files/good_test_rotation_scan_parameters_nomove.json +++ b/tests/test_data/parameter_json_files/good_test_rotation_scan_parameters_nomove.json @@ -4,7 +4,6 @@ "det_dist_to_beam_converter_path": "tests/test_data/test_lookup_table.txt", "storage_directory": "/tmp/dls/i03/data/2024/cm31105-4/auto/123456/", "detector_distance_mm": 100.0, - "detector": "EIGER2_X_16M", "demand_energy_ev": 100, "exposure_time_s": 0.1, "insertion_prefix": "SR03S", diff --git a/tests/test_data/parameter_json_files/ispyb_gridscan_system_test_parameters.json b/tests/test_data/parameter_json_files/ispyb_gridscan_system_test_parameters.json index 50912db3f..e3bce9907 100644 --- a/tests/test_data/parameter_json_files/ispyb_gridscan_system_test_parameters.json +++ b/tests/test_data/parameter_json_files/ispyb_gridscan_system_test_parameters.json @@ -2,7 +2,6 @@ "parameter_model_version": "5.0.0", "beamline": "BL03S", "insertion_prefix": "SR03S", - "detector": "EIGER2_X_16M", "zocalo_environment": "dev_artemis", "storage_directory": "/tmp", "file_name": "file_name", diff --git a/tests/unit_tests/experiment_plans/test_flyscan_xray_centre_plan.py b/tests/unit_tests/experiment_plans/test_flyscan_xray_centre_plan.py index 7606f2af7..b53e942aa 100644 --- a/tests/unit_tests/experiment_plans/test_flyscan_xray_centre_plan.py +++ b/tests/unit_tests/experiment_plans/test_flyscan_xray_centre_plan.py @@ -12,8 +12,6 @@ from dodal.beamlines import i03 from dodal.common.beamlines.beamline_utils import clear_device from dodal.devices.detector.det_dim_constants import ( - EIGER2_X_4M_DIMENSION, - EIGER_TYPE_EIGER2_X_4M, EIGER_TYPE_EIGER2_X_16M, ) from dodal.devices.fast_grid_scan import FastGridScan @@ -63,7 +61,6 @@ from hyperion.parameters.gridscan import ThreeDGridScan from tests.conftest import create_dummy_scan_spec -from ...conftest import default_raw_params from ...system_tests.external_interaction.conftest import ( TEST_RESULT_LARGE, TEST_RESULT_MEDIUM, @@ -118,7 +115,7 @@ def mock_ispyb(): class TestFlyscanXrayCentrePlan: td: TestData = TestData() - def test_given_full_parameters_dict_when_detector_name_used_and_converted_then_detector_constants_correct( + def test_eiger2_x_16_detector_specified( self, test_fgs_params: ThreeDGridScan, ): @@ -126,11 +123,6 @@ def test_given_full_parameters_dict_when_detector_name_used_and_converted_then_d test_fgs_params.detector_params.detector_size_constants.det_type_string == EIGER_TYPE_EIGER2_X_16M ) - raw_params_dict = default_raw_params() - raw_params_dict["detector"] = EIGER_TYPE_EIGER2_X_4M - params: ThreeDGridScan = ThreeDGridScan(**raw_params_dict) - det_dimension = params.detector_params.detector_size_constants.det_dimension - assert det_dimension == EIGER2_X_4M_DIMENSION def test_when_run_gridscan_called_then_generator_returned( self, diff --git a/tests/unit_tests/experiment_plans/test_panda_flyscan_xray_centre_plan.py b/tests/unit_tests/experiment_plans/test_panda_flyscan_xray_centre_plan.py index 2ad0c032f..4d2f67e3d 100644 --- a/tests/unit_tests/experiment_plans/test_panda_flyscan_xray_centre_plan.py +++ b/tests/unit_tests/experiment_plans/test_panda_flyscan_xray_centre_plan.py @@ -8,11 +8,7 @@ import pytest from bluesky.run_engine import RunEngine from bluesky.utils import Msg -from dodal.devices.detector.det_dim_constants import ( - EIGER2_X_4M_DIMENSION, - EIGER_TYPE_EIGER2_X_4M, - EIGER_TYPE_EIGER2_X_16M, -) +from dodal.devices.detector.det_dim_constants import EIGER_TYPE_EIGER2_X_16M from dodal.devices.panda_fast_grid_scan import PandAFastGridScan from dodal.devices.synchrotron import SynchrotronMode from ophyd.sim import make_fake_device @@ -53,7 +49,6 @@ from hyperion.parameters.constants import CONST from hyperion.parameters.gridscan import ThreeDGridScan -from ...conftest import default_raw_params from ...system_tests.external_interaction.conftest import ( TEST_RESULT_LARGE, TEST_RESULT_MEDIUM, @@ -101,7 +96,7 @@ def standalone_read_hardware_for_ispyb( class TestFlyscanXrayCentrePlan: td: TestData = TestData() - def test_given_full_parameters_dict_when_detector_name_used_and_converted_then_detector_constants_correct( + def test_eiger2_x_16_detector_specified( self, test_panda_fgs_params: ThreeDGridScan, ): @@ -109,11 +104,6 @@ def test_given_full_parameters_dict_when_detector_name_used_and_converted_then_d test_panda_fgs_params.detector_params.detector_size_constants.det_type_string == EIGER_TYPE_EIGER2_X_16M ) - raw_params_dict = default_raw_params() - raw_params_dict["detector"] = EIGER_TYPE_EIGER2_X_4M - params: ThreeDGridScan = ThreeDGridScan(**raw_params_dict) - det_dimension = params.detector_params.detector_size_constants.det_dimension - assert det_dimension == EIGER2_X_4M_DIMENSION def test_when_run_gridscan_called_then_generator_returned( self,