bluesky_tiled_plugins.streaming.best_effort#

A best-effort callback that consumes Tiled live streams instead of Bluesky documents.

Module Contents#

Classes#

PeakResults

Peak statistics keyed like BestEffortCallback.peaks.

TiledBestEffortStreamer

Best-effort visualization of Bluesky runs streamed live from Tiled.

Functions#

peak_stats

Coarse peak statistics (max, min, com, cen, fwhm) of y versus x.

Data#

API#

bluesky_tiled_plugins.streaming.best_effort.logger#

‘getLogger(…)’

bluesky_tiled_plugins.streaming.best_effort.peak_stats(x: numpy.ndarray, y: numpy.ndarray) → dict[str, Any]#

Coarse peak statistics (max, min, com, cen, fwhm) of y versus x.

class bluesky_tiled_plugins.streaming.best_effort.PeakResults#

Peak statistics keyed like BestEffortCallback.peaks.

Each statistic is a dict keyed by field name, reachable both as an attribute (peaks.cen["det"]) and by subscription (peaks["cen"]["det"]), mirroring bluesky.callbacks.best_effort.PeakResults.

ATTRS#

(‘com’, ‘cen’, ‘max’, ‘min’, ‘fwhm’)

clear() → None#
class bluesky_tiled_plugins.streaming.best_effort.TiledBestEffortStreamer(container: tiled.client.container.Container, *, noplot_streams: collections.abc.Iterable[str] = ('baseline',), replay: bool = False, stop_timeout: float = 2.0, retained_runs: int = 4, max_size: int = 1000000, out: collections.abc.Callable[[str], None] = print)#

Best-effort visualization of Bluesky runs streamed live from Tiled.

Unlike bluesky.callbacks.best_effort.BestEffortCallback, this is not subscribed to a RunEngine. It subscribes to a Tiled container that a TiledWriter writes into and reconstructs the heading, live table, live plots, baseline readings, and peak statistics from:

  • the run node creation (metadata["start"]),

  • each event stream node’s metadata (the descriptor) and its live table data,

  • the run node metadata update that adds metadata["stop"].

Tiled invokes callbacks on worker threads, so updates are queued and only rendered when :meth:process_events (or :meth:run_forever) is called, which must happen on the thread that owns the matplotlib GUI.

Parameters

container : tiled.client.container.Container Direct parent of the BlueskyRun nodes created by TiledWriter. noplot_streams : iterable of str Streams that get neither a live table nor a plot. replay : bool Also show runs whose start time precedes this callback’s connection and that are still retained in Tiled’s streaming cache. stop_timeout : float Seconds to wait after the stop arrives for the remaining stream data before finishing the run. retained_runs : int Stopped runs whose start and descriptors stay cached; see subscribe_to_hinted_streams. out : callable Receives each line of text output. Defaults to print.

enable_heading() → None#
disable_heading() → None#
enable_table() → None#
disable_table() → None#
enable_baseline() → None#
disable_baseline() → None#
enable_plots() → None#
disable_plots() → None#
start() → bluesky_tiled_plugins.streaming.best_effort.TiledBestEffortStreamer#

Connect the Tiled websocket subscriptions.

disconnect() → None#

Disconnect all Tiled subscriptions.

process_events(timeout: float = 0.0) → None#

Render queued Tiled updates, waiting up to timeout seconds for more.

run_forever(interval: float = 0.1) → None#

Process updates and keep matplotlib figures responsive until interrupted.