The Replot Server (bragi_quantum.gui)#

bragi_quantum.gui is an on-demand re-analysis and visualization server. It lets you regenerate and explore calibration plots from previously saved sessions without re-running the experiments — invaluable for post-hoc analysis, presentations and debugging.

How it works#

bragi_quantum.gui operates on a replay and re-render principle:

  1. Session persistence. Every session (produced by bragi_quantum.api) saves a session_timeline.json — metadata for each step, including the analysis class name and its parameters — alongside the raw HDF5 datasets.

  2. On-demand re-analysis. When you request a plot, bragi_quantum.gui loads the timeline, finds the step, re-imports and re-instantiates the recorded analysis class with the original data, re-runs the analysis, and returns the plot as a PNG.

  3. No re-execution. Quantum experiments are never re-run — it is pure re-analysis of saved data, so it is fast and costs no QPU time.

Note

bragi_quantum.gui instantiates the analysis class by the name recorded at calibration time. If the class was renamed, the replot cannot find it. If the analysis logic changed but the name stayed the same, the new analysis runs: it works if the saved data format is still compatible, and fails otherwise.

Note

For safety, timeline-driven imports are restricted by an allowlist (bragi_quantum.gui.registry) to the bragi_quantum.experiments., bragi_quantum.api., bragi_quantum.datalayer. and bragi_quantum.gui. package roots.

Running the server#

Point qc2-show at your directory of timestamped run folders (e.g. calibration_outputs/):

qc2-show calibration_outputs/ [--host 127.0.0.1] [--port 9999] [--log-level info]

This starts a local FastAPI server and opens a browser showing the archive browser: a sidebar of every run (newest first, updating live as new runs appear), each run’s sessions, on-demand plots, and a whole-pipeline view. The CLI picks a free port if the requested one is taken, and writes replot_endpoint.txt into each session folder so its HTML report can find the server automatically.

Tip

Running qc2-show in a VS Code terminal auto-forwards the browser session to your local machine.

Key features#

  • Fast iteration — regenerate plots in seconds, no calibration run required.

  • Multi-session — serve and compare many runs at once.

  • Whole-pipeline view — cross-session QoI trends and a clickable node DAG.

  • HTML & PDF reports — the same reports bragi_quantum.api writes, served interactively.

  • REST API — programmatic access to plots and session data.

REST API#

The server exposes routes at three levels. Archive-level routes list and search runs; per-session routes (prefix /session/{key}) serve one session; pipeline routes (prefix /pipeline/{run_ts}) serve a whole run.

Method

Endpoint

Purpose

GET

/

Archive sidebar page (all runs)

GET

/runs

JSON list of runs (drives the live sidebar)

GET

/search?q=

Search runs by qubit

GET

/stats / /version

Aggregate stats / server version

GET

/session/{key}/health

Liveness + session paths

GET

/session/{key}/steps

List the calibration steps in a session

GET

/session/{key}/step/{i}/element/{name}/plots

Available plot names for a (step, element)

POST

/session/{key}/plot

Render a specific plot (returns PNG); body = {step_index, element, plot_name}

GET

/session/{key}/report

Full HTML device report for a session

GET

/pipeline/{run_ts}

Whole-pipeline HTML page for a run

GET

/pipeline/{run_ts}/qoi-plot?name=&mode=

QoI trend plot across sessions (PNG)

Programmatic replay#

The same replay engine is available as a small Python API — handy for scripting or notebooks.

See bragi_quantum.gui API for the full reference.