Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface change of StandardDetector and Standard Controller #568

Merged
merged 15 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions src/ophyd_async/epics/adpilatus/_pilatus_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(
) -> None:
self._drv = driver
self._readout_time = readout_time
self._arm_status: AsyncStatus | None = None
self._arm_status: tuple[AsyncStatus, None]

def get_deadtime(self, exposure: float) -> float:
return self._readout_time
Expand All @@ -47,21 +47,22 @@ async def prepare(self, trigger_info: TriggerInfo):

async def arm(self):
# Standard arm the detector and wait for the acquire PV to be True
self._arm_status = await adcore.start_acquiring_driver_and_ensure_status(
self._drv
)
# The pilatus has an additional PV that goes True when the camserver
# is actually ready. Should wait for that too or we risk dropping
# a frame
await wait_for_value(
self._drv.armed,
True,
timeout=DEFAULT_TIMEOUT,
self._arm_status = await asyncio.gather(
adcore.start_acquiring_driver_and_ensure_status(self._drv),
# The pilatus has an additional PV that goes True when the camserver
# is actually ready. Should wait for that too or we risk dropping
# a frame
wait_for_value(
self._drv.armed,
True,
timeout=DEFAULT_TIMEOUT,
),
ZohebShaikh marked this conversation as resolved.
Show resolved Hide resolved
)

async def wait_for_idle(self):
if self._arm_status:
await self._arm_status
for status in self._arm_status:
if status:
await status

@classmethod
def _get_trigger_mode(cls, trigger: DetectorTrigger) -> PilatusTriggerMode:
Expand Down
4 changes: 1 addition & 3 deletions src/ophyd_async/epics/eiger/_eiger_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ async def prepare(self, trigger_info: TriggerInfo):
)
await asyncio.gather(*coros)

async def arm(
self,
):
async def arm(self):
# TODO: Detector state should be an enum see https://github.com/DiamondLightSource/eiger-fastcs/issues/43
self._arm_status = set_and_wait_for_other_value(
self._drv.arm, 1, self._drv.state, "ready", timeout=DEFAULT_TIMEOUT
Expand Down
7 changes: 5 additions & 2 deletions src/ophyd_async/fastcs/panda/_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
wait_for_value,
)
from ophyd_async.core._detector import TriggerInfo
from ophyd_async.core._status import AsyncStatus

from ._block import PcapBlock


class PandaPcapController(DetectorControl):
def __init__(self, pcap: PcapBlock) -> None:
self.pcap = pcap
self._arm_status: tuple[AsyncStatus, None]

def get_deadtime(self, exposure: float) -> float:
return 0.000000008
Expand All @@ -24,8 +26,9 @@ async def prepare(self, trigger_info: TriggerInfo):
), "Only constant_gate and variable_gate triggering is supported on the PandA"

async def arm(self):
await asyncio.gather(self.pcap.arm.set(True))
await wait_for_value(self.pcap.active, True, timeout=1)
self._arm_status = await asyncio.gather(
self.pcap.arm.set(True), wait_for_value(self.pcap.active, True, timeout=1)
)
ZohebShaikh marked this conversation as resolved.
Show resolved Hide resolved

async def wait_for_idle(self):
pass
Expand Down
Loading