Core Concepts#
The core component of our library are surely the calibration nodes: every high-level pipeline needs these building blocks as its core! A calibration node, in our framework, is not only a node in a graph, but instead a well structured software piece, composed of measurement, analysis and tracking tools. Series o calibration nodes can be structured with complete freedom and grouped into calibration sessions. A Session is here a Python context where an arbitrary calibration environment is set by the user. Organizing our work into session also facilitates the visualization of our results through bragi_quantum.gui.
Many of the calibration nodes below reason about qubit state as a rotation on the Bloch sphere
(the same \(\theta\)/\(\phi\) convention used by qblox_scheduler’s gate library). If
that’s unfamiliar, or you just want to build intuition before diving into a specific node, try
the interactive widget:
Every field of a node’s BaseParameters falls into exactly one of three categories:
metadata — identity/targeting fields, such as the node name or which qubits and couplers the run applies to. Changing one identifies a different run rather than re-processing the same data.
acquisition — fields baked into the measurement itself (sweep ranges, number of points, repetitions, pulse settings). Changing one requires re-running on hardware; it cannot be re-applied to already-saved data.
analysis — fields consumed only in post-processing/fitting (thresholds, \(R^2\) cut-offs, fit windows). Safe to change and re-apply to saved data, e.g. during a reanalysis in bragi_quantum.gui.
Anatomy of a calibration node#
A bragi_quantum.experiments node is assembled from four cooperating families of classes. To add a new experiment you provide one subclass from each:
Piece |
Base class |
Responsibility |
|---|---|---|
Parameters |
A validated (Pydantic, |
|
Measurement |
Builds the pulse schedule for every element. Supplies the readout gate
( |
|
Analysis |
|
Fits the measured data. A single-element analysis ( |
QOI |
The Quantities of Interest extracted by the fit (e.g. fitted frequency,
quality factors). |
The Node (BaseNode, specialized as
QubitNode /
CouplerNode) is the orchestrator that ties these
together. It sets measurement_cls and node_analysis_cls as class
attributes and receives the single_element_analysis_cls and qoi_cls at
construction:
node = ResonatorSpectroscopy(
parameters=ResonatorSpectroscopyParameters(name="res", qubits=["q16"]),
qoi_cls=ResonatorSpectroscopyQOI,
)
Important
A node reads the device, hardware and persistence from the active session
during construction, so a node can only be instantiated inside a
calibration_session() block (or
inside run_node(), which opens
one for you).
The node lifecycle#
When the orchestrator calls node.execute(), a node runs through:
build the measurement schedule from
schedule_samplespace+schedule_keywords(_build_measurement→precompile);measure — run the compiled schedule on the instrument coordinator, returning a raw
xarraydataset (batched / outer-looped as needed for the Qblox instruction and memory limits);save the dataset to HDF5 via
bragi_quantum.datalayer.managing.dataset.save_dataset();post-process — run the node analysis, obtain per-element QOIs, apply them to the live device, and record them in the session timeline and (for
measurementmode) in Redis as trusted values.
Node families#
Concrete nodes inherit a node-type mixin that provides the execution strategy:
ScheduleQubitNode— the experiment is defined entirely by a pulse schedule (all catalog qubit/readout nodes use this).Note
To recompile a schedule at each point of an outer sweep and pass the point as an argument to the schedule builder before recompilation, then use
outer_schedule_samplespace. For measurements where the parameter is completely external, useExternalParameterNode.ExternalParameterNodeand its subclasses — sweep a hardware parameter outside the schedule (e.g. for DC flux current) but without passing the parameter as an argument to the schedule building function. External sweep values are set with the attributeexternal_samplespace.
The session#
A calibration session is one registered
SessionContext — the single source of truth
for a run. It carries the device model, the instrument coordinator, the Redis
connection, the SPI DAC handler, the cluster configuration and the
SessionOptions.
ActiveSession is a thread-safe singleton
that holds the current context. The api package calls ActiveSession.start(context) to
open a session and ActiveSession.stop() to close it; bragi_quantum.experiments nodes call
ActiveSession.get() to read what they need. This is why the two packages never
import each other.
SessionOptions configures a single run —
session_name (which names the output folder), which qubits/couplers to touch,
report options, the execution_mode (measurement / dummy /
reanalyse), and cluster/SPI parameters.
Every session produces, under calibration_outputs/<timestamp>/run_<session_name>/:
the HDF5 datasets (one per node);
session_timeline.json— the ordered log of steps, replayed later by bragi_quantum.gui;a PDF report and an interactive HTML report.
Where results are stored#
Calibrated values live in three complementary places:
the live device model — updated in-memory during the run so later nodes see the freshly calibrated parameters;
Redis — the authoritative store of calibrated (trusted) values across runs, written via
bragi_quantum.datalayer.managing.redis.update_redis_trusted_values();HDF5 + timeline — the raw data and metadata that let bragi_quantum.gui reproduce any plot without re-running the experiment.