Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 0 additions & 3 deletions src/ophyd_async/epics/odin/__init__.py

This file was deleted.

169 changes: 0 additions & 169 deletions src/ophyd_async/epics/odin/_odin_io.py

This file was deleted.

3 changes: 1 addition & 2 deletions src/ophyd_async/fastcs/eiger/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from ._eiger import EigerDetector
from ._eiger_controller import EigerController
from ._eiger_io import EigerDetectorIO, EigerDriverIO, EigerMonitorIO, EigerStreamIO
from ._eiger_io import EigerDetectorIO, EigerMonitorIO, EigerStreamIO

__all__ = [
"EigerDetector",
"EigerController",
"EigerDriverIO",
"EigerDetectorIO",
"EigerMonitorIO",
"EigerStreamIO",
Expand Down
32 changes: 16 additions & 16 deletions src/ophyd_async/fastcs/eiger/_eiger.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from ophyd_async.core import (
AsyncStatus,
PathProvider,
SignalR,
StandardDetector,
TriggerInfo,
)
from ophyd_async.epics.odin import Odin, OdinWriter
from ophyd_async.fastcs.core import fastcs_connector
from ophyd_async.fastcs.odin import OdinHdfIO, OdinWriter

from ._eiger_controller import EigerController
from ._eiger_io import EigerDriverIO
from ._eiger_io import EigerDetectorIO, EigerMonitorIO, EigerStreamIO


class EigerDetector(StandardDetector):
Expand All @@ -16,28 +16,28 @@ class EigerDetector(StandardDetector):
_controller: EigerController
_writer: OdinWriter

stale_parameters: SignalR[bool]
monitor: EigerMonitorIO
stream: EigerStreamIO
detector: EigerDetectorIO
od: OdinHdfIO
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this odin rather than od?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
od: OdinHdfIO
odin: OdinHdfIO

As mentioned in previous review, odin is clearer than the abbreviated od.


def __init__(
self,
prefix: str,
path_provider: PathProvider,
drv_suffix="-EA-EIGER-01:",
hdf_suffix="-EA-EIGER-01:OD:",
odin_nodes: int = 4,
name="",
):
self.drv = EigerDriverIO(prefix + drv_suffix)
self.odin = Odin(prefix + hdf_suffix, nodes=odin_nodes)
# Need to do this first so the type hints are filled in
connector = fastcs_connector(self, prefix)

super().__init__(
EigerController(self.drv),
EigerController(self.detector),
OdinWriter(
path_provider,
self.odin,
self.drv.detector.bit_depth_image,
self.od,
self.detector.bit_depth_image,
),
name=name,
connector=connector,
)

@AsyncStatus.wrap
async def prepare(self, value: TriggerInfo) -> None:
await super().prepare(value)
22 changes: 11 additions & 11 deletions src/ophyd_async/fastcs/eiger/_eiger_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
wait_for_value,
)

from ._eiger_io import EigerDriverIO, EigerTriggerMode
from ._eiger_io import EigerDetectorIO, EigerTriggerMode

EIGER_TRIGGER_MODE_MAP = {
DetectorTrigger.INTERNAL: EigerTriggerMode.INTERNAL,
Expand All @@ -21,7 +21,7 @@
class EigerController(DetectorController):
def __init__(
self,
driver: EigerDriverIO,
driver: EigerDetectorIO,
) -> None:
self._drv = driver

Expand All @@ -34,22 +34,22 @@ async def set_energy(self, energy: float, tolerance: float = 0.1):
"""Changing photon energy takes some time so only do so if the current energy is
outside the tolerance."""

current_energy = await self._drv.detector.photon_energy.get_value()
current_energy = await self._drv.photon_energy.get_value()
if abs(current_energy - energy) > tolerance:
await self._drv.detector.photon_energy.set(energy)
await self._drv.photon_energy.set(energy)

async def prepare(self, trigger_info: TriggerInfo):
coros = [
self._drv.detector.trigger_mode.set(
self._drv.trigger_mode.set(
EIGER_TRIGGER_MODE_MAP[trigger_info.trigger].value
),
self._drv.detector.nimages.set(trigger_info.total_number_of_exposures),
self._drv.nimages.set(trigger_info.total_number_of_exposures),
]
if trigger_info.livetime is not None:
coros.extend(
[
self._drv.detector.count_time.set(trigger_info.livetime),
self._drv.detector.frame_time.set(trigger_info.livetime),
self._drv.count_time.set(trigger_info.livetime),
self._drv.frame_time.set(trigger_info.livetime),
]
)

Expand All @@ -59,10 +59,10 @@ async def arm(self):
# NOTE: This will return immedietly on FastCS 0.8.0,
# but will return after the Eiger has completed arming in 0.9.0.
# https://github.com/DiamondLightSource/FastCS/pull/141
await self._drv.detector.arm.trigger(timeout=DEFAULT_TIMEOUT)
await self._drv.arm.trigger(timeout=DEFAULT_TIMEOUT)

async def wait_for_idle(self):
await wait_for_value(self._drv.detector.state, "idle", timeout=DEFAULT_TIMEOUT)
await wait_for_value(self._drv.state, "idle", timeout=DEFAULT_TIMEOUT)

async def disarm(self):
await self._drv.detector.disarm.trigger()
await self._drv.disarm.trigger()
13 changes: 0 additions & 13 deletions src/ophyd_async/fastcs/eiger/_eiger_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
SignalX,
StrictEnum,
)
from ophyd_async.fastcs.core import fastcs_connector


class EigerTriggerMode(StrictEnum):
Expand Down Expand Up @@ -41,15 +40,3 @@ class EigerDetectorIO(Device):
arm: SignalX
disarm: SignalX
trigger: SignalX


class EigerDriverIO(Device):
"""Contains signals for handling IO on the Eiger detector."""

stale_parameters: SignalR[bool]
monitor: EigerMonitorIO
stream: EigerStreamIO
detector: EigerDetectorIO

def __init__(self, uri: str, name: str = ""):
super().__init__(name=name, connector=fastcs_connector(self, uri))
25 changes: 17 additions & 8 deletions src/ophyd_async/fastcs/jungfrau/_jungfrau.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
from ophyd_async.core import (
PathProvider,
StandardDetector,
)
from ophyd_async.epics.odin import Odin, OdinWriter
from ophyd_async.core import Device, PathProvider, StandardDetector
from ophyd_async.fastcs.core import fastcs_connector
from ophyd_async.fastcs.jungfrau._controller import JungfrauController
from ophyd_async.fastcs.jungfrau._signals import JungfrauDriverIO
from ophyd_async.fastcs.odin import OdinWriter
from ophyd_async.fastcs.odin._odin_io import FrameProcessorIO, MetaWriterIO


# TODO: Delete this duplicate device, once FastCS Jungfrau
# has top level 'detector' and 'odin', after which, follow
# EigerDetector as an example of correct structure
class OdinHdfIO(Device):
Comment on lines +9 to +12
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This duplicate OdinHdfIO class should be tracked for removal. Once FastCS Jungfrau provides the same structure as Eiger (with top-level 'detector' and 'odin'), this workaround can be eliminated.

Consider creating a GitHub issue to track this technical debt if one doesn't already exist.

fp: FrameProcessorIO
mw: MetaWriterIO

def __init__(self, uri: str, name: str = ""):
super().__init__(name=name, connector=fastcs_connector(self, uri))


class Jungfrau(StandardDetector[JungfrauController, OdinWriter]):
Expand All @@ -16,14 +26,13 @@ def __init__(
path_provider: PathProvider,
drv_suffix: str,
hdf_suffix: str,
odin_nodes: int,
name="",
):
self.drv = JungfrauDriverIO(prefix + drv_suffix)
self.odin = Odin(prefix + hdf_suffix, nodes=odin_nodes)
self.odin = OdinHdfIO(prefix + hdf_suffix)
writer = OdinWriter(
path_provider,
self.odin,
self.odin, # type: ignore
self.drv.bit_depth,
)
controller = JungfrauController(self.drv)
Expand Down
4 changes: 3 additions & 1 deletion src/ophyd_async/fastcs/odin/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
__all__ = []
from ._odin_io import OdinHdfIO, OdinWriter

__all__ = ["OdinHdfIO", "OdinWriter"]
Loading
Loading