Skip to main content

deltakit-maestro

PyPI Python Tests Docs

deltakit-maestro connects Riverlane Deltakit quantum error correction (QEC) circuits—as well as plain stim.Circuit objects—to Qoro's Maestro quantum simulator. It lets you run QEC memory experiments under realistic non-Clifford and non-Pauli noise that Clifford simulators such as Stim cannot execute directly, including coherent gate over-rotations, T1 relaxation, per-qubit hardware calibration, and ZZ crosstalk.

For every simulation, MaestroBackend automatically builds a Detector Error Model (DEM) from the exact Pauli twirl of the simulated noise. Because both the physical non-Pauli simulation and its Pauli-twirled baseline can be decoded with the same DEM, you can directly measure what the Pauli approximation misses:

  • On the rotated d=3 surface code, coherent over-rotations produce 17–40% more logical errors than their Pauli twirl.
  • On repetition codes, the gap grows with code distance—reaching 45% more logical errors at d=15—because the Pauli twirl overstates the error-suppression factor (see Benchmarks).

When to use it

  • Measure what the Pauli twirl misses: simulate physical coherent or relaxation noise alongside its exact Pauli twirl and decode both with the same DEM.
  • Coherent gate over-rotations: simulated on Maestro's matrix product state (MPS) or statevector engines—practical for the rotated d=3 surface code and repetition codes up to 101 qubits.
  • Small coherent errors on larger codes: when coherent errors are weaker than stochastic Pauli noise, Maestro's extended stabilizer runs surface codes up to d=7 (97 qubits) and the [[72,12,6]] bivariate bicycle qLDPC code (144 qubits).
  • T1 relaxation at scale: T1 decay toward |0⟩ is not a Pauli channel; Maestro's stabilizer simulator runs it shot by shot on codes with hundreds of qubits (tested up to 288 qubits).
  • Hardware-shaped noise models: configure per-qubit and per-coupler error rates, asymmetric readout errors, directed over-rotations, and ZZ crosstalk via maestro.NoiseModel.

For pure Pauli noise at scale, Stim samples faster on x86 and produces identical logical error rates. Because deltakit-maestro also samples Pauli noise on Pauli frames, you can keep a single pipeline across Pauli and non-Pauli experiments. See When to use Maestro.

How it works

MaestroBackend is a lightweight adapter built on maestro.sinter. You pass in a Deltakit Circuit (converted via as_stim_circuit()) or a stim.Circuit, and the backend splits the work into three parts:

Component Role
Circuit executed by Maestro Runs in-circuit Stim Pauli channels, idle/reset noise, and M(p) readout flips directly (stripping gate noise only when replaced by coherent noise or rate overrides).
maestro.NoiseModel layers Supplies non-Pauli hardware channels (coherent over-rotations, t1 decay) or overridden gate/readout error rates.
Pauli-twirled DEM Written back into a Stim circuit to generate the matching stim.DetectorErrorModel for PyMatching, BP-OSD, or Sinter decoders.

Results come back as NumPy arrays (simulate), a reusable sampler (compile_sampler), or multi-worker sinter.collect statistics (as_sinter_task).

By default (simulation_type=None), MaestroBackend chooses the fastest Maestro simulator capable of running the requested noise:

Noise configuration Maestro simulation type
'pauli' (including rate overrides) or 'none' Stabilizer (fast Pauli-frame sampling)
Any run with t1= and no coherent noise Stabilizer (shot-by-shot trajectory sampling)
'coherent' or 'full' MatrixProductState (default max_bond_dimension=32)
Explicit simulation_type=... on MaestroBackend Always uses that simulation type (e.g. Statevector, ExtendedStabilizer)

Call backend.config_for(noise_type, **noise).simulation_type to inspect which simulator a configuration selects.

Install

pip install deltakit-maestro
pip install "deltakit-maestro[examples]"   # adds decoders used in examples: pymatching, ldpc

Requires Python 3.10 or later (matching Deltakit's supported range) on macOS or Linux. Tested in CI on Python 3.10 through 3.14.

Verify your installation:

python -c "from deltakit_maestro import MaestroBackend; print(MaestroBackend())"

For local development, clone the repository and install with pip install -e ".[test,examples]" (see Contributing).

Quick start

# Import Deltakit before pymatching (see "Supported circuits and gotchas" in the guide).
from deltakit.circuit.gates import PauliBasis
from deltakit.explorer.codes import RotatedPlanarCode, css_code_memory_circuit
from deltakit.explorer.qpu import QPU, SI1000Noise
import pymatching
import sinter

from deltakit_maestro import MaestroBackend

# Build a noisy d=3 rotated surface code memory circuit with Deltakit (or pass any stim.Circuit)
code = RotatedPlanarCode(width=3, height=3)
circuit = css_code_memory_circuit(code, num_rounds=3, logical_basis=PauliBasis.Z)
noisy = QPU(circuit.qubits, noise_model=SI1000Noise(p=0.01)).compile_and_add_noise_to_circuit(
    circuit
)

backend = MaestroBackend()  # Stabilizer for Pauli/T1 runs, MPS (chi=32) for coherent runs

# 1. One-call simulation: raw measurements, detection events, and observable flips
result = backend.simulate(noisy, shots=1000, seed=1)
result.measurements      # (1000, n_measurements) uint8, in Stim record order
result.detection_events  # (1000, n_detectors) bool
result.observable_flips  # (1000, n_observables) bool

# 2. Reusable compiled sampler + decoding with the matched Detector Error Model
sampler = backend.compile_sampler(noisy, seed=1)
dets, obs = sampler.sample_detection_events(1000)
matcher = pymatching.Matching.from_detector_error_model(sampler.task.detector_error_model)
logical_errors = (matcher.decode_batch(dets) != obs).any(axis=1)

# 3. Multi-worker parameter sweeps with Sinter
stats = sinter.collect(
    num_workers=4,
    tasks=[backend.as_sinter_task(noisy, json_metadata={"p": 0.01})],
    custom_decoders=backend.sinter_decoders(decoder="pymatching"),
    max_shots=10_000,
)

# 4. Non-Pauli coherent noise (MPS) compared against its exact Pauli twirl (Stabilizer)
coherent = backend.simulate(noisy, shots=300, noise_type="coherent", seed=1)
twirl_circuit = backend.twirled_circuit(noisy, noise_type="coherent")
twirl = backend.simulate(twirl_circuit, shots=100_000, seed=1)

Read the Guide for details on sampling and Sinter, simulation types, noise modes and overrides, the decoder's detector error model, and coherent noise with MPS bond-dimension checks.

Learn more

  • Documentation:
    • Guide: sampling and Sinter, how each run is simulated, the noise modes and overrides, the decoder's detector error model, coherent noise and its calibration against SI1000, the MPS bond dimension, performance, and gotchas.
    • Benchmarks: coherent noise against its Pauli twirl, coherent errors past a statevector on the extended stabilizer, T1 decay on qLDPC codes, the matrix product state against exact statevector simulation, and a check of Pauli noise against Stim.
    • Examples: a notebook with plots of coherent noise on the d=3 surface code, plus step-by-step scripts (shown alongside their live output) covering plain Stim circuits, noise modes, custom per-qubit maestro.NoiseModels, surface code sweeps, every Deltakit code family, a directional qLDPC code with iSWAP gates and T1 decay, repetition-code coherent noise, and MPS bond-dimension checks.
    • API reference.
  • PyPI.
  • Maestro docs.
  • Changelog.
  • Contributing: running the tests and building the docs.

License

GPL-3.0, like Maestro. See LICENSE.

Metadata

Release files for deltakit-maestro 0.2.0

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

Source distribution (sdist)

Source distribution for deltakit-maestro 0.2.0
File Size Uploaded Provenance Actions
deltakit_maestro-0.2.0.tar.gz 252.9 kB With provenance Details for deltakit_maestro-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for deltakit-maestro 0.2.0
File Interpreter ABI Platform Actions
deltakit_maestro-0.2.0-py3-none-any.whl Python 3 none any Details for deltakit_maestro-0.2.0-py3-none-any.whl

Total release size: 281.8 kB

Release files / deltakit_maestro-0.2.0.tar.gz

Download URL deltakit_maestro-0.2.0.tar.gz
Size 252.9 kB
Tags Source
SHA-256 checksum
How to use checksums
76fb1f72e746b16132f4ff253e91fd4ca192e92ff8a5f218a4ae25126e0c1466
BLAKE2b-256 checksum
How to use checksums
c98f854296026634f64ab85074655b8cefb4cd71bd86c76d2e8208ecd19b4bf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / deltakit_maestro-0.2.0-py3-none-any.whl

Download URL deltakit_maestro-0.2.0-py3-none-any.whl
Size 28.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40490ea5fd8437f156ca3d4983123cfeeb23f072756c722e1ae0e0b63f1a21fc
BLAKE2b-256 checksum
How to use checksums
67d827ee65284bf1c5a261deffaa52f2908620c3112a87fb6dbb5d7f4a313b48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for deltakit-maestro 0.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for deltakit_maestro-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

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