bluesky_tiled_plugins.writing._json_writer#

Module Contents#

Classes#

JSONWriter

Writer of Bluesky documents of a single run into a JSON file as an array.

JSONLinesWriter

Writer of Bluesky documents from a single run into a JSON Lines file

JSONDictWriter

Writer of Bluesky documents from a single run into a dictionary in JSON format

Functions#

default_name

Default naming function for JSON runs.

API#

bluesky_tiled_plugins.writing._json_writer.default_name(name, doc, suffix='')#

Default naming function for JSON runs.

If the first document is a start document, use the first part of uid to create a filename. Otherwise, use the current timestamp.

class bluesky_tiled_plugins.writing._json_writer.JSONWriter(dirname: str, filename: str | None = None)#

Writer of Bluesky documents of a single run into a JSON file as an array.

The file is created when a Start document is received, each new document is written immediately, and the JSON array is closed when the “stop” document is received.

class bluesky_tiled_plugins.writing._json_writer.JSONLinesWriter(dirname: str, filename: str | None = None)#

Writer of Bluesky documents from a single run into a JSON Lines file

If the file already exists, new documents will be appended to it.

class bluesky_tiled_plugins.writing._json_writer.JSONDictWriter(store: dict, key: Optional[str] = None)#

Writer of Bluesky documents from a single run into a dictionary in JSON format

The dictionary can be in memory or backed by Redis or any other key-value store. The writer will append documents to a list under the key corresponding to the document uuid.