Skip to content

Commit

Permalink
updated to collect_while_completing
Browse files Browse the repository at this point in the history
  • Loading branch information
ZohebShaikh committed Aug 23, 2024
1 parent d7f0748 commit cbe0434
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 26 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies = [
"numpy<2.0.0",
"packaging",
"pint",
"bluesky>=1.13.0a3",
"bluesky>=1.13.0a4",
"event_model",
"p4p",
"pyyaml",
Expand Down
25 changes: 3 additions & 22 deletions src/ophyd_async/plan_stubs/_fly.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
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 @@ -119,27 +118,9 @@ def fly_and_collect(
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)
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)
except TimeoutError:
pass
else:
done = True
yield from bps.collect(
*detectors,
return_payload=False,
name=stream_name,
)
yield from bps.wait(group=group)
yield from bps.collect_while_completing(
flyers=[flyer], dets=detectors, flush_period=0.5, stream_name=stream_name
)


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

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

0 comments on commit cbe0434

Please sign in to comment.