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 0.0.dev1702544746

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 0.0.dev1702544746
File Size Uploaded
chromobius-0.0.dev1702544746.tar.gz 53.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for chromobius 0.0.dev1702544746
File
chromobius-0.0.dev1702544746-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-0.0.dev1702544746-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
chromobius-0.0.dev1702544746-cp312-cp312-macosx_10_15_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.15+ x86-64 Details
chromobius-0.0.dev1702544746-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-0.0.dev1702544746-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
chromobius-0.0.dev1702544746-cp311-cp311-macosx_10_15_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.15+ x86-64 Details
chromobius-0.0.dev1702544746-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-0.0.dev1702544746-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
chromobius-0.0.dev1702544746-cp310-cp310-macosx_10_15_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.15+ x86-64 Details

Total release size: 8.6 MB

Release files / chromobius-0.0.dev1702544746.tar.gz

Download URL chromobius-0.0.dev1702544746.tar.gz
Size 53.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d2a8c05403363f380e585e10a15a4a28ebc65b286342c96f0f7501b9dbe57296
BLAKE2b-256 checksum
How to use checksums
220aec8bbbf53e1e062a830b3b4e3e5f7a5631af7a479de1f171e55a7cceda32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / chromobius-0.0.dev1702544746-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL chromobius-0.0.dev1702544746-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.1 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
79a43e875bf48a23f8dabfd3e5a6c18b8b940a474b0b66ce6862ae349f10abd5
BLAKE2b-256 checksum
How to use checksums
39e025e55de537fb8ae32c2ab0ee99a37d7a5a0f05b4c8f3ad3760aaf88da88c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / chromobius-0.0.dev1702544746-cp312-cp312-macosx_11_0_arm64.whl

Download URL chromobius-0.0.dev1702544746-cp312-cp312-macosx_11_0_arm64.whl
Size 838.0 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d955a58a23ebed54e7a8e8b6cda912b7d48f6a542ba3fba10e30e3a50bdde294
BLAKE2b-256 checksum
How to use checksums
947b1904df3eb1045476d3f9c9ffebf630e34176abfe5d9a004c23e0b88991e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / chromobius-0.0.dev1702544746-cp312-cp312-macosx_10_15_x86_64.whl

Download URL chromobius-0.0.dev1702544746-cp312-cp312-macosx_10_15_x86_64.whl
Size 887.5 kB
Tags CPython 3.12 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
0a07138cbde12959d09529b92d9ca8afe7082b305e2be302dbc71f4100dcdfbf
BLAKE2b-256 checksum
How to use checksums
ba8d24200c832cc76822956d111e632545fa47c839901ae86bba5a4887163f25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / chromobius-0.0.dev1702544746-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL chromobius-0.0.dev1702544746-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.1 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
a7617e0c71cd55ee60bddf56459e469d14bfd5bf1f1026bc50bcedb4642e1349
BLAKE2b-256 checksum
How to use checksums
6e0ad100a55e69c91dcf5f27cb0732c7cabe0ee9e0abab7b3234343f18128f8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / chromobius-0.0.dev1702544746-cp311-cp311-macosx_11_0_arm64.whl

Download URL chromobius-0.0.dev1702544746-cp311-cp311-macosx_11_0_arm64.whl
Size 837.4 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
90e204caeb185fe41ef016a5afae0e1a25a4f6979bc5a1dfab6d1c00d10f9867
BLAKE2b-256 checksum
How to use checksums
debb32fbd62b2736fa2a69a77a9e899f317acd8b7ecce204d58222a5f2a4babb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / chromobius-0.0.dev1702544746-cp311-cp311-macosx_10_15_x86_64.whl

Download URL chromobius-0.0.dev1702544746-cp311-cp311-macosx_10_15_x86_64.whl
Size 885.9 kB
Tags CPython 3.11 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
5a0c3e236339dce782fb5a253629144b472daddf77d6e77d414f59e10dcdd5df
BLAKE2b-256 checksum
How to use checksums
bed514f6b38532e6caa34aec6fda89ed6697379ec4eb027bfad74a777cc47a01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / chromobius-0.0.dev1702544746-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL chromobius-0.0.dev1702544746-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.1 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
07cd52f6caf36b1575b6b6237608bf1157d8788b2dad92642b370f7698b33b90
BLAKE2b-256 checksum
How to use checksums
b51090fa76df3b4da0a6e77e8d2c6535e995567f91cc0c1bca56b63e833e64d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / chromobius-0.0.dev1702544746-cp310-cp310-macosx_11_0_arm64.whl

Download URL chromobius-0.0.dev1702544746-cp310-cp310-macosx_11_0_arm64.whl
Size 837.5 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2d9ffef2510c6076029052e15348db4d5003366673c8b71648d63074aa293677
BLAKE2b-256 checksum
How to use checksums
acdb2a0c90be93378299865c1c8c977c175623112a570b8f59853f7b4b774c85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / chromobius-0.0.dev1702544746-cp310-cp310-macosx_10_15_x86_64.whl

Download URL chromobius-0.0.dev1702544746-cp310-cp310-macosx_10_15_x86_64.whl
Size 885.8 kB
Tags CPython 3.10 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
23b90fea80e75cc08943c2efc2209aa1044bbab6722df313950b931d0b3575da
BLAKE2b-256 checksum
How to use checksums
0c75e57cd8fa9d517d674cfb558cb44f19f7511c3cb815c870a33977feb45281
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

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