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

Move ADAravis detectors to ophyd-async #190

Merged
merged 1 commit into from
Apr 23, 2024
Merged

Move ADAravis detectors to ophyd-async #190

merged 1 commit into from
Apr 23, 2024

Conversation

DiamondJoseph
Copy link
Contributor

As discussed with @coretl, standard detectors should exist in ophyd-async instead of dodal.

Implementation of ADAravis OAV for i22, p38 at Diamond.

Fixes DiamondLightSource/dodal#409 (after a release of ophyd-async)

@callumforrester
Copy link
Contributor

@DiamondJoseph @coretl I'm not overjoyed at the separation of detector components across libraries. The fact that I have to have the writer/controller over in ophyd-async but assemble them in dodal is a bit cumbersome, especially if I want to update my code, I may have to do two PRs and an alpha release etc.

One thing that I think would help is to have an example assembly of these components in ophyd-async. In other words a more generic version of ADAaravisDetector in here https://github.com/DiamondLightSource/dodal/pull/421/files#diff-6b371b1b87d0470e413dd5e1fc0a50233e042ddf494229e8a7e22fc70d673c64R147-R201

To be clear, that is as well as rather than instead of. What do you think?

@coretl
Copy link
Collaborator

coretl commented Apr 11, 2024

One thing that I think would help is to have an example assembly of these components in ophyd-async. In other words a more generic version of ADAaravisDetector in here https://github.com/DiamondLightSource/dodal/pull/421/files#diff-6b371b1b87d0470e413dd5e1fc0a50233e042ddf494229e8a7e22fc70d673c64R147-R201

To be clear, that is as well as rather than instead of. What do you think?

That sounds like a good idea, the only reason I don't want to put it in ophyd-async in the first place is because we don't want to put anything that relies on our naming conventions there.

Actually we could extend that idea even further, and make the HDFAravis class not know anything about naming conventions, e.g.

class HDFAravis(StandardDetector):
    def __init__(
        self,
        prefix: str,
        driver_suffix: str,
        hdf_suffix: str,
        ...
    ):
        self.drv = ADAravis(prefix + driver_suffix)
        self.hdf = NDFileHDF(prefix + hdf_suffix)
        super().__init__(
            controller=ADAravisController(self.drv, ...),
            writer=HDFWriter(self.hdf, ...),
            ...
        )

Then in dodal:

def oav():
    return HDFAravis("BL22I-EA-DET-01:", driver_suffix="DRV:", hdf_suffix="HDF:")

More typing, but clearer how the PV names are constructed...

What do you reckon?

@DiamondJoseph
Copy link
Contributor Author

DiamondJoseph commented Apr 11, 2024

At that point why not just

class HDFAravis(StandardDetector):
    def __init__(
        self,
        driver: ADAravisDriver,
        hdf: NDFileHDF,
        ...
    ):
        self.drv = driver
        self.hdf = hdf
        super().__init__(
            controller=ADAravisController(driver),
            writer=HDFWriter(hdf, ...),
            ...
        )

I'm sure someone is creating a Driver or Writer that isn't on the same prefix as the rest of the device

@coretl
Copy link
Collaborator

coretl commented Apr 11, 2024

Hmm, so then dodal would have:

def oav():
    prefix = "BL22I-EA-DET-01:"
    return HDFAravis(ADAravis(prefix + "DRV:"), NDFileHDF(prefix + "HDF:"))

I guess that extends to extra plugins reasonably nicely too...

@DiamondJoseph
Copy link
Contributor Author

device_instantiation still requires prefix, name as arguments, but with those passed too

@DiamondJoseph
Copy link
Contributor Author

tests/epics/demo/test_demo.py::test_mover_moving_well seems to be reliably slower than expected on Python 3.10...

@DiamondJoseph
Copy link
Contributor Author

DiamondJoseph commented Apr 22, 2024

Note: this is currently based on top of #249 due to requiring the Signals of WriteType Enum, ReadType String. Once that has been merged it should be rebased. There is only one relevant commit: the latter, with the implementation being added.

@DiamondJoseph
Copy link
Contributor Author

This change no longer requires #249 and instead passes AravisTriggerSource as a String. #249 will be handled later

Copy link
Collaborator

@abbiemery abbiemery left a comment

Choose a reason for hiding this comment

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

LGTM. Having it merged allows us make a pre-release and test before commuting to a full release so I'm favouring ship and iterate here.

@DiamondJoseph DiamondJoseph merged commit 28710fc into main Apr 23, 2024
18 checks passed
@DiamondJoseph DiamondJoseph deleted the aravis branch April 23, 2024 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adjust and merge Adaravis area detector classes for i22 OAV
5 participants