-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into bimorph-mirrors
- Loading branch information
Showing
40 changed files
with
568 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
from ophyd import Component, Device, EpicsSignalRO, Kind | ||
from ophyd_async.core import ( | ||
StandardReadable, | ||
StandardReadableFormat, | ||
) | ||
from ophyd_async.epics.core import epics_signal_r | ||
|
||
|
||
class Flux(Device): | ||
class Flux(StandardReadable): | ||
"""Simple device to get the flux reading""" | ||
|
||
flux_reading = Component(EpicsSignalRO, "SAMP", kind=Kind.hinted) | ||
def __init__(self, prefix: str, name="") -> None: | ||
with self.add_children_as_readables(StandardReadableFormat.HINTED_SIGNAL): | ||
self.flux_reading = epics_signal_r(float, prefix + "SAMP") | ||
super().__init__(name=name) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from ophyd_async.core import PathProvider, StandardDetector | ||
from ophyd_async.epics import adcore | ||
|
||
from dodal.devices.i13_1.merlin_controller import MerlinController | ||
from dodal.devices.i13_1.merlin_io import MerlinDriverIO | ||
|
||
|
||
class Merlin(StandardDetector): | ||
_controller: MerlinController | ||
_writer: adcore.ADHDFWriter | ||
|
||
def __init__( | ||
self, | ||
prefix: str, | ||
path_provider: PathProvider, | ||
drv_suffix="CAM:", | ||
hdf_suffix="HDF:", | ||
name: str = "", | ||
): | ||
self.drv = MerlinDriverIO(prefix + drv_suffix) | ||
self.hdf = adcore.NDFileHDFIO(prefix + hdf_suffix) | ||
|
||
super().__init__( | ||
MerlinController(self.drv), | ||
adcore.ADHDFWriter( | ||
self.hdf, | ||
path_provider, | ||
lambda: self.name, | ||
adcore.ADBaseDatasetDescriber(self.drv), | ||
), | ||
config_sigs=(self.drv.acquire_period, self.drv.acquire_time), | ||
name=name, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import asyncio | ||
import logging | ||
|
||
from ophyd_async.core import ( | ||
DEFAULT_TIMEOUT, | ||
AsyncStatus, | ||
DetectorController, | ||
TriggerInfo, | ||
) | ||
from ophyd_async.epics import adcore | ||
|
||
from dodal.devices.i13_1.merlin_io import MerlinDriverIO, MerlinImageMode | ||
|
||
|
||
class MerlinController(DetectorController): | ||
def __init__( | ||
self, | ||
driver: MerlinDriverIO, | ||
good_states: frozenset[adcore.DetectorState] = adcore.DEFAULT_GOOD_STATES, | ||
) -> None: | ||
self.driver = driver | ||
self.good_states = good_states | ||
self.frame_timeout: float = 0 | ||
self._arm_status: AsyncStatus | None = None | ||
for drv_child in self.driver.children(): | ||
logging.debug(drv_child) | ||
|
||
def get_deadtime(self, exposure: float | None) -> float: | ||
return 0.002 | ||
|
||
async def prepare(self, trigger_info: TriggerInfo): | ||
self.frame_timeout = ( | ||
DEFAULT_TIMEOUT + await self.driver.acquire_time.get_value() | ||
) | ||
await asyncio.gather( | ||
self.driver.num_images.set(trigger_info.total_number_of_triggers), | ||
self.driver.image_mode.set(MerlinImageMode.MULTIPLE), | ||
) | ||
|
||
async def arm(self): | ||
self._arm_status = await adcore.start_acquiring_driver_and_ensure_status( | ||
self.driver, good_states=self.good_states, timeout=self.frame_timeout | ||
) | ||
|
||
async def wait_for_idle(self): | ||
if self._arm_status: | ||
await self._arm_status | ||
|
||
async def disarm(self): | ||
# We can't use caput callback as we already used it in arm() and we can't have | ||
# 2 or they will deadlock | ||
await adcore.stop_busy_record(self.driver.acquire, False, timeout=1) |
Oops, something went wrong.