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

Area detector startup timeouts #56

Open
gfabbris opened this issue Jan 18, 2025 · 2 comments
Open

Area detector startup timeouts #56

gfabbris opened this issue Jan 18, 2025 · 2 comments

Comments

@gfabbris
Copy link
Contributor

gfabbris commented Jan 18, 2025

The area detectors behave sort of differently during startup. As I understand it, given the number of PVs usually associated with these devices, ophyd intentionally tries to do a lazy startup of them. However, the devices will try to connect to any EpicsSignal that is handled during __init__ calls. For example, something like self._acquisition_signal = self.cam.acquire will require the self.cam.acquire connection, and will use the default PV connection timeout for it.

So, the way that we load the devices and wait for connection (using device.wait_for_connection(timeout)) doesn't really apply for area detectors because 1) wait_for_connection doesn't really test much in these devices, and 2) it already waits for the __init__ PVs during the load.

@prjemian
Copy link

FYI @canismarko, is this a consideration with the developing area detector support using ophyd-async?

@canismarko
Copy link

I think Ophyd-async solved this by getting rid of lazy signals. Also, no signals get connected during __init__.

Instead, after creating the detector device, you need to await the detector device's connect() method, which establishes all the CA connections, etc.

detector = SimDetector(prefix="25idSimDet:", name="sim_detector")  # <- No connections yet
await detector.connect(). # <- Establish CA connections, etc.

I suspect the initial reason for doing the lazy signals was to speed up the loading of devices. In ophyd-async, this is done either by using asyncio.gather to connect multiple devices, or (even better) using theophyd_async.core.init_devices context manager:

with init_devices():
    sim_detector = SimDetector("25idSimDet:")
    mono_camera = AravisDetector("25idGigEA:")
# Devices get connected concurrently when exiting the context manager

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

No branches or pull requests

3 participants