Tutorial: Resonator Spectroscopy#

This tutorial walks through the simplest end-to-end experiment in the toolkit: a resonator spectroscopy sweep. By the end you will have run a real calibration node, understood how the pieces fit together, and know where the results are stored.

Hardware required. This notebook talks to the Qblox cluster and a Redis database, so it is not executed when the documentation is built — the cells are shown for reference. Run it yourself on the lab PC during a booked QPU time slot, after setting your own REDIS_PORT.

What resonator spectroscopy measures#

Each qubit is read out through a dispersive readout resonator. Sweeping the readout-line frequency across the resonator and recording the transmitted signal \(|S_{21}|\) reveals a Lorentzian dip at the resonance frequency. Fitting that dip gives us:

  • the resonator frequency (where we should read out),

  • the loaded and external quality factors \(Q_l\), \(Q_e\),

  • the asymmetry phase \(\theta\).

These are the first things you calibrate on a fresh chip: without a good readout frequency, nothing else can be measured reliably. The fit model is a Lorentzian dip on a linearly tilted background, so traces with sloped shoulders are handled correctly (see bragi_quantum.experiments.nodes.readout.resonator_spectroscopy.analysis).

1. Imports#

The experiment is assembled from three packages:

  • bragi_quantum.api provides the CalibrationOrchestrator (the driver) and the RedisDataHandler (where data is persisted).

  • bragi_quantum.datalayer provides SessionOptions, which configures a single run.

  • bragi_quantum.experiments provides the ResonatorSpectroscopy node together with its Parameters and QOI classes.

[ ]:
from bragi_quantum.api.handlers.data import RedisDataHandler
from bragi_quantum.api.orchestra import CalibrationOrchestrator
from bragi_quantum.datalayer.managing.session import SessionOptions
from bragi_quantum.experiments.nodes.readout.resonator_spectroscopy.node import (
    ResonatorSpectroscopy,
)
from bragi_quantum.experiments.nodes.readout.resonator_spectroscopy.parameters import (
    ResonatorSpectroscopyParameters,
    ResonatorSpectroscopyQOI,
)

2. Configuration#

Pick the qubits to measure and set your own reserved Redis port so you do not write into someone else’s database. HALF_WIDTH is the half-width of the frequency window swept around each qubit’s known readout frequency.

[ ]:
QUBITS = [f"q{i:02d}" for i in range(16, 26)]  # q16 ... q25
SAMPLES = 101  # frequency points per resonator
HALF_WIDTH = 1e6  # Hz, half-width of the sweep window
REDIS_PORT = 6380  # <-- change to YOUR reserved port

3. Build the orchestrator#

The CalibrationOrchestrator is the main entry point. Constructing it:

  1. loads the example_chip device template (device.yaml, cluster.yaml, spi.yaml under device_templates/example_chip/),

  2. builds the in-memory device model of the chip,

  3. seeds Redis with the template defaults,

  4. creates the calibration_outputs/<timestamp>/ output folder.

The Qblox cluster itself is connected lazily, the first time a measurement session runs.

[ ]:
orchestrator = CalibrationOrchestrator(
    experiment_template_name="example_chip",
    data_handler=RedisDataHandler(redis_port=REDIS_PORT),
)

4. Define the experiment parameters#

ResonatorSpectroscopyParameters is a validated (Pydantic) description of the sweep. The key fields:

Field

Meaning

name

label for this node, used in filenames & the report

qubits

which qubits to sweep (names must match the device config exactly, e.g. q16, q17, …)

readout_state

the qubit state to prepare (0 = ground state)

samples

number of frequency points per resonator

half_width

half-width of the sweep window, in Hz

There are more fields controlling the sliding-window fit and punchout — see the API reference — but the defaults are sensible for a standard sweep.

[ ]:
res_spec_params = ResonatorSpectroscopyParameters(
    name="resonator_spec",
    qubits=QUBITS,
    readout_state=0,
    samples=SAMPLES,
    half_width=HALF_WIDTH,
)

5. Run the node inside a session#

A node reads the device and hardware from the active session, so it must be created and run inside a calibration_session block. SessionOptions names the run — here the outputs land under calibration_outputs/<timestamp>/run_resonator_spectroscopy/.

We pass qoi_cls=ResonatorSpectroscopyQOI so the fit results (state-0 quantities of interest) are persisted back to the device model and Redis.

[ ]:
with orchestrator.calibration_session(
    SessionOptions(session_name="resonator_spectroscopy")
):
    orchestrator.run_node(
        ResonatorSpectroscopy(
            parameters=res_spec_params,
            qoi_cls=ResonatorSpectroscopyQOI,
        )
    )

6. Inspect the results#

When the session closes, the run folder contains one HDF5 dataset, the session_timeline.json log, a PDF report and an interactive HTML report. The fitted quantities (resonator frequency, \(Q_l\), \(Q_e\), \(\theta\)) are written into the device model and stored in Redis as trusted values, ready for the next calibration step.

Browse everything — including on-demand replots of each resonator dip — with the bragi_quantum.gui server:

[ ]:
# In a terminal (not in the notebook):
#   qc2-show calibration_outputs/
#
# Opens the archive browser at http://127.0.0.1:9999 with a live sidebar of
# every run, per-qubit plots, and the whole-pipeline view.

Next steps#

  • Chain several nodes in one session (resonator spectroscopy → qubit spectroscopy → Rabi) to build a bring-up pipeline — see Running Experiments.

  • Read Core Concepts to understand the Node / Measurement / Analysis / QOI anatomy behind every experiment.

  • Explore the full node catalog.