Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Fix beamsize to be in mm (#1476)
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicOram authored Jul 10, 2024
1 parent e1eede2 commit 5f2b789
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
)
Expand Down Expand Up @@ -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",
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
},
)

Expand Down

0 comments on commit 5f2b789

Please sign in to comment.