Skip to content

Commit

Permalink
Make HardwareTriggeredFlyable Preparable instead of Moveable
Browse files Browse the repository at this point in the history
  • Loading branch information
joeshannon committed Jan 10, 2024
1 parent ed5089a commit 0dfdbc5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
13 changes: 5 additions & 8 deletions src/ophyd_async/core/flyer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
Flyable,
HasHints,
Hints,
Movable,
Preparable,
Reading,
Stageable,
WritesExternalAssets,
Expand Down Expand Up @@ -174,7 +174,7 @@ async def stop(self):

class HardwareTriggeredFlyable(
Device,
Movable,
Preparable,
Stageable,
Flyable,
Collectable,
Expand Down Expand Up @@ -210,18 +210,15 @@ async def stage(self) -> None:
self._offset = 0
self._current_frame = 0

def set(self, value: T) -> AsyncStatus:
def prepare(self, value: T) -> AsyncStatus:
"""Arm detectors and setup trajectories"""
# index + offset = current_frame, but starting a new scan so want it to be 0
# so subtract current_frame from both sides
return AsyncStatus(self._set(value))
return AsyncStatus(self._prepare(value))

async def _set(self, value: T) -> None:
async def _prepare(self, value: T) -> None:
self._offset -= self._current_frame
self._current_frame = 0
await self._prepare(value)

async def _prepare(self, value: T):
trigger_info = self._trigger_logic.trigger_info(value)
# Move to start and setup the flyscan, and arm dets in parallel
await asyncio.gather(
Expand Down
2 changes: 1 addition & 1 deletion tests/core/test_flyer.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def flying_plan():
assert trigger_logic.state == TriggerState.stopping

# move the flyer to the correct place, before fly scanning.
RE(bps.mv(flyer, 1))
RE(bps.prepare(flyer, 1))
assert trigger_logic.state == TriggerState.preparing
for controller in detector_group._controllers:
assert controller.disarm.called # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion tests/epics/areadetector/test_scans.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def flying_plan():
finally:
yield from bps.unstage_all(flyer)

RE(bps.mv(flyer, 1))
RE(bps.prepare(flyer, 1))
with pytest.raises(Exception) as exc:
RE(flying_plan())

Expand Down

0 comments on commit 0dfdbc5

Please sign in to comment.