From 6b3d95a9ce82e2f4682bf9fc0b189843a2d02200 Mon Sep 17 00:00:00 2001 From: Zoheb Shaikh Date: Wed, 4 Dec 2024 09:27:20 +0000 Subject: [PATCH 1/2] Update _fly.py --- src/ophyd_async/plan_stubs/_fly.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/ophyd_async/plan_stubs/_fly.py b/src/ophyd_async/plan_stubs/_fly.py index c4f2e81a2a..e10030a344 100644 --- a/src/ophyd_async/plan_stubs/_fly.py +++ b/src/ophyd_async/plan_stubs/_fly.py @@ -15,6 +15,8 @@ SeqTableInfo, ) +DEFAULT_FLUSH_PERIOD = 0.5 + def prepare_static_pcomp_flyer_and_detectors( flyer: StandardFlyer[PcompInfo], @@ -104,6 +106,7 @@ def fly_and_collect( stream_name: str, flyer: StandardFlyer[SeqTableInfo] | StandardFlyer[PcompInfo], detectors: list[StandardDetector], + flush_period: float = DEFAULT_FLUSH_PERIOD, ): """Kickoff, complete and collect with a flyer and multiple detectors. @@ -116,8 +119,6 @@ def fly_and_collect( yield from bps.kickoff(flyer, wait=True) for detector in detectors: yield from bps.kickoff(detector) - - # collect_while_completing group = short_uid(label="complete") yield from bps.complete(flyer, wait=False, group=group) @@ -126,18 +127,8 @@ def fly_and_collect( done = False while not done: - try: - yield from bps.wait(group=group, timeout=0.5) - except TimeoutError: - pass - else: - done = True - yield from bps.collect( - *detectors, - return_payload=False, - name=stream_name, - ) - yield from bps.wait(group=group) + done = yield from bps.wait(group=group, timeout=flush_period, move_on=True) + yield from bps.collect(*detectors, name=stream_name) def fly_and_collect_with_static_pcomp( From db06c4917091a524e684d7763b159107cc7057cd Mon Sep 17 00:00:00 2001 From: Zoheb Shaikh Date: Wed, 4 Dec 2024 16:55:14 +0000 Subject: [PATCH 2/2] copied code from collect_while_completing to ophyd_async --- src/ophyd_async/plan_stubs/_fly.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ophyd_async/plan_stubs/_fly.py b/src/ophyd_async/plan_stubs/_fly.py index e10030a344..b4c7af66c8 100644 --- a/src/ophyd_async/plan_stubs/_fly.py +++ b/src/ophyd_async/plan_stubs/_fly.py @@ -119,11 +119,9 @@ def fly_and_collect( yield from bps.kickoff(flyer, wait=True) for detector in detectors: yield from bps.kickoff(detector) - group = short_uid(label="complete") - yield from bps.complete(flyer, wait=False, group=group) - for detector in detectors: - yield from bps.complete(detector, wait=False, group=group) + group = short_uid(label="complete") + yield from bps.complete_all(flyer, wait=False, group=group) done = False while not done: