-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split out common AD file plugin logic into core writer class, create …
…ADTiffWriter (#606) * Starting to work on ad tiff writer * Continue working on tiff writer * Further work on tiff writer, existing tests now passing. * Remove functions moved to superclas from hdf writer * Significant re-org and simplification of ad classes * Ruff formatting * Modify ad sim classes to reflect new superclasses * Modify vimba and kinetix classes * Modify aravis and pilatus classes * Update all tests to make sure they still pass with changes * Some cleanup * Changes to standard detector to account for controller/writer types in typing * Significant changes to base detector, controller, and writer classes * Update detector and controller classes to reflect changes * Make sure panda standard det uses new type hints * Most tests passing * Revert change in test that was resolved by pydantic version update * Remove debugging prints * Linter fixes * Fix linter error * Move creation of writer outside of base AreaDetector class init per review * Make sure we don't wait for capture to be done! * Allow for specifying whether or not to use fileio signals for dataset description * Revert "Allow for specifying whether or not to use fileio signals for dataset description" This reverts commit 488d7eb. * Fix linter errors, remove unused enum * Change from return to await to conform to return type * Apply more suggestions from review * Replace instances of DeviceCollector to init_devices * Update src/ophyd_async/epics/adaravis/_aravis_controller.py Co-authored-by: Tom C (DLS) <101418278+coretl@users.noreply.github.com> * Update src/ophyd_async/epics/adaravis/_aravis_controller.py Co-authored-by: Tom C (DLS) <101418278+coretl@users.noreply.github.com> * Update src/ophyd_async/epics/adcore/_core_writer.py Co-authored-by: Tom C (DLS) <101418278+coretl@users.noreply.github.com> * Update src/ophyd_async/epics/adcore/_core_logic.py Co-authored-by: Tom C (DLS) <101418278+coretl@users.noreply.github.com> * Update src/ophyd_async/epics/adcore/_core_detector.py Co-authored-by: Tom C (DLS) <101418278+coretl@users.noreply.github.com> * Update src/ophyd_async/epics/adcore/_core_detector.py Co-authored-by: Tom C (DLS) <101418278+coretl@users.noreply.github.com> * Update src/ophyd_async/epics/adcore/_core_writer.py Co-authored-by: Tom C (DLS) <101418278+coretl@users.noreply.github.com> * Fix all tests aside from 3.12 unawaited coro after applying suggestions * Resolve unawaited coro error on 3.12 * Remove unused typevar --------- Co-authored-by: Tom C (DLS) <101418278+coretl@users.noreply.github.com>
- Loading branch information
Showing
44 changed files
with
1,027 additions
and
720 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
from ._aravis import AravisDetector | ||
from ._aravis_controller import AravisController | ||
from ._aravis_io import AravisDriverIO | ||
from ._aravis_io import AravisDriverIO, AravisTriggerMode, AravisTriggerSource | ||
|
||
__all__ = [ | ||
"AravisDetector", | ||
"AravisController", | ||
"AravisDriverIO", | ||
"AravisTriggerMode", | ||
"AravisTriggerSource", | ||
] |
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,61 +1,47 @@ | ||
from typing import get_args | ||
from collections.abc import Sequence | ||
|
||
from bluesky.protocols import HasHints, Hints | ||
|
||
from ophyd_async.core import PathProvider, StandardDetector | ||
from ophyd_async.core import PathProvider | ||
from ophyd_async.core._signal import SignalR | ||
from ophyd_async.epics import adcore | ||
|
||
from ._aravis_controller import AravisController | ||
from ._aravis_io import AravisDriverIO | ||
|
||
|
||
class AravisDetector(StandardDetector, HasHints): | ||
class AravisDetector(adcore.AreaDetector[AravisController]): | ||
""" | ||
Ophyd-async implementation of an ADAravis Detector. | ||
The detector may be configured for an external trigger on a GPIO port, | ||
which must be done prior to preparing the detector | ||
""" | ||
|
||
_controller: AravisController | ||
_writer: adcore.ADHDFWriter | ||
|
||
def __init__( | ||
self, | ||
prefix: str, | ||
path_provider: PathProvider, | ||
drv_suffix="cam1:", | ||
hdf_suffix="HDF1:", | ||
name="", | ||
writer_cls: type[adcore.ADWriter] = adcore.ADHDFWriter, | ||
fileio_suffix: str | None = None, | ||
name: str = "", | ||
gpio_number: AravisController.GPIO_NUMBER = 1, | ||
config_sigs: Sequence[SignalR] = (), | ||
plugins: dict[str, adcore.NDPluginBaseIO] | None = None, | ||
): | ||
self.drv = AravisDriverIO(prefix + drv_suffix) | ||
self.hdf = adcore.NDFileHDFIO(prefix + hdf_suffix) | ||
driver = AravisDriverIO(prefix + drv_suffix) | ||
controller = AravisController(driver, gpio_number=gpio_number) | ||
|
||
writer = writer_cls.with_io( | ||
prefix, | ||
path_provider, | ||
dataset_source=driver, | ||
fileio_suffix=fileio_suffix, | ||
plugins=plugins, | ||
) | ||
|
||
super().__init__( | ||
AravisController(self.drv, gpio_number=gpio_number), | ||
adcore.ADHDFWriter( | ||
self.hdf, | ||
path_provider, | ||
lambda: self.name, | ||
adcore.ADBaseDatasetDescriber(self.drv), | ||
), | ||
config_sigs=(self.drv.acquire_time,), | ||
controller=controller, | ||
writer=writer, | ||
plugins=plugins, | ||
name=name, | ||
config_sigs=config_sigs, | ||
) | ||
|
||
def get_external_trigger_gpio(self): | ||
return self._controller.gpio_number | ||
|
||
def set_external_trigger_gpio(self, gpio_number: AravisController.GPIO_NUMBER): | ||
supported_gpio_numbers = get_args(AravisController.GPIO_NUMBER) | ||
if gpio_number not in supported_gpio_numbers: | ||
raise ValueError( | ||
f"{self.__class__.__name__} only supports the following GPIO " | ||
f"indices: {supported_gpio_numbers} but was asked to " | ||
f"use {gpio_number}" | ||
) | ||
self._controller.gpio_number = gpio_number | ||
|
||
@property | ||
def hints(self) -> Hints: | ||
return self._writer.hints |
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
Oops, something went wrong.