pcdsutils.ophyd_helpers.subscription_context_device

pcdsutils.ophyd_helpers.subscription_context_device(device: Device, callback: SubscribeCallback, event_type: str | None = None, run: bool = True, *, include_lazy: bool = False, filter_by: Callable[[ComponentWalk], bool] | None = None)[source]

[Context manager] Subscribe to event_type from signals in device.

Unsubscribes all signals before exiting

Parameters:
deviceophyd.Device

ophyd Device to monitor

callbackcallable

Callback to run, with same signature as that of ophyd.OphydObj.subscribe()

event_typestr, optional

The event type to subscribe to

runbool, optional

Run the previously cached subscription immediately

include_lazybool, optional

Include lazy signals as well

filter_bycallable, optional

Filter signals, with signature callable(ophyd.Device.ComponentWalk)