Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Tergite Tuner

CI

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 conda or venv environment is fine).
  • A reachable redis server. The default URL is redis://127.0.0.1:6379/0; override via the REDIS_URL env var or the redis_url keyword argument when calling the public API.
redis-server

Installation

pip install tergite-tuner

Copy the example environment file and edit it as needed.

The .env file controls the cluster IP, redis URL, target node, qubits/couplers under calibration, and so on.

Every field on SessionContextcan be set in the .env (in upper case), or passed as a keyword argument to the public API of the entry point functions.

On top of having a .env file, more configuration files maybe required. (See .example.env file for more details)

  • cluster_config.json: It is the qblox-scheduler hardware compilation configuration json file
  • device_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": "QbloxHardwareCompilationConfig",
      "hardware_description": {
        "clusterA": {
          "instrument_type": "Cluster",
          "ref": "internal",
          "modules": {
            "1": {
              "instrument_type": "QCM_RF"
            },
          }
        }
      },
      # ...
    })
)

Customization of Nodes

It is also possible to pass in your own implementation of the Nodes as long as they are inherited from the base nodes BaseNode, QubitNode, CouplerNode etc.

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.

from tergite_tuner.lib.base.node import QubitNode, BaseNode, CouplerNode
from tergite_tuner import tune_device, NodeEnum


class CustomQubitNode(QubitNode):
    ...


class CustomDeviceNode(BaseNode):
    def precompile(self, samplespace): ...

    @classmethod
    def persist_qois(cls, session: "SessionContext", node_name: str): ...


class CustomCouplerNode(QubitNode):
    ...


_, results = tune_device(
    node_cls_map={
        NodeEnum.QUBIT_01_SPECTROSCOPY: CustomQubitNode,
        NodeEnum.COUPLER_ANTICROSSING: CustomCouplerNode,
    },
    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,
)

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

First ensure your device_config.toml has the latest device values or if you have already run the tuneup using the same redis database, the old values should still be there so have a device_config.toml without initial values.
Note that this may mean you have two device_config.toml's, one for the first run and the other for subsequent runs.
Do the same with node_config.toml.

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=True,
)

# 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(
    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("path/to/run/folder"),
)

Generate a BCC calibration seed

from tergite_tuner import generate_calib_seed_file, SessionContext

# Reads qubits / couplers / redis_url from the .env file. 
# Creates the file as 'calibration.seed.toml' by default
generate_calib_seed_file(env_file=".env")

# Or override individual SessionContext fields inline:
generate_calib_seed_file(couplers=["q12_q13", "q56_q67"], qubits=["q12"], path="/path/to/destination/toml/file")

# Or pass in a session from somewhere else:
session = SessionContext()
generate_calib_seed_file(session)

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
  • Add tests for entire calibration runs, maybe using mode=dummy
  • Add ability to add new nodes in the NodeEnum map or allow a more flexible type in the mapping

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:

Metadata

Release files for tergite-tuner 2026.10.0rc1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tergite-tuner 2026.10.0rc1
File Size Uploaded Provenance Actions
tergite_tuner-2026.10.0rc1.tar.gz 237.9 kB Without provenance Details for tergite_tuner-2026.10.0rc1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tergite-tuner 2026.10.0rc1
File Interpreter ABI Platform Actions
tergite_tuner-2026.10.0rc1-py3-none-any.whl Python 3 none any Details for tergite_tuner-2026.10.0rc1-py3-none-any.whl

Total release size: 559.5 kB

Release files / tergite_tuner-2026.10.0rc1.tar.gz

Download URL tergite_tuner-2026.10.0rc1.tar.gz
Size 237.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2ea3aacff0c19db248249e1740e8392c3712338635e92a50c361b449ec54b13d
BLAKE2b-256 checksum
How to use checksums
d3e2a0945580f3dd883b1060edc65d9c88f0641ce042cc75b618c20708210372
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / tergite_tuner-2026.10.0rc1-py3-none-any.whl

Download URL tergite_tuner-2026.10.0rc1-py3-none-any.whl
Size 321.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a46448259172e608095c23142ca8676754dad1167ebc0ab410b6d26f07e6c798
BLAKE2b-256 checksum
How to use checksums
7f9a36d9b459ba85cfaa73b56881ea99e2044b068c1bbbc0d2ae0c77bc68a525
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for tergite-tuner 2026.10.0rc1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page