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

Commit

Permalink
(#1218) Make pyright happy
Browse files Browse the repository at this point in the history
  • Loading branch information
rtuck99 committed Mar 22, 2024
1 parent 562d00b commit 6a2a0a9
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/hyperion/experiment_plans/rotation_scan_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def rotation_with_cleanup_and_stage(params: RotationInternalParameters):
composite.backlight,
composite.attenuator,
# TODO 1033 don't use ispyb_params for this value, move it to experiment_params
params.hyperion_params.ispyb_params.transmission_fraction,
params.hyperion_params.ispyb_params.transmission_fraction, # pyright: ignore
params.hyperion_params.detector_params.detector_distance,
)
LOGGER.info("moving to position (if specified)")
Expand Down
4 changes: 2 additions & 2 deletions src/hyperion/external_interaction/nexus/nexus_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,6 @@ def create_beam_and_attenuator_parameters(
"""
return (
# TODO 1173 Get this data from events rather than ispyb_params
Beam(convert_eV_to_angstrom(energy_kev * 1000), flux),
Attenuator(transmission_fraction),
Beam(convert_eV_to_angstrom(energy_kev * 1000), flux), # pyright: ignore
Attenuator(transmission_fraction), # pyright: ignore
)
Original file line number Diff line number Diff line change
Expand Up @@ -335,18 +335,20 @@ def test_ispyb_deposition_in_rotation_plan(
test_rotation_params.hyperion_params.ispyb_params.beam_size_y = test_bs_y
test_rotation_params.hyperion_params.detector_params.exposure_time = test_exp_time
energy_ev = convert_angstrom_to_eV(test_wl)
fake_create_rotation_devices.dcm.energy_in_kev.user_readback.sim_put(
fake_create_rotation_devices.dcm.energy_in_kev.user_readback.sim_put( # pyright: ignore
energy_ev / 1000
)
fake_create_rotation_devices.undulator.current_gap.sim_put(1.12)
fake_create_rotation_devices.synchrotron.machine_status.synchrotron_mode.sim_put(
fake_create_rotation_devices.synchrotron.machine_status.synchrotron_mode.sim_put( # pyright: ignore
test_synchrotron_mode.value
)
fake_create_rotation_devices.synchrotron.top_up.start_countdown.sim_put(-1)
fake_create_rotation_devices.s4_slit_gaps.xgap.user_readback.sim_put(
fake_create_rotation_devices.synchrotron.top_up.start_countdown.sim_put( # pyright: ignore
-1
)
fake_create_rotation_devices.s4_slit_gaps.xgap.user_readback.sim_put( # pyright: ignore
test_slit_gap_horiz
)
fake_create_rotation_devices.s4_slit_gaps.ygap.user_readback.sim_put(
fake_create_rotation_devices.s4_slit_gaps.ygap.user_readback.sim_put( # pyright: ignore
test_slit_gap_vert
)
test_rotation_params.hyperion_params.detector_params.expected_energy_ev = energy_ev
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,16 @@ def test_read_hardware_for_ispyb_updates_from_ophyd_devices(
fake_fgs_composite.aperture_scatterguard,
)
)
# fmt: off
assert_event(
test_ispyb_callback.activity_gated_start.mock_calls[0],
test_ispyb_callback.activity_gated_start.mock_calls[0], # pyright: ignore
{
"plan_name": "standalone_read_hardware_for_ispyb",
"subplan_name": "run_gridscan_move_and_tidy",
},
)
assert_event(
test_ispyb_callback.activity_gated_event.mock_calls[0],
test_ispyb_callback.activity_gated_event.mock_calls[0], # pyright: ignore
{
"undulator_current_gap": undulator_test_value,
"synchrotron_machine_status_synchrotron_mode": synchrotron_test_value,
Expand All @@ -248,13 +249,14 @@ def test_read_hardware_for_ispyb_updates_from_ophyd_devices(
},
)
assert_event(
test_ispyb_callback.activity_gated_event.mock_calls[1],
test_ispyb_callback.activity_gated_event.mock_calls[1], # pyright: ignore
{
"attenuator_actual_transmission": transmission_test_value,
"flux_flux_reading": flux_test_value,
"dcm_energy_in_kev": current_energy_kev_test_value,
},
)
# fmt: on

@patch(
"dodal.devices.aperturescatterguard.ApertureScatterguard._safe_move_within_datacollection_range",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,16 @@ def test_read_hardware_for_ispyb_updates_from_ophyd_devices(
fake_fgs_composite.aperture_scatterguard,
)
)

# fmt: off
assert_event(
test_ispyb_callback.activity_gated_start.mock_calls[0],
test_ispyb_callback.activity_gated_start.mock_calls[0], # pyright: ignore
{
"plan_name": "standalone_read_hardware_for_ispyb",
"subplan_name": "run_gridscan_move_and_tidy",
},
)
assert_event(
test_ispyb_callback.activity_gated_event.mock_calls[0],
test_ispyb_callback.activity_gated_event.mock_calls[0], # pyright: ignore
{
"undulator_current_gap": undulator_test_value,
"synchrotron_machine_status_synchrotron_mode": synchrotron_test_value,
Expand All @@ -199,12 +199,13 @@ def test_read_hardware_for_ispyb_updates_from_ophyd_devices(
},
)
assert_event(
test_ispyb_callback.activity_gated_event.mock_calls[1],
test_ispyb_callback.activity_gated_event.mock_calls[1], # pyright: ignore
{
"attenuator_actual_transmission": transmission_test_value,
"flux_flux_reading": flux_test_value,
},
)
# fmt: on

@patch(
"dodal.devices.aperturescatterguard.ApertureScatterguard._safe_move_within_datacollection_range",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ def scan_data_info_for_update(scan_data_info_for_begin):

@pytest.fixture
def dummy_rotation_ispyb_with_experiment_type():
store_in_ispyb = StoreInIspyb(CONST.SIM.ISPYB_CONFIG, "Characterization")
store_in_ispyb = StoreInIspyb(
CONST.SIM.ISPYB_CONFIG, ExperimentType.CHARACTERIZATION
)
return store_in_ispyb


Expand Down

0 comments on commit 6a2a0a9

Please sign in to comment.