Running Experiments#

Everything is driven through the api package’s CalibrationOrchestrator. This guide covers the whole workflow; for the tutorial walk-through of a single experiment see Tutorial: Resonator Spectroscopy.

Warning

Running a node against real hardware requires a booked QPU time slot and a Redis port reserved for you. Set your own redis_port so you do not write into someone else’s database.

The orchestrator#

Construct a CalibrationOrchestrator with the name of a device template and a data handler:

from bragi_quantum.api.orchestra import CalibrationOrchestrator
from bragi_quantum.api.handlers.data import RedisDataHandler

orchestrator = CalibrationOrchestrator(
    experiment_template_name="example_chip",              # device_templates/example_chip/
    data_handler=RedisDataHandler(redis_port=6380),
    load_calibration_state=False,
)

On construction the orchestrator loads device.yaml, cluster.yaml and spi.yaml from the template, builds the live device model, seeds Redis, and creates the calibration_outputs/<timestamp>/ output directory. Hardware (cluster + SPI DAC) is connected lazily, on the first measurement-mode session.

load_calibration_state=True overlays previously calibrated Redis values onto the fresh device (and seeds Redis only where values are missing), so a run continues from the last known-good calibration instead of the template defaults.

Data handlers#

The data_handler selects the persistence backend:

  • RedisDataHandler (default) — a live Redis store for real calibration. Fields: redis_port (default 6379), redis_host (default localhost).

  • SnapshotDataHandler — a file-based Qblox snapshot for offline / re-analysis work. Redis is skipped entirely; the device is loaded from snapshot_dir/snapshot.json.

Running a single node#

run_node() executes one node. Call it standalone and it opens and closes a session for you:

from bragi_quantum.datalayer.managing.session import SessionOptions
from bragi_quantum.experiments.nodes.qubit_control.spectroscopy.node import QubitSpectroscopy
from bragi_quantum.experiments.nodes.qubit_control.spectroscopy.parameters import (
    QubitSpectroscopyParameters, QubitSpectroscopy01QOI,
)

orchestrator.run_node(
    QubitSpectroscopy(
        parameters=QubitSpectroscopyParameters(
            name="qubit_spec", qubits=["q16", "q17"], samples=101,
        ),
        qoi_cls=QubitSpectroscopy01QOI,
    ),
    run_options=SessionOptions(session_name="qubit_spectroscopy"),
)

Running several nodes in one session#

Open an explicit calibration_session() and every run_node inside it shares the same session id, output directory, PDF report and timeline — so a multi-node script yields one coherent set of artifacts:

with orchestrator.calibration_session(SessionOptions(session_name="bringup")):
    orchestrator.run_node(ResonatorSpectroscopy(parameters=res_params,
                                                qoi_cls=ResonatorSpectroscopyQOI))
    orchestrator.run_node(QubitSpectroscopy(parameters=spec_params,
                                            qoi_cls=QubitSpectroscopy01QOI))
    orchestrator.run_node(RabiOscillations(parameters=rabi_params,
                                           qoi_cls=Rabi01QOI))

run_pipeline() is a convenience wrapper that runs a list of nodes inside one session.

The node catalog#

All nodes follow the same node / parameters / analysis / measurement layout. The most common ones:

Experiment

Node class

Calibrates

Resonator spectroscopy

ResonatorSpectroscopy

readout resonator frequency, Ql, Qe

Punchout

bragi_quantum.experiments.nodes.readout.punchout.node.Punchout

readout pulse amplitude (low-power regime)

RO frequency optimization

ROTwoStateFrequencyOptimizationNode / …ThreeState…

readout frequency for best state discrimination

RO amplitude optimization

ROTwoStateAmplitudeOptimizationNode / …ThreeState…

readout amplitude + LDA discriminator

Qubit spectroscopy

QubitSpectroscopy

qubit transition frequency (f01 / f12)

Rabi oscillations

RabiOscillations / NRabiOscillations

π-pulse amplitude (amp180)

Ramsey fringes

RamseyFringes

qubit frequency detuning correction

Motzoi / DRAG

MotzoiParameter

DRAG coefficient (β)

See bragi_quantum.experiments API for the full list with parameters and QOIs.

Outputs#

Each run writes to calibration_outputs/<timestamp>/:

  • run_<session_name>/ — the HDF5 datasets, session_timeline.json, and the per-session html_rendering.html;

  • calibration_report.pdf — the PDF report;

  • index.html — a master page aggregating every session in the run (produced by generate_html_report()).

Browse them with bragi_quantum.gui:

qc2-show calibration_outputs/

Dry runs and re-analysis#

Set SessionOptions(execution_mode=...) to change what a run does:

  • "measurement" (default) — take real data on the hardware and persist calibrated values to Redis;

  • "dummy" — exercise the full pipeline without hardware, useful for testing;