diff --git a/setup.cfg b/setup.cfg index 0580b19ef..337df6094 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,7 +35,7 @@ install_requires = xarray doct databroker - dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@7af305b068475c474ee670fa63cce288a9665575 + dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@9129f255066131bf7ca5d1a19d4e19b91eb77263 pydantic<2.0 # See https://github.com/DiamondLightSource/hyperion/issues/774 scipy zmq diff --git a/src/hyperion/experiment_plans/flyscan_xray_centre_plan.py b/src/hyperion/experiment_plans/flyscan_xray_centre_plan.py index 48f4e2a76..150461e47 100755 --- a/src/hyperion/experiment_plans/flyscan_xray_centre_plan.py +++ b/src/hyperion/experiment_plans/flyscan_xray_centre_plan.py @@ -23,8 +23,9 @@ from dodal.devices.undulator import Undulator from dodal.devices.xbpm_feedback import XBPMFeedback from dodal.devices.zebra import Zebra -from dodal.devices.zocalo import ( +from dodal.devices.zocalo.zocalo_results import ( ZOCALO_READING_PLAN_NAME, + ZOCALO_STAGE_GROUP, ZocaloResults, get_processing_result, ) @@ -148,6 +149,10 @@ def wait_for_gridscan_valid(fgs_motors: FastGridScan, timeout=0.5): def tidy_up_plans(fgs_composite: FlyScanXRayCentreComposite): LOGGER.info("Tidying up Zebra") yield from set_zebra_shutter_to_manual(fgs_composite.zebra) + LOGGER.info("Tidying up Zocalo") + yield from bps.unstage( + fgs_composite.zocalo + ) # make sure we don't consume any other results @bpp.set_run_key_decorator(GRIDSCAN_MAIN_PLAN) @@ -159,7 +164,6 @@ def run_gridscan( "plan_name": GRIDSCAN_MAIN_PLAN, }, ): - yield from bps.stage(fgs_composite.zocalo) # clear any stale processing results sample_motors = fgs_composite.sample_motors # Currently gridscan only works for omega 0, see # @@ -194,7 +198,6 @@ def run_gridscan( else_plan=lambda: (yield from bps.unstage(fgs_composite.eiger)), ) def do_fgs(): - yield from bps.wait() # Wait for all moves to complete # Check topup gate dwell_time_in_s = parameters.experiment_params.dwell_time_ms / 1000.0 total_exposure = ( @@ -206,6 +209,9 @@ def do_fgs(): 30.0, ) yield from bps.kickoff(fgs_motors) + yield from bps.wait( + ZOCALO_STAGE_GROUP + ) # Make sure ZocaloResults queue is clear and ready to accept our new data yield from bps.complete(fgs_motors, wait=True) LOGGER.info("Waiting for arming to finish") @@ -239,7 +245,9 @@ def run_gridscan_and_move( yield from setup_zebra_for_gridscan(fgs_composite.zebra) LOGGER.info("Starting grid scan") - + yield from bps.stage( + fgs_composite.zocalo, group=ZOCALO_STAGE_GROUP + ) # connect to zocalo and make sure the queue is clear yield from run_gridscan(fgs_composite, parameters) LOGGER.info("Grid scan finished, getting results.") diff --git a/tests/conftest.py b/tests/conftest.py index 6de8f1955..191a0b465 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -400,6 +400,14 @@ def fake_create_rotation_devices( ) +@pytest.fixture +def zocalo(done_status): + zoc = i03.zocalo(fake_with_ophyd_sim=True) + zoc.stage = MagicMock(return_value=done_status) + zoc.unstage = MagicMock(return_value=done_status) + return zoc + + @pytest.fixture def fake_fgs_composite( smargon: Smargon, @@ -409,6 +417,7 @@ def fake_fgs_composite( attenuator, xbpm_feedback, aperture_scatterguard, + zocalo, ): fake_composite = FlyScanXRayCentreComposite( aperture_scatterguard=aperture_scatterguard, @@ -424,7 +433,7 @@ def fake_fgs_composite( synchrotron=i03.synchrotron(fake_with_ophyd_sim=True), xbpm_feedback=xbpm_feedback, zebra=i03.zebra(fake_with_ophyd_sim=True), - zocalo=i03.zocalo(), + zocalo=zocalo, ) fake_composite.eiger.stage = MagicMock(return_value=done_status)