From 7d601de3c5711c68f92b419a828739f95d0b6d70 Mon Sep 17 00:00:00 2001 From: Abigail Emery Date: Wed, 10 Apr 2024 10:51:23 +0100 Subject: [PATCH] Move trigger logic into dedicated plan stub (#175) This streamlines the preparation of the flyer and any detectors by delegating the responsibility for making TriggerInfo (required by detectors) and sequence tables (required by the TriggerLogic in the flyer to a plan stub. This can be called within a plan to prepare a flyer and many detectors. This is a specific use case and more will need to be made for different situations. --- src/ophyd_async/panda/__init__.py | 1 + .../triggers/test_static_seq_table_trigger.py | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 tests/triggers/test_static_seq_table_trigger.py diff --git a/src/ophyd_async/panda/__init__.py b/src/ophyd_async/panda/__init__.py index 9c572f52c0..5446f88af6 100644 --- a/src/ophyd_async/panda/__init__.py +++ b/src/ophyd_async/panda/__init__.py @@ -32,4 +32,5 @@ "TimeUnits", "DataBlock", "CommonPandABlocks", + "TimeUnits", ] diff --git a/tests/triggers/test_static_seq_table_trigger.py b/tests/triggers/test_static_seq_table_trigger.py new file mode 100644 index 0000000000..a4c3dc8a78 --- /dev/null +++ b/tests/triggers/test_static_seq_table_trigger.py @@ -0,0 +1,22 @@ +import pytest + +from ophyd_async.core.device import DeviceCollector +from ophyd_async.panda import PandA +from ophyd_async.panda.trigger import StaticSeqTableTriggerLogic + + +@pytest.fixture +async def panda(): + async with DeviceCollector(sim=True): + sim_panda = PandA("PANDAQSRV:", "sim_panda") + + assert sim_panda.name == "sim_panda" + yield sim_panda + + +def test_trigger_logic_has_given_methods(panda: PandA): + trigger_logic = StaticSeqTableTriggerLogic(panda.seq[1]) + assert hasattr(trigger_logic, "prepare") + assert hasattr(trigger_logic, "kickoff") + assert hasattr(trigger_logic, "complete") + assert hasattr(trigger_logic, "stop")