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

Commit

Permalink
Fixes from testing v9.5.1 (#1486)
Browse files Browse the repository at this point in the history
* Fix units and precision of position in ispyb comment

* Fix logging message units
  • Loading branch information
DominicOram authored Jul 16, 2024
1 parent 8741328 commit e1566c1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/hyperion/experiment_plans/oav_grid_detection_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,5 @@ def grid_detection_plan(
yield from bps.save()

LOGGER.info(
f"Grid calculated at {angle}: {x_steps}px by {y_steps}px starting at {upper_left}px"
f"Grid calculated at {angle}: {x_steps} by {y_steps} steps starting at {upper_left}px"
)
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,16 @@ def populate_info_for_update(
def _handle_ispyb_hardware_read(self, doc: Event):
"""Use the hardware read values to create the ispyb comment"""
scan_data_infos = super()._handle_ispyb_hardware_read(doc)
motor_positions = [
motor_positions_mm = [
doc["data"]["smargon-x"],
doc["data"]["smargon-y"],
doc["data"]["smargon-z"],
]
assert (
self.params
), "handle_ispyb_hardware_read triggered beore activity_gated_start"
comment = f"Sample position: ({motor_positions[0]}, {motor_positions[1]}, {motor_positions[2]}) {self.params.comment} "
), "handle_ispyb_hardware_read triggered before activity_gated_start"
motor_positions_um = [position * 1000 for position in motor_positions_mm]
comment = f"Sample position (µm): ({motor_positions_um[0]:.0f}, {motor_positions_um[1]:.0f}, {motor_positions_um[2]:.0f}) {self.params.comment} "
scan_data_infos[0].data_collection_info.comments = comment
return scan_data_infos

Expand Down
6 changes: 3 additions & 3 deletions tests/unit_tests/external_interaction/callbacks/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ class TestData:
"s4_slit_gaps_ygap": 0.2345,
"synchrotron-synchrotron_mode": SynchrotronMode.USER,
"undulator-current_gap": 1.234,
"smargon-x": 10.0,
"smargon-y": 20.0,
"smargon-z": 30.0,
"smargon-x": 0.158435435,
"smargon-y": 0.023547354,
"smargon-z": 0.00345684712,
},
"timestamps": {"det1": 1666604299.8220396, "det2": 1666604299.8235943},
"seq_num": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,18 @@ def test_hardware_read_events(
"slitgapvertical": 0.2345,
"synchrotronmode": "User",
"undulatorgap1": 1.234,
"comments": "Sample position: (10.0, 20.0, 30.0) test ",
"comments": "Sample position (µm): (158, 24, 3) test ",
},
)
expected_data = TestData.test_event_document_pre_data_collection["data"]
assert_upsert_call_with(
mx.update_dc_position.mock_calls[0],
mx.get_dc_position_params(),
{
"id": TEST_DATA_COLLECTION_IDS[0],
"pos_x": 10,
"pos_y": 20,
"pos_z": 30,
"pos_x": expected_data["smargon-x"],
"pos_y": expected_data["smargon-y"],
"pos_z": expected_data["smargon-z"],
},
)

Expand Down Expand Up @@ -327,6 +328,6 @@ def test_comment_correct_after_hardware_read(
"slitgapvertical": 0.2345,
"synchrotronmode": "User",
"undulatorgap1": 1.234,
"comments": "Sample position: (10.0, 20.0, 30.0) a lovely unit test ",
"comments": "Sample position (µm): (158, 24, 3) a lovely unit test ",
},
)

0 comments on commit e1566c1

Please sign in to comment.