Skip to content

Commit

Permalink
Remove config sigs kwarg from flyer since use case for them was uncle…
Browse files Browse the repository at this point in the history
…ar. (#593)
  • Loading branch information
jwlodek authored Sep 27, 2024
1 parent e7cef5b commit 55f3552
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 38 deletions.
19 changes: 2 additions & 17 deletions src/ophyd_async/core/_flyer.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
from abc import ABC, abstractmethod
from collections.abc import Sequence
from typing import Generic

from bluesky.protocols import Flyable, Preparable, Reading, Stageable
from event_model import DataKey
from bluesky.protocols import Flyable, Preparable, Stageable

from ._device import Device
from ._signal import SignalR
from ._status import AsyncStatus
from ._utils import T, merge_gathered_dicts
from ._utils import T


class TriggerLogic(ABC, Generic[T]):
Expand Down Expand Up @@ -39,11 +36,9 @@ class StandardFlyer(
def __init__(
self,
trigger_logic: TriggerLogic[T],
configuration_signals: Sequence[SignalR] = (),
name: str = "",
):
self._trigger_logic = trigger_logic
self._configuration_signals = tuple(configuration_signals)
super().__init__(name=name)

@property
Expand Down Expand Up @@ -73,13 +68,3 @@ async def kickoff(self) -> None:
@AsyncStatus.wrap
async def complete(self) -> None:
await self._trigger_logic.complete()

async def describe_configuration(self) -> dict[str, DataKey]:
return await merge_gathered_dicts(
[sig.describe() for sig in self._configuration_signals]
)

async def read_configuration(self) -> dict[str, Reading]:
return await merge_gathered_dicts(
[sig.read() for sig in self._configuration_signals]
)
16 changes: 2 additions & 14 deletions tests/core/test_flyer.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def append_and_print(name, doc):
RE.subscribe(append_and_print)

trigger_logic = DummyTriggerLogic()
flyer = StandardFlyer(trigger_logic, [], name="flyer")
flyer = StandardFlyer(trigger_logic, name="flyer")
trigger_info = TriggerInfo(
number=1, trigger=DetectorTrigger.constant_gate, deadtime=2, livetime=2
)
Expand Down Expand Up @@ -238,7 +238,7 @@ async def test_hardware_triggered_flyable_too_many_kickoffs(
RE: RunEngine, detectors: tuple[StandardDetector]
):
trigger_logic = DummyTriggerLogic()
flyer = StandardFlyer(trigger_logic, [], name="flyer")
flyer = StandardFlyer(trigger_logic, name="flyer")
trigger_info = TriggerInfo(
number=1, trigger=DetectorTrigger.constant_gate, deadtime=2, livetime=2
)
Expand Down Expand Up @@ -301,18 +301,6 @@ def flying_plan():
RE(flying_plan())


# To do: Populate configuration signals
async def test_describe_configuration():
flyer = StandardFlyer(DummyTriggerLogic(), [], name="flyer")
assert await flyer.describe_configuration() == {}


# To do: Populate configuration signals
async def test_read_configuration():
flyer = StandardFlyer(DummyTriggerLogic(), [], name="flyer")
assert await flyer.read_configuration() == {}


@pytest.mark.parametrize(
["kwargs", "error_msg"],
[
Expand Down
2 changes: 1 addition & 1 deletion tests/epics/adcore/test_scans.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_hdf_writer_fails_on_timeout_with_flyscan(
)
trigger_logic = DummyTriggerLogic()

flyer = StandardFlyer(trigger_logic, [], name="flyer")
flyer = StandardFlyer(trigger_logic, name="flyer")
trigger_info = TriggerInfo(
number=1, trigger=DetectorTrigger.constant_gate, deadtime=2, livetime=2
)
Expand Down
4 changes: 2 additions & 2 deletions tests/fastcs/panda/test_hdf_panda.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def append_and_print(name, doc):
exposure = 1

trigger_logic = StaticSeqTableTriggerLogic(mock_hdf_panda.seq[1])
flyer = StandardFlyer(trigger_logic, [], name="flyer")
flyer = StandardFlyer(trigger_logic, name="flyer")

def flying_plan():
yield from bps.stage_all(mock_hdf_panda, flyer)
Expand Down Expand Up @@ -207,7 +207,7 @@ def append_and_print(name, doc):
exposure = 1

trigger_logic = StaticSeqTableTriggerLogic(mock_hdf_panda.seq[1])
flyer = StandardFlyer(trigger_logic, [], name="flyer")
flyer = StandardFlyer(trigger_logic, name="flyer")

def flying_plan():
iteration = 2
Expand Down
8 changes: 4 additions & 4 deletions tests/plan_stubs/test_fly.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def __init__(
configuration_signals: Sequence[SignalR] = ...,
name: str = "",
):
super().__init__(trigger_logic, configuration_signals, name)
super().__init__(trigger_logic, name)

@AsyncStatus.wrap
async def kickoff(self) -> None:
Expand All @@ -207,7 +207,7 @@ async def complete(self) -> None:
async def seq_flyer(mock_panda):
# Make flyer
trigger_logic = StaticSeqTableTriggerLogic(mock_panda.seq[1])
flyer = MockFlyer(trigger_logic, [], name="flyer")
flyer = MockFlyer(trigger_logic, name="flyer")

return flyer

Expand All @@ -216,7 +216,7 @@ async def seq_flyer(mock_panda):
async def pcomp_flyer(mock_panda):
# Make flyer
trigger_logic = StaticPcompTriggerLogic(mock_panda.pcomp[1])
flyer = MockFlyer(trigger_logic, [], name="flyer")
flyer = MockFlyer(trigger_logic, name="flyer")

return flyer

Expand Down Expand Up @@ -250,7 +250,7 @@ def append_and_print(name, doc):
shutter_time = 0.004

trigger_logic = StaticSeqTableTriggerLogic(mock_panda.seq[1])
flyer = StandardFlyer(trigger_logic, [], name="flyer")
flyer = StandardFlyer(trigger_logic, name="flyer")

def flying_plan():
yield from bps.stage_all(*detector_list, flyer)
Expand Down

0 comments on commit 55f3552

Please sign in to comment.