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

Commit

Permalink
Merge pull request #1229 from DiamondLightSource/1228_tidy_up_apertur…
Browse files Browse the repository at this point in the history
…e_reading

1228 tidy up aperture reading
  • Loading branch information
DominicOram authored Mar 7, 2024
2 parents ad13d11 + ec6aa93 commit 7a15c16
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 24 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ install_requires =
xarray
doct
databroker
dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@5b3703c6662f2e29dbb4eb481ae448123d32d62c
dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@1e42fe3907934d2f39dcf0c43463887ea776e0d9
pydantic<2.0 # See https://github.com/DiamondLightSource/hyperion/issues/774
scipy
pyzmq<25 # See https://github.com/DiamondLightSource/hyperion/issues/1103
Expand Down
4 changes: 2 additions & 2 deletions src/hyperion/experiment_plans/flyscan_xray_centre_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ def set_aperture_for_bbox_size(
@bpp.run_decorator(
md={
"subplan_name": "change_aperture",
"aperture_size": new_selected_aperture.name,
"aperture_size": new_selected_aperture.GDA_name,
}
)
def set_aperture():
yield from bps.abs_set(aperture_device, new_selected_aperture.location)
yield from bps.abs_set(aperture_device, new_selected_aperture)

yield from set_aperture()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@


class ApertureChangeCallback(CallbackBase):
"""A callback that's used to send the selected aperture back to GDA"""

def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.last_selected_aperture: str = "NONE"
Expand Down
12 changes: 9 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,29 +382,35 @@ def aperture_scatterguard(done_status):
SingleAperturePosition(
location=ApertureFiveDimensionalLocation(0, 1, 2, 3, 4),
name="Large",
GDA_name="LARGE_APERTURE",
radius_microns=100,
),
SingleAperturePosition(
location=ApertureFiveDimensionalLocation(5, 6, 7, 8, 9),
location=ApertureFiveDimensionalLocation(5, 6, 2, 8, 9),
name="Medium",
GDA_name="MEDIUM_APERTURE",
radius_microns=50,
),
SingleAperturePosition(
location=ApertureFiveDimensionalLocation(10, 11, 12, 13, 14),
location=ApertureFiveDimensionalLocation(10, 11, 2, 13, 14),
name="Small",
GDA_name="SMALL_APERTURE",
radius_microns=20,
),
SingleAperturePosition(
location=ApertureFiveDimensionalLocation(15, 16, 17, 18, 19),
location=ApertureFiveDimensionalLocation(15, 16, 2, 18, 19),
name="Robot_load",
GDA_name="ROBOT_LOAD",
radius_microns=None,
),
),
)
ap_sg.aperture.z.user_setpoint.sim_put(2) # type: ignore
ap_sg.aperture.z.motor_done_move.sim_put(1) # type: ignore
with patch_motor(ap_sg.aperture.x), patch_motor(ap_sg.aperture.y), patch_motor(
ap_sg.aperture.z
), patch_motor(ap_sg.scatterguard.x), patch_motor(ap_sg.scatterguard.y):
ap_sg.set(ap_sg.aperture_positions.SMALL) # type: ignore
yield ap_sg


Expand Down
2 changes: 1 addition & 1 deletion tests/system_tests/experiment_plans/test_fgs_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def fgs_composite():
)
composite.aperture_scatterguard.load_aperture_positions(aperture_positions)
composite.aperture_scatterguard.aperture.z.move(
aperture_positions.LARGE[2], wait=True
aperture_positions.LARGE.location[2], wait=True
)
composite.eiger.cam.manual_trigger.put("Yes")
composite.eiger.odin.check_odin_initialised = lambda: (True, "")
Expand Down
19 changes: 2 additions & 17 deletions tests/unit_tests/experiment_plans/test_flyscan_xray_centre_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
import pytest
from bluesky.run_engine import RunEngine
from bluesky.utils import FailedStatus
from dodal.devices.aperturescatterguard import (
ApertureFiveDimensionalLocation,
SingleAperturePosition,
)
from dodal.devices.detector.det_dim_constants import (
EIGER2_X_4M_DIMENSION,
EIGER_TYPE_EIGER2_X_4M,
Expand Down Expand Up @@ -199,19 +195,8 @@ def test_read_hardware_for_ispyb_updates_from_ophyd_devices(
flux_test_value = 10.0
fake_fgs_composite.flux.flux_reading.sim_put(flux_test_value) # type: ignore

test_aperture = SingleAperturePosition(
name="Large",
radius_microns=100,
location=ApertureFiveDimensionalLocation(
aperture_x=0,
aperture_y=1.0005, # only here departs from the Large position described in conftest.py fixture
aperture_z=2,
scatterguard_x=3,
scatterguard_y=4,
),
)
fake_fgs_composite.aperture_scatterguard.selected_aperture.put(
test_aperture.location
fake_fgs_composite.aperture_scatterguard.set(
fake_fgs_composite.aperture_scatterguard.aperture_positions.LARGE # type: ignore
)
set_sim_value(fake_fgs_composite.robot.barcode.bare_signal, ["BARCODE"])

Expand Down

0 comments on commit 7a15c16

Please sign in to comment.