Callbacks#
OptimizationCallbackRouter#
- class blop.callbacks.OptimizationCallbackRouter(callbacks)[source]#
Bases:
objectRoutes documents from optimization runs to a list of callbacks.
Acts as a Bluesky callback that filters documents by
run_key, forwarding only those from"optimize"or"sample_suggestions"runs to the registered callbacks.The router holds a reference to the provided list, so external mutations (e.g.
callbacks.append(cb)) take effect on the next run.- Parameters:
- callbackslist[CallbackBase]
A mutable list of callback instances. The router reads from this list at the start of each matching run.
OptimizationLogger#
- class blop.callbacks.logger.OptimizationLogger(console=None, **kwargs)[source]#
Bases:
CallbackBaseA Bluesky callback for displaying optimization progress to the console.
This callback provides structured, styled console output during optimization runs using the
richlibrary. It listens for documents from theoptimizeplan and displays:A header panel with optimizer configuration at run start
A formatted table of parameter and outcome values for each iteration
A compact inline summary of outcome statistics after each iteration
A full summary statistics table at run completion
Notes
Multiple consecutive optimization runs will accumulate iteration counts and statistics.
When
n_points > 1, each iteration is displayed as a multi-row table showing the batch of points suggested together by the optimizer, with NaN-padded entries (from incomplete batches) filtered out.- start(doc)[source]#
Process the start document from the Bluesky run.
Logs the optimization setup observed from metadata.