bluesky_tiled_plugins.streaming.hints#

Subscribe to the hinted fields of live Bluesky event streams in Tiled.

Module Contents#

Classes#

HintedStreamUpdate

New rows of a Bluesky event stream together with its hints.

Functions#

subscribe_to_hinted_streams

Subscribe to live table data of every event stream, annotated with its hints.

Data#

API#

bluesky_tiled_plugins.streaming.hints.SEQ_NUM#

‘seq_num’

bluesky_tiled_plugins.streaming.hints.TIME#

‘time’

class bluesky_tiled_plugins.streaming.hints.HintedStreamUpdate#

New rows of a Bluesky event stream together with its hints.

Parameters

run_uid : str Uid of the run, the key of its BlueskyRun node. stream_name : str Name of the event stream. start : dict The run’s start document. descriptor : dict The event stream node’s metadata (the descriptor as written by TiledWriter). fields : tuple of str Scalar dimension fields of this stream followed by its hinted fields. table : pandas.DataFrame All new rows, with every column TiledWriter wrote (seq_num, time, data keys, and ts_* timestamps).

run_uid: str#

None

stream_name: str#

None

start: dict[str, Any]#

None

descriptor: dict[str, Any]#

None

fields: tuple[str, ...]#

None

table: pandas.DataFrame#

None

data() → pandas.DataFrame#

Return the seq_num, time, and hinted columns of the new rows.

bluesky_tiled_plugins.streaming.hints.subscribe_to_hinted_streams(container: tiled.client.container.Container, callback: collections.abc.Callable[[bluesky_tiled_plugins.streaming.hints.HintedStreamUpdate], None], *, run_filter: collections.abc.Callable[[tiled.client.stream.LiveChildCreated], bool] | None = None, on_run_stop: collections.abc.Callable[[str, collections.abc.Mapping[str, Any]], None] | None = None, retained_runs: int = 4, start: int | None = 0, max_size: int = 1000000) → bluesky_tiled_plugins.streaming.streaming.BlueskyStreamSubscription#

Subscribe to live table data of every event stream, annotated with its hints.

Hints are only known once a run and its streams exist, so every stream is subscribed and each stream’s descriptor is fetched from Tiled on its first update. Only TiledWriter’s internal tables are delivered; array nodes are ignored.

Parameters

container : tiled.client.container.Container Direct parent of the BlueskyRun nodes created by TiledWriter. callback : Callable[[HintedStreamUpdate], None] Called on a Tiled worker thread, possibly concurrently, for each table update. run_filter : Callable[[LiveChildCreated], bool], optional Predicate applied to each new run. It runs before any of the run’s data is delivered. on_run_stop : Callable[[str, Mapping], None], optional Called with the run uid and stop document of each accepted run. It may precede the run’s last data updates; see subscribe_to_streams. retained_runs : int, optional Scales the bounded cache of start documents and descriptors (roughly the number of recent runs whose streams stay cached). Data arriving for an evicted stream is still delivered, but refetches the start document and descriptor from Tiled. start, max_size Passed through to subscribe_to_streams.