stanza.logger.session
Module Contents
Classes
Data
logger
API
Value: getLogger(...)
Context manager for streaming sweep data with live plotting.
Accumulates data points via append() calls, streams to live plot writers immediately, and writes the complete sweep to file writers on context exit.
Supports 1D sweeps (scalar x, scalar y) and 2D sweeps ([x0, x1], y).
Example:
1D sweep
with session.sweep(“signal”, “Time”, “Amplitude”) as s: … for x, y in data_stream: … s.append([x], [y]) # Live plot updates
2D sweep
with session.sweep(“heatmap”, [“V1”, “V2”], “Current”) as s: … for v1, v2 in voltage_pairs: … s.append([v1, v2], [current]) # Live heatmap updates
Sweep written to files here
Initialization
Initialize sweep context.
Parameters:
Parameters:
- session: Parent LoggerSession
- name: Sweep name
- x_label: X-axis label (string for 1D, list for 2D)
- y_label: Y-axis label
- metadata: User metadata dict
- routine_name: Optional routine name
Append data points and stream to live plots.
1D: append([x], [y]) or append([x1, x2, …], [y1, y2, …]) 2D: append([x, y], [value])
Write accumulated sweep to file writers.
Cancel without persisting. Live updates remain visible.
Enter context manager.
Exit context manager: end() on success, cancel() on exception.
Session for the logger.
Check if buffer has grown too large and log warning once.
Initialize the session.
Raises:
LoggerSessionError: If session is already initialized
Finalize the session.
Close the session (alias for finalize()).
Log measurement data to a session.
Log analysis data to a session.
Log sweep data to a session.
Log parameters to a session.
Create streaming sweep context for live plotting.
Accumulates data via append(), writes complete sweep to files on exit. Supports 1D and 2D data. Exception in context = no file write. One active sweep per name; HDF5 auto-uniquifies sequential same-name sweeps.
Example:
1D sweep
with session.sweep(“signal”, “Time (s)”, “Amplitude”) as s: for x, y in data_stream: s.append([x], [y])
2D sweep
with session.sweep(“heatmap”, [“V1 (V)”, “V2 (V)”], “Current (A)”) as s: for v1, v2 in voltage_pairs: s.append([v1, v2], [current])
Check if buffer should be flushed.
Stream data chunk to live plot writers only.
Write complete sweep to file writers only (skip live/bokeh).
Flush buffered data to all writers.
Raises:
LoggerSessionError: If any writer fails to write or flush data
Enter the session context.
Exit the session context.

