Skip to main content
Pre-release

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

Chromobius: color code decoder

Chromobius is an implementation of a "mobius decoder", which approximates the color code decoding problem as a minimum weight matching problem. Chromobius uses PyMatching to solve the minimum weight matching problem.

See ((((the paper "New circuits and an open source decoder for the color code")))) for more details on how Chromobius works.

How to use Chromobius

See the getting started notebook.

Also see the python api reference.

Programmers who want to edit and build Chromobius can check the developer documentation.

Example Snippets

Decoding a shot with Chromobius

From python:

import stim
import chromobius
import numpy as np

def count_mistakes(circuit: stim.Circuit, shots: int) -> int:
    # Sample the circuit.    
    dets, actual_obs_flips = circuit.compile_detector_sampler().sample(
        shots=shots,
        separate_observables=True,
        bit_packed=True,
    )

    # Decode with Chromobius.
    decoder = chromobius.compile_decoder_for_dem(circuit.detector_error_model())
    predicted_obs_flips = decoder.predict_obs_flips_from_dets_bit_packed(dets)

    # Count mistakes.
    return np.count_nonzero(np.any(predicted_obs_flips != actual_obs_flips, axis=1))

From the command line:

# Sample shots of detectors and observable flips.
stim detect \
    --shots 100000 \
    --in "example_circuit.stim" \
    --out "dets.b8" \
    --out_format "b8" \
    --obs_out "obs_actual.txt" \
    --obs_out_format "01"
    
# Extract a detector error model used to configure Chromobius.
stim analyze_errors \
    --in "example_circuit.stim" \
    --fold_loops \
    --out "dem.dem"

# Decode the shots.
chromobius predict \
    --dem "dem.dem" \
    --in "dets.b8" \
    --in_format "b8" \
    --out "obs_predicted.txt" \
    --out_format "01"

# Count the number of shots with a prediction mistake.
paste obs_actual.txt obs_predicted.txt \
    | grep -Pv "^([01]*)\\s*\\1$" \
    | wc -l

From python using sinter:

import sinter
import chromobius
import os

tasks: list[sinter.Task] = ...
stats: list[sinter.TaskStats] = sinter.collect(
    decoders=["chromobius"], 
    custom_decoders=chromobius.sinter_decoders(),
    tasks=tasks,
    num_workers=os.cpu_count(),
    max_shots=100_000,
    max_errors=100,
)

From the command line using sinter:

sinter collect \
    --circuits "example_circuit.stim" \
    --decoders chromobius \ 
    --custom_decoders_module_function "chromobius:sinter_decoders" \
    --max_shots 100_000 \
    --max_errors 100
    --processes auto \
    --save_resume_filepath "stats.csv" \

Metadata

Release files for chromobius 1.2.dev1727169923

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

Source distribution (sdist)

Source distribution for chromobius 1.2.dev1727169923
File Size Uploaded
chromobius-1.2.dev1727169923.tar.gz 55.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for chromobius 1.2.dev1727169923
File
chromobius-1.2.dev1727169923-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
chromobius-1.2.dev1727169923-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
chromobius-1.2.dev1727169923-cp312-cp312-macosx_10_15_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.15+ x86-64 Details
chromobius-1.2.dev1727169923-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
chromobius-1.2.dev1727169923-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
chromobius-1.2.dev1727169923-cp311-cp311-macosx_10_15_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.15+ x86-64 Details
chromobius-1.2.dev1727169923-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
chromobius-1.2.dev1727169923-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
chromobius-1.2.dev1727169923-cp310-cp310-macosx_10_15_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.15+ x86-64 Details

Total release size: 9.0 MB

Release files / chromobius-1.2.dev1727169923.tar.gz

Download URL chromobius-1.2.dev1727169923.tar.gz
Size 55.6 kB
Tags Source
SHA-256 checksum
How to use checksums
28b86b4e10ff064862c2f197608e0bcf83708b2c0136cd3b99a95faf6bfa1bca
BLAKE2b-256 checksum
How to use checksums
71b2d4c0fc045c81cb3ce5913a9e2f68f9a2499fcbcf1be8a11a682a5f2c8b4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / chromobius-1.2.dev1727169923-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL chromobius-1.2.dev1727169923-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
7d1de5c32d5087575239e4630c9995ae1b993187c0ebd56994da7b3f00925aeb
BLAKE2b-256 checksum
How to use checksums
9ba3dd051c69d1af42a2f18503a62db64cda6b9193fcf0bf458af358725ddb5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / chromobius-1.2.dev1727169923-cp312-cp312-macosx_11_0_arm64.whl

Download URL chromobius-1.2.dev1727169923-cp312-cp312-macosx_11_0_arm64.whl
Size 866.5 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9601565f8c99fe87db79180718f7359655ca09462066df638f052e745ad42647
BLAKE2b-256 checksum
How to use checksums
faa2a7c04b3e75871afa4e14c72608b3ae88ab7e333266e1bc60de08f765ec9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / chromobius-1.2.dev1727169923-cp312-cp312-macosx_10_15_x86_64.whl

Download URL chromobius-1.2.dev1727169923-cp312-cp312-macosx_10_15_x86_64.whl
Size 929.1 kB
Tags CPython 3.12 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
39dcf28c8a1ca55adf4255e0b78e3de87c297199a3a6d98759f88fa6ab145bc3
BLAKE2b-256 checksum
How to use checksums
456460836df23b666b09732745da26ef39e508d9d9937bb968cf2278aea02aa6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / chromobius-1.2.dev1727169923-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL chromobius-1.2.dev1727169923-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
61e9fd19ed34cc136a0b74d11e2747d7c2939a2198a3ffe5f8df6540fb3bd696
BLAKE2b-256 checksum
How to use checksums
769a93b290bb5a36790d2c79f71f3ceb571ce84c8895bf4872465dd36b3635b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / chromobius-1.2.dev1727169923-cp311-cp311-macosx_11_0_arm64.whl

Download URL chromobius-1.2.dev1727169923-cp311-cp311-macosx_11_0_arm64.whl
Size 865.6 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
94ec5847f0385119ceb0e87c3008d434a510fb4b4c141878c7f18e15d4c38958
BLAKE2b-256 checksum
How to use checksums
5f5eefd9a79c7b4391687ab343e158854af2c820397d91820df398bde9cb2c4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / chromobius-1.2.dev1727169923-cp311-cp311-macosx_10_15_x86_64.whl

Download URL chromobius-1.2.dev1727169923-cp311-cp311-macosx_10_15_x86_64.whl
Size 928.0 kB
Tags CPython 3.11 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
e7bcd3f6c91cb5c4e2387d60b9c65fa8dc6943f2b3b01ae7d4385fe1004d7ca1
BLAKE2b-256 checksum
How to use checksums
c1319b20f6bf384b3b5f2c293e6e1c304686108498684ce7085b511db8b3e706
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / chromobius-1.2.dev1727169923-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL chromobius-1.2.dev1727169923-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
3e7efcf2d9c0ab120bc3f1872cdacaa0af98fb1556286ca5e5854c732735b764
BLAKE2b-256 checksum
How to use checksums
f3713c9330c16748c7f0302b8993a67532e6de5df31343462d8de56be108668f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / chromobius-1.2.dev1727169923-cp310-cp310-macosx_11_0_arm64.whl

Download URL chromobius-1.2.dev1727169923-cp310-cp310-macosx_11_0_arm64.whl
Size 865.7 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b057769f9f38c76071a3e56ccf73a3aff9b06db4a3f96a2cb73a23aba553b024
BLAKE2b-256 checksum
How to use checksums
4e1aeb37612e4303d9015c443e14aa9274b27c5594b2118d46091737272bb682
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / chromobius-1.2.dev1727169923-cp310-cp310-macosx_10_15_x86_64.whl

Download URL chromobius-1.2.dev1727169923-cp310-cp310-macosx_10_15_x86_64.whl
Size 927.9 kB
Tags CPython 3.10 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
7c1f879dde7e7beae948df74397f41d5b58082f6f50073a9d0e6f2de7bcdba72
BLAKE2b-256 checksum
How to use checksums
dae0ed2f733562ae772e06f0588560818806b42cb72bdde90ca1992e7e764a8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release history Release notifications | RSS feed

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