bluesky_adaptive.per_event.recommender_factory

bluesky_adaptive.per_event.recommender_factory(recommender, independent_keys, dependent_keys, *, max_count=10, queue=None)[source]

Generate the callback and queue for recommender agent integration.

For each Event that the callback sees it will place either a recommendation, None, or Exception for the Run Engine into the queue. Recommendations will be of a dict mapping the independent_keys to the recommended values and should be interpreted by the plan as a request for more data. A None placed in the queue should be interpreted by the plan as in instruction to terminate the run. An Exception placed in the queue will be raised by the plan.

Parameters:
recommenderobject

The recommendation agent object with ask/tell interface

independent_keysList[str]

The names of the independent keys in the events

dependent_keysList[str]

The names of the dependent keys in the events

max_countint, optional

The maximum number of measurements to take before poisoning the queue.

queueQueue, optional

The communication channel for the callback to feedback to the plan. If not given, a new queue will be created.

Returns:
callbackCallable[str, dict]

This function must be subscribed to RunEngine to receive the document stream.

queueQueue

The communication channel between the callback and the plan. This is always returned (even if the user passed it in).