pcdsutils.ophyd_helpers.subscription_context

pcdsutils.ophyd_helpers.subscription_context(*objects: OphydObject, callback: Callable, event_type: str | None = None, run: bool = True)[source]

[Context manager] Subscribe to a specific event from all objects

Unsubscribes all signals before exiting

Parameters:
*objectsophyd.OphydObj

Ophyd objects (signals) 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