This release is a pre-release and may not be stable for production use.
Tergite Tuner
A Python library that tunes up the WACQT quantum computers.
This is a stripped down fork of the tergite-autocalibration project that was developed jointly by Chalmers Next Labs (CNL) and the Quantum Technology department of Chalmers University of Technology.
It is meant to be used as a library that one can install in their project while tergite-autocalibration is meant to be used more interactively with CLI, GUI to browse datasets, and charts for more manual oversight of the tuneup.
It contains a calibration runner, a collection of calibration schedules, and a collection of post-processing and analysis routines. It is developed and tested on the WACQT quantum computers at Chalmers Next Labs quantum testbed and Chalmers University of Technology.
This project is developed by a core group of collaborators. Chalmers Next Labs AB (CNL) takes on the role of managing and maintaining this project.
Note: The Tergite stack is developed on a separate version control system and mirrored on GitHub. If you are reading this on GitHub, then you are looking at a mirror.
This project owes its very existence to the tireless work of the authors and contributors of tergite-autocalibration.
Quick Start
Requirements
- Python ≥ 3.13 (a fresh
condaorvenvenvironment is fine).
Installation
pip install tergite-tuner
Copy the example environment file and edit it as needed.
The .env file controls the cluster IP, target node,
qubits/couplers under calibration, and so on.
Every field on SessionContext can be set in the .env or as an environment variable
(in upper case), or passed as a keyword argument to the public API of the entry point functions.
A keyword argument wins over an environment variable, which wins over the .env file.
IS_RECALIBRATION and IGNORE_SPEC default to True: a run recalibrates the nodes,
whatever their calibration status, without resetting the cluster or setting the couplers'
currents. Set both to False to tune up the device from the device config.
On top of having a .env file, more configuration files maybe required.
(See .example.env file for more details)
cluster_config.json: It is thequantify-schedulerconfiguration json filedevice_config.toml: It contains details about the quantum chip, including initial values of params of the chip.node_config.toml: It contains details about the calibration nodes to run, including initial values for each node- Optional:
spi_config.toml: It contains details about the SPI instrument for driving the couplers.
The contents of each of these files can as well be passed to the entry functions as python objects e.g.
from tergite_tuner import tune_device
from tergite_tuner.config.types import (
DeviceConfig,
ClusterConfig,
SpiConfig,
NodeConfig,
)
_, results = tune_device(
device_config=DeviceConfig(
name = "matthias",
resonator={
"all": {"attenuation": 10},
"q01": { "VNA_frequency": 6433000000.0 },
"q02":{ "VNA_frequency": 6290000000.0 },
},
# ...
),
node_config=NodeConfig.model_validate(
{
"qubit_spectroscopy_vs_current": {
"all": {
"spec.spec_duration": 6e-6,
"reset.duration": 200e-6,
},
}
}
),
spi_config=SpiConfig.model_validate({
"q11_q12": {
"spi_module_number": 1,
"dac_name": "dac0",
"edge_group": 1,
},
"q12_q13": {
"spi_module_number": 2,
"dac_name": "dac1",
"edge_group": 2,
}
}),
cluster_config=ClusterConfig.model_validate({
"config_type": "quantify_scheduler.backends.qblox_backend.QbloxHardwareCompilationConfig",
"hardware_description": {
"clusterA": {
"instrument_type": "Cluster",
"ref": "internal",
"modules": {
"1": {
"instrument_type": "QCM_RF"
},
}
}
},
# ...
})
)
Customization of Nodes
A node is a NodeSpec: its schedule, sweeps, analysis and the device state's fields it sets.
You can pass in your own specs, to replace a default node or add one, with node_specs.
You can also change the order in which the nodes run or even choose to skip some of them
by supplying your own ignored_nodes: tuple[NodeEnum, ...] = ... and
node_dag_edges: tuple[tuple[NodeEnum, NodeEnum], ...] as args to the entry point functions.
import dataclasses
from tergite_tuner import tune_device, NodeEnum
from tergite_tuner.lib.nodes import DEFAULT_NODE_SPECS
def analyse_my_way(s21, session):
...
_, results = tune_device(
node_specs={
NodeEnum.QUBIT_01_SPECTROSCOPY: dataclasses.replace(
DEFAULT_NODE_SPECS[NodeEnum.QUBIT_01_SPECTROSCOPY], analyse=analyse_my_way
),
},
node_dag_edges=(
(NodeEnum.PUNCHOUT, NodeEnum.TOF,),
(NodeEnum.QUBIT_01_SPECTROSCOPY, NodeEnum.COUPLER_ANTICROSSING),
),
ignored_nodes=(NodeEnum.PUNCHOUT,)
)
Public API
The library exposes the following entry points from
tergite_tuner.__init__:
from tergite_tuner import (
tune_device,
reanalyse,
generate_calib_seed_file,
run_node,
read_result,
NodeEnum,
SessionContext,
CalibrationResults,
)
Run the full calibration pipeline
from tergite_tuner import tune_device, read_result
from tergite_tuner.lib.nodes import NodeEnum
# Use a .env file as the only source of configuration
_, results = tune_device(env_file=".env")
# Or override individual SessionContext fields inline
session, results = tune_device(
env_file=".env",
target_node=NodeEnum.RABI_OSCILLATIONS,
qubits=["q00", "q01"],
couplers=["q00_q01"],
)
# you can even pass a session from before or construct it yourself with
# SessionContext.from_env()
tune_device(session=session, refresh_session=False)
# if you disabled session-refresh, you can read all results on
# that session at once
results = read_result(session)
tune_device constructs a SessionContext, walks the dependency
DAG up to target_node, and calibrates any nodes that are not yet
in spec.
Recalibrate the device
A session's device state starts from device_config.toml, and nothing carries over from an earlier run
unless you pass it in: give an earlier calibration's results as calibration, as tune_device returns them
or as the results.json each run writes in its folder.
A session keeps its state across the calls you pass it to.
from tergite_tuner import tune_device, NodeEnum
# Use a .env file as the only source of configuration
_, results = tune_device(env_file=".env")
# Or override individual SessionContext fields inline
session, results = tune_device(
env_file=".env",
target_node=NodeEnum.RABI_OSCILLATIONS,
qubits=["q00", "q01"],
couplers=["q00_q01"],
is_recalibration=False,
ignore_spec=False,
)
# you can even pass a session from before or construct it yourself with
# SessionContext.from_env()
_, results = tune_device(session=session, refresh_session=False)
# you could clear up all the data files after the run
_, results = tune_device(
session=session, refresh_session=False, keep_data_files=False)
Run one node
from tergite_tuner import run_node, NodeEnum, read_result
# Use a .env file as the only source of configuration
session, results = run_node(
env_file=".env", node=NodeEnum.QUBIT_01_SPECTROSCOPY)
# Or override individual SessionContext fields inline
_, results = run_node(
env_file=".env",
qubits=["q00", "q01"],
couplers=["q00_q01"],
node=NodeEnum.QUBIT_01_SPECTROSCOPY
)
# you can even pass a session from before or construct it yourself with
# SessionContext.from_env()
run_node(
node=NodeEnum.QUBIT_01_SPECTROSCOPY, session=session, refresh_session=False)
# if you disabled session-refresh, you can read all results on
# that session at once
results = read_result(session)
# you could clear up all the data files after the run
_, results = run_node(
node=NodeEnum.QUBIT_01_SPECTROSCOPY,
session=session,
refresh_session=False,
keep_data_files=False,
)
Re-run analysis on already-recorded data
from pathlib import Path
from tergite_tuner import reanalyse
_, results = reanalyse(
env_file=".env",
data_dir=Path("out/<run>/<node folder>"), # the folder holding dataset_<node>.hdf5
)
Generate a BCC calibration seed
from tergite_tuner import generate_calib_seed_file, tune_device
# From a session a run calibrated, as 'calibration.seed.toml' by default
session, _ = tune_device(env_file=".env")
generate_calib_seed_file(session=session)
# Or from earlier results, with the qubits and couplers from the .env file
generate_calib_seed_file(
env_file=".env", calibration=results, path="/path/to/destination/toml/file"
)
Samples
You can find a few examples in the ./examples folder
ToDo
- Update export to BCC to be more generic to allow any BaseModel class to be output
On a real device
These need a real Cluster, with CLUSTER_MODE='real'; a dummy run cannot show them.
- Run resonator spectroscopy, also at |2>; bring-up, 01 and 12 qubit spectroscopy with the example node config; Rabi, motzoi and the readout optimizations; T1 and T2. Each should complete, and its values match a run of 2026.06.0.
- Run coupler anticrossing, resonator spectroscopy vs current, then CZ chevron, calibration, local phases and RB on one coupler; their crossings and fidelities should match an earlier run. CZ parametrization on two couplers excites each coupler's qubits only in its own shots, and CZ RB on two couplers raises
ValueError. - Run punchout, the longest schedule at about 264 s, and a CZ calibration with its real
loop_repetitions: neither raises a timeout, and punchout leaves quantify-scheduler'sGRID_TIME_TOLERANCE_TIMEat0.0011. - Run a tune-up through CZ calibration with
save_plot, then a second session withcalibrationset to the first'sresults.json: its nodes start from the first run's values, and the plots look as before. - Run single-qubit RB, interleaved with X90, purity benchmarking and AllXY: each stores its values, and RB's fidelity matches an earlier run.
- Check the fixes a dummy run cannot:
CLUSTER_IPwith no Cluster raisesClusterUnreachableErrorand the Python session survives;save_plotover SSH without a display saves its plots; Rabi and three-state readout amplitude optimization give each qubit its own pulse duration; aspec_durationof 8 µs compiles; resonator spectroscopy 1 stores a quality factor of about 10⁴ asQl_1. - Decide, from recorded data: re-enabling qubit spectroscopy's peak check, which has passed every peak since 2024, and Rabi's fit uncertainty, fixed at 0; the 1-2 pulse duration, the readout motzoi and reanalysis's double correction; the CZ phase's sign and units, which lose the sign today.
- Run tergite-backend's recalibration against this build: its one-qubit-at-a-time nodes measure one qubit each.
- Once a real run passes, drop what is installed but never imported, with
override-dependenciesin uv: PyQt5 and pyqtgraph through quantify-core, plotly through quantify-scheduler, andipykernelwith jedi and debugpy through qcodes, about 230 MB of the install. Check the imports of a real run first; tergite-backend, which shares the environment, takes the same overrides. - Compare a full tune-up's seed file with one from 2026.06.0, made the same day.
Contributing to the project
If you would like to contribute to tergite-tuner, please have a look at our contribution guidelines.
Authors
This project is a work of many contributors.
Special credit goes to the authors of this project as seen in the CREDITS file.
Change log
To view the changelog for each version, have a look at the CHANGELOG.md file.
License
When you submit code changes, your submissions are understood to be under the same Apache 2.0 License that covers the project.
Acknowledgements
This project was sponsored by:
- Knut and Alice Wallenberg Foundation under the Wallenberg Center for Quantum Technology (WACQT) project at Chalmers University of Technology
- Nordic e-Infrastructure Collaboration (NeIC) and NordForsk under the NordIQuEst project
- European Union's Horizon Europe under the OpenSuperQ project
- European Union's Horizon Europe under the OpenSuperQPlus project
Metadata
Release files for tergite-tuner 2026.10.0rc3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tergite_tuner-2026.10.0rc3.tar.gz | 358.4 kB | Without provenance | Details for tergite_tuner-2026.10.0rc3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tergite_tuner-2026.10.0rc3-py3-none-any.whl | Python 3 | none | any | Details for tergite_tuner-2026.10.0rc3-py3-none-any.whl |
Total release size: 568.6 kB
Release files / tergite_tuner-2026.10.0rc3.tar.gz
| Download URL | tergite_tuner-2026.10.0rc3.tar.gz |
|---|---|
| Size | 358.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e206654e607f65c82b466cc01f3d02097e07751c0926a4ed755ddd7d2abe7640
|
|
BLAKE2b-256 checksum How to use checksums |
e2fa208e2569af9ea3bb4e576ffb7ae08dd81eb13d611a571a87a70278c61556
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.17
|
Release files / tergite_tuner-2026.10.0rc3-py3-none-any.whl
| Download URL | tergite_tuner-2026.10.0rc3-py3-none-any.whl |
|---|---|
| Size | 210.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38edd8a9f78d619d966e220143dec2a4c7084486e61f169d5cf36fd95244dfc5
|
|
BLAKE2b-256 checksum How to use checksums |
1b49f396746ae3dbf0a90b883350fe88948bc02726d45e6ec326d566586d403c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.17
|
Security for tergite-tuner 2026.10.0rc3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.