TAPI: Tiled Application Programmer Interface#
TAPI: Local support for the tiled API & data structures.
- class gemviz.tapi.RunMetadata(cat, uid)[source]#
Cache the metadata for a single run.
- _dataset_to_arrays(dataset)[source]#
Convert xarray Dataset to dict of numpy arrays trimmed to shared length.
- _read_stream_arrays(stream_name)[source]#
Read each stream field individually and trim to shared length.
- force_refresh_stream_data(stream_name, raw=False)[source]#
Force refresh of stream data from server.
- property is_active#
Check if this run is currently active (not stopped).
A run is active if it has no stop document. This is the definitive indicator that a run is still acquiring data, regardless of its position in the catalog (which may change as new runs are added).
Note: This property refreshes metadata from the server to ensure accurate status.
- plottable_signals()[source]#
Return a dict with the plottable data for this run.
field: any available numeric data keys
motors: any data keys for motors declared by the run
detectors: any numeric data keys that are not motors or excluded names
plot_signal: the first detector signal
plot_axes: the first motor signal for each dimension
run.metadata[hints][dimensions] show the independent axes object names
Any given dimension may have more than one motor object (a2scan, …)
This code chooses to only use the first motor of each dimension.
The stream descriptor list is usually length = 1.
object_keys are used to get lists of data_keys (fields)
- stream_data_fields(stream_name)[source]#
Data field (names) of this BlueskyEventStream.
Sort the list by relevance.
First “time” (epoch timestamp for each event document), then “config” (the caller provided these names as parameters for this stream), then “data” (other signals in this stream, usually added from a Device hint).
- gemviz.tapi.connect_tiled_server(uri)[source]#
Make connection with the tiled server URI. Return a client object.
- gemviz.tapi.discover_catalogs(client, path='', deep_search=False, max_depth=None, root_client=None)[source]#
Recursively discover all CatalogOfBlueskyRuns in a tiled server.
Parameters:#
- clienttiled client node
Starting point (server root or Container)
- pathstr
Current path prefix
- deep_searchbool
If True, also search inside Catalogs for nested Containers
- max_depthint, optional
Maximum recursion depth (None = unlimited)
- root_clienttiled client node
Root server client. Required for path-based access when inside Catalogs.
Returns:#
- list of tuples
[(path, catalog_node), …] where path is the full path to the catalog
- gemviz.tapi.get_run(uri=None, catalog='training', reference=None)[source]#
Get referenced run from tiled server catalog.
- gemviz.tapi.get_tiled_runs(cat, since=None, until=None, text=[], text_case=[], **keys)[source]#
Return a new catalog, filtered by search terms.
Runs will be selected with start time >=since and < until. If either is None, then the corresponding filter will not be applied.
Parameters
- cat obj :
This is the catalog to be searched. Node object returned by tiled.client.
- since str :
Earliest start date (& time), in ISO8601 format.
- until str :
Latest start date (& time), in ISO8601 format.
- text [str] :
List of full text searches. Not sensitive to case.
- text_case [str] :
List of full text searches. Case sensitive.
- keys dict :
Dictionary of metadata keys and values to be matched.
- gemviz.tapi.is_catalog_of_bluesky_runs(node)[source]#
Check if a tiled node is a CatalogOfBlueskyRuns.
Parameters:#
- nodetiled client node
The node to check
Returns:#
- bool
True if node is a CatalogOfBlueskyRuns
- gemviz.tapi.is_not_container(node)[source]#
Return True if node is not a tiled container.
- Args:
node: tiled client node The node to check
Returns:#
- bool
True if node is a not a container
- gemviz.tapi.is_pure_container(node)[source]#
Check if a tiled node is a pure Container (not a Catalog, not a Run).
A pure container has: - structure_family == ‘container’ - specs == [] (empty)
Pure containers can contain other containers, files, or other items. We want to recurse into pure containers to find nested Catalogs.
Parameters:#
- nodetiled client node
The node to check
Returns:#
- bool
True if node is a pure Container (empty specs, not a Catalog or Run)