A Python toolkit to enable users with the design and execution of quantum error correction (QEC) experiments.
Project description
Deltakit is a Python package providing a toolkit to create, execute, analyse and benchmark quantum error correction (QEC) experiments. You can use Deltakit to design new high-level QEC logic, and to compile and run it on real hardware and simulators.
For more detailed information, check out the Deltakit documentation.
For any usage questions or comments, visit our Q&A forum.
Feature highlights
Standard QEC experiments proceed through several fundamental stages, each of which is facilitated by the functionality provided in the deltakit package:
- Circuit generation: brings together a representative noisy circuit for the experiment of choice and a quantum error correcting code.
- Simulation: generates measurement results by executing and sampling the circuit on the numerical simulator Stim.
- Decoding & analysis: uses either a standard decoder of choice or Riverlane's proprietary ones to decode measurement samples, apply corrections and produce interpretable relevant metrics.
Installation guide
deltakit is publicly available on PyPI and can be locally installed with pip:
pip install deltakit
Quick Start - Performing a QEC memory experiment on a local machine
deltakit helps the design and execution of complete QEC experiments. The first step is to define an encoding process from a quantum circuit and a parametrisable code chosen from a standard family. For instance, here we use the rotated surface code from the Calderbank–Shor–Steane (CSS) family. The next step is to declare a QPU instance together with a noise model and a native gate set to compile the circuit to. This produces a QPU compliant noisy circuit that can be executed either on numerical simulators (Stim) or physical hardware to generate noisy bitstring samples. The final step is to apply the decoding process on these bitstrings and correct the circuit. In the following example, a Minimum Weight Perfect Matching-based decoder publicly available from the PyMatching library is used and the logical error probability (LEP) is generated for interpretation.
from deltakit.circuit.gates import PauliBasis
from deltakit.decode import PyMatchingDecoder
from deltakit.decode.analysis import run_decoding_on_circuit
from deltakit.explorer.analysis import calculate_lep_and_lep_stddev
from deltakit.explorer.codes import RotatedPlanarCode, css_code_memory_circuit
from deltakit.explorer.qpu import QPU, ToyNoise
# Step 1. Encoding
# Create a noisy memory circuit with the rotated planar code
d = 3 # Code distance.
rplanar = RotatedPlanarCode(width=d, height=d)
circuit = css_code_memory_circuit(rplanar, num_rounds=d, logical_basis=PauliBasis.Z)
# Step 2. Declare a noisy QPU instance
qpu = QPU(circuit.qubits, noise_model=ToyNoise(p=0.01))
noisy_circuit = qpu.compile_and_add_noise_to_circuit(circuit)
# Step 3. Perform simulation and correct the measured observable flips with a decoder
num_shots, batch_size = 100_000, 10_000
decoder, noisy_circuit = PyMatchingDecoder.construct_decoder_and_stim_circuit(noisy_circuit)
result = run_decoding_on_circuit(
noisy_circuit, num_shots, decoder, batch_size, min_fails=100
)
# Step 4. Print relevant results
fails = result["fails"]
lep, lep_stddev = calculate_lep_and_lep_stddev(fails, num_shots)
print(f"LEP = {lep:.5g} ± {lep_stddev:.5g}")
Performing an online and remote QEC experiment
deltakit allows access to advanced simulation capabilities on the cloud platform via token authentication. To generate a personal access token, please follow the steps described on the Deltakit website. The generated token can be registered locally by executing the following code once.
from deltakit.explorer import Client
Client.set_token("<your-token>")
N.B.set_token does not need to be called again, except in case of token revocation.
An instance of the cloud API is required to execute a remote experiment:
from deltakit.explorer.codes import css_code_stability_circuit, RotatedPlanarCode
from deltakit.circuit.gates import PauliBasis
from deltakit.explorer import Client
# Instantiate a cloud client.
# A token needs to be registered first.
client = Client.get_instance()
# Generate a stability experiment with the rotated planar code.
circuit = css_code_stability_circuit(
RotatedPlanarCode(3, 3),
num_rounds=3,
logical_basis=PauliBasis.X,
client=client
)
# Display the resulting circuit
print(circuit)
Contributing
There are various ways to contribute to deltakit:
- Submitting issues: To submit bug reports or feature requests, please use our issue tracker.
- Developing in
deltakit: To learn more about how to develop withindeltakit, please refer to contributing guidelines. - Security: For any security concern, please see our security policy.
[!NOTE] Any contribution will require a Contribution Licence Agreement signature when a Pull Request is created. The recommended contributing workflow is detailed in our contributing guidelines.
License
This project is distributed under the Apache 2.0 License.
Citation
If you find this toolkit useful, please consider citing it:
@software{deltakit,
author = {Prawiroatmodjo, Guen and Burton, Angela and Suau, Adrien and Nnadi, Chidi and Bracken Ziad, Abbas and Melvin, Adam and Richardson, Adam and Walayat, Adnaan and Moylett, Alex and Virbule, Alise and Safehian, AmirReza and Patterson, Andrew and Buyskikh, Anton and Ruben, Archi and Barber, Ben and Reid, Brendan and Manuel, Cai Rees and Seremet, Dan and Byfield, David and Matekole, Elisha and Gallardo, Gabriel and Geher, Gyorgy and Turner, Jack and Lal, Jatin and Camps, Joan and Majaniemi, Joonas and Yates, Joseph and Johar, Kauser and Barnes, Kenton and Caune, Laura and Zigante, Lewis and Skoric, Luka and Jastrzebski, Marcin and Ghibaudi, Marco and Turner, Mark and Haberland, Matt and Stafford, Matthew and Blunt, Nick and Gillett, Nicole and Crawford, Ophelia and McBrien, Philip and Ishtiaq, Samin and Protasov, Stanislav and Wolanski, Stasiu and Hartley, Tom},
title = {Deltakit},
month = sep,
year = 2025,
publisher = {Zenodo},
doi = {10.5281/zenodo.17145113},
url = {https://doi.org/10.5281/zenodo.17145113},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deltakit-0.8.0-py3-none-any.whl.
File metadata
- Download URL: deltakit-0.8.0-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
345ba0adcfd25883b3040fb0231b6b19801ca7b7c0c53a8ac2ddee20b9f6f354
|
|
| MD5 |
2824e5210ff9ec864494dfc913f620f5
|
|
| BLAKE2b-256 |
9db0ca5fe886d1e4ed83e056c16f1baf7820fddecd801d6f38b6ce0bb2804c17
|
Provenance
The following attestation bundles were made for deltakit-0.8.0-py3-none-any.whl:
Publisher:
release.yml on Deltakit/deltakit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deltakit-0.8.0-py3-none-any.whl -
Subject digest:
345ba0adcfd25883b3040fb0231b6b19801ca7b7c0c53a8ac2ddee20b9f6f354 - Sigstore transparency entry: 1067184730
- Sigstore integration time:
-
Permalink:
Deltakit/deltakit@34af6b1b99cb57f374ce2d88c92b2717b8cd064d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Deltakit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@34af6b1b99cb57f374ce2d88c92b2717b8cd064d -
Trigger Event:
workflow_dispatch
-
Statement type: