bluesky.plans.subs_context¶
-
bluesky.plans.
subs_context
(plan_stack, subs)¶ Subscribe callbacks to the document stream; then unsubscribe on exit.
Parameters: - plan_stack (list-like) – appendable collection of generators that yield messages (Msg objects)
- subs (callable, list of callables, or dict of lists of callables) –
Documents of each type are routed to a list of functions. Input is normalized to a dict of lists of functions, like so:
- None -> {‘all’: [], ‘start’: [], ‘stop’: [], ‘event’: [],
- ‘descriptor’: []}
- func -> {‘all’: [func], ‘start’: [], ‘stop’: [], ‘event’: [],
- ‘descriptor’: []}
- [f1, f2] -> {‘all’: [f1, f2], ‘start’: [], ‘stop’: [], ‘event’: [],
- ‘descriptor’: []}
- {‘event’: [func]} -> {‘all’: [], ‘start’: [], ‘stop’: [],
- ‘event’: [func], ‘descriptor’: []}
Signature of functions must confirm to f(name, doc) where name is one of {‘all’, ‘start’, ‘stop’, ‘event’, ‘descriptor’} and doc is a dictionary.