Skip to content

Commit

Permalink
moved code from bluesky
Browse files Browse the repository at this point in the history
  • Loading branch information
ZohebShaikh committed Aug 28, 2024
1 parent cbe0434 commit 5ddf953
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
18 changes: 15 additions & 3 deletions src/ophyd_async/plan_stubs/_fly.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import List, Optional

import bluesky.plan_stubs as bps
from bluesky.utils import short_uid

from ophyd_async.core import (
DetectorTrigger,
Expand Down Expand Up @@ -117,10 +118,21 @@ 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.collect_while_completing(
flyers=[flyer], dets=detectors, flush_period=0.5, stream_name=stream_name
)
yield from bps.complete(flyer, wait=False, group=group)
for detector in detectors:
yield from bps.complete(detector, wait=False, group=group)

done = False
while not done:
try:
yield from bps.wait(group=group, timeout=0.5, move_on=True)
except TimeoutError:
pass
else:
done = True
yield from bps.collect(*detectors, name=stream_name)


def fly_and_collect_with_static_pcomp(
Expand Down
5 changes: 3 additions & 2 deletions tests/plan_stubs/test_fly.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ def __init__(
super().__init__(controller, writer, config_sigs, name)

@WatchableAsyncStatus.wrap
async def kickoff(self):
super().kickoff()
async def complete(self):
assert self._arm_status, "Prepare not run"
assert self._trigger_info
self.writer.increment_index()
async for index in self.writer.observe_indices_written(
self._trigger_info.frame_timeout
Expand Down

0 comments on commit 5ddf953

Please sign in to comment.