diff --git a/src/hyperion/external_interaction/callbacks/ispyb_callback_base.py b/src/hyperion/external_interaction/callbacks/ispyb_callback_base.py index 42b2f50bf..b841f86c2 100644 --- a/src/hyperion/external_interaction/callbacks/ispyb_callback_base.py +++ b/src/hyperion/external_interaction/callbacks/ispyb_callback_base.py @@ -107,11 +107,13 @@ def _handle_ispyb_hardware_read(self, doc) -> Sequence[ScanDataInfo]: **doc["data"]["aperture_scatterguard-selected_aperture"] ) beamsize = beam_size_from_aperture(aperture_size) + beamsize_x_mm = beamsize.x_um / 1000 if beamsize.x_um else None + beamsize_y_mm = beamsize.y_um / 1000 if beamsize.y_um else None hwscan_data_collection_info = DataCollectionInfo( - beamsize_at_samplex=beamsize.x_um, - beamsize_at_sampley=beamsize.y_um, - focal_spot_size_at_samplex=beamsize.x_um, - focal_spot_size_at_sampley=beamsize.y_um, + beamsize_at_samplex=beamsize_x_mm, + beamsize_at_sampley=beamsize_y_mm, + focal_spot_size_at_samplex=beamsize_x_mm, + focal_spot_size_at_sampley=beamsize_y_mm, undulator_gap1=doc["data"]["undulator-current_gap"], synchrotron_mode=synchrotron_mode.value, slitgap_horizontal=doc["data"]["s4_slit_gaps_xgap"], diff --git a/tests/unit_tests/external_interaction/callbacks/rotation/test_ispyb_callback.py b/tests/unit_tests/external_interaction/callbacks/rotation/test_ispyb_callback.py index 9a47f2c3c..86e55c83b 100644 --- a/tests/unit_tests/external_interaction/callbacks/rotation/test_ispyb_callback.py +++ b/tests/unit_tests/external_interaction/callbacks/rotation/test_ispyb_callback.py @@ -149,10 +149,10 @@ def test_hardware_read_events( "slitgapvertical": 0.2345, "synchrotronmode": "User", "undulatorgap1": 1.234, - "focal_spot_size_at_samplex": 50.0, - "focal_spot_size_at_sampley": 20.0, - "beamsize_at_samplex": 50.0, - "beamsize_at_sampley": 20.0, + "focal_spot_size_at_samplex": 0.05, + "focal_spot_size_at_sampley": 0.02, + "beamsize_at_samplex": 0.05, + "beamsize_at_sampley": 0.02, "comments": "Sample position: (10.0, 20.0, 30.0) test Aperture: Medium", }, ) @@ -327,10 +327,10 @@ def test_comment_correct_after_hardware_read( "slitgapvertical": 0.2345, "synchrotronmode": "User", "undulatorgap1": 1.234, - "focal_spot_size_at_samplex": 50.0, - "focal_spot_size_at_sampley": 20.0, - "beamsize_at_samplex": 50.0, - "beamsize_at_sampley": 20.0, + "focal_spot_size_at_samplex": 0.05, + "focal_spot_size_at_sampley": 0.02, + "beamsize_at_samplex": 0.05, + "beamsize_at_sampley": 0.02, "comments": "Sample position: (10.0, 20.0, 30.0) a lovely unit test Aperture: Medium", }, ) diff --git a/tests/unit_tests/external_interaction/callbacks/xray_centre/test_ispyb_callback.py b/tests/unit_tests/external_interaction/callbacks/xray_centre/test_ispyb_callback.py index d46c73c9e..ec9bd51c1 100644 --- a/tests/unit_tests/external_interaction/callbacks/xray_centre/test_ispyb_callback.py +++ b/tests/unit_tests/external_interaction/callbacks/xray_centre/test_ispyb_callback.py @@ -100,10 +100,10 @@ def test_hardware_read_event_3d(self, mock_ispyb_conn): "slitgapvertical": 0.2345, "synchrotronmode": "User", "undulatorgap1": 1.234, - "focal_spot_size_at_samplex": 50.0, - "focal_spot_size_at_sampley": 20.0, - "beamsize_at_samplex": 50.0, - "beamsize_at_sampley": 20.0, + "focal_spot_size_at_samplex": 0.05, + "focal_spot_size_at_sampley": 0.02, + "beamsize_at_samplex": 0.05, + "beamsize_at_sampley": 0.02, }, ) assert_upsert_call_with( @@ -116,10 +116,10 @@ def test_hardware_read_event_3d(self, mock_ispyb_conn): "slitgapvertical": 0.2345, "synchrotronmode": "User", "undulatorgap1": 1.234, - "focal_spot_size_at_samplex": 50.0, - "focal_spot_size_at_sampley": 20.0, - "beamsize_at_samplex": 50.0, - "beamsize_at_sampley": 20.0, + "focal_spot_size_at_samplex": 0.05, + "focal_spot_size_at_sampley": 0.02, + "beamsize_at_samplex": 0.05, + "beamsize_at_sampley": 0.02, }, )