bluesky_adaptive.on_stop.recommender_factory

bluesky_adaptive.on_stop.recommender_factory(*, adaptive_obj, independent_keys, dependent_keys, target_keys, stream_names=('primary',), max_count=10, queue=None, target_transforms=None)[source]

Generate the callback and queue for an Adaptive API backed reccomender.

This recommends a fixed step size independent of the measurement.

For each Run (aka Start) that the callback sees it will place either a recommendation or None 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.

The StartDocuments in the stream must contain the key 'batch_count'.

Parameters:
adaptive_objadaptive.BaseLearner

The recommendation engine. Must implement

independent_keysList[String | Callable]

Each value must be a stream name, field name, a valid Python expression, or a callable. The signature of the callable may include any valid Python identifiers provideed by construct_namespace() or the user-provided namespace parmeter below. See examples.

dependent_keysList[String | Callable]

Each value must be a stream name, field name, a valid Python expression, or a callable. The signature of the callable may include any valid Python identifiers provideed by construct_namespace() or the user-provided namespace parmeter below. See examples.

target_keysList[String]

Keys passed back to the plan, must be the same length as the return of adaptive_obj.ask(1)

stream_namesTuple[String], default (“primary”,)

The streams to be offered to the

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.

target_transformsDict[String, Callable], optional

Transforms to be applied to the values from ask before returning to the run engine. This can be useful handling trivial coordinate transformations.

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).