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.1.dev1702557791

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.1.dev1702557791
File Size Uploaded
chromobius-1.1.dev1702557791.tar.gz 53.5 kB Details

Built distributions (wheels)

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

Download URL chromobius-1.1.dev1702557791.tar.gz
Size 53.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f85a4d3dacbb6ace61244ab83f27497a2ce60f18b0cef693901ff34d06675fd6
BLAKE2b-256 checksum
How to use checksums
2a36b1b67235709da78a097d0d24f411d8fb50cdefa0c6b17489cf6ac0463220
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / chromobius-1.1.dev1702557791-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL chromobius-1.1.dev1702557791-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
5b5e2aa0d3006e7f2798f2fa007aad070c4804bebe35c3b5af7014353f8f282a
BLAKE2b-256 checksum
How to use checksums
defc1684b3c1faa92cffaa4bff804015d99297ce15d22c0bb09c3544c07e942a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / chromobius-1.1.dev1702557791-cp312-cp312-macosx_11_0_arm64.whl

Download URL chromobius-1.1.dev1702557791-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
68e71b5183baf8745a299612cb287ab549ce19003c8ecf0ec80121b7034d2aeb
BLAKE2b-256 checksum
How to use checksums
82539f47608ae1c702bb6790415b7f863ce936df674601ba52f737724382cc5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / chromobius-1.1.dev1702557791-cp312-cp312-macosx_10_15_x86_64.whl

Download URL chromobius-1.1.dev1702557791-cp312-cp312-macosx_10_15_x86_64.whl
Size 887.3 kB
Tags CPython 3.12 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
6b3356621b50355215cb09655ff3a2042bd0bc859ec3b73d1851eb965d7f6838
BLAKE2b-256 checksum
How to use checksums
89d58b9725c38c7b47f7baa2b031c038490f5994a01f6a05e9729a9a52e47902
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / chromobius-1.1.dev1702557791-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL chromobius-1.1.dev1702557791-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
5ece39e1d329915e9d606947dbab9c62f83609cf6c0db7f45e3dd3e34224813d
BLAKE2b-256 checksum
How to use checksums
45966e0cb2a7eb78126148ce3a03489178498d41266abc8fcff6ede289ca2501
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / chromobius-1.1.dev1702557791-cp311-cp311-macosx_11_0_arm64.whl

Download URL chromobius-1.1.dev1702557791-cp311-cp311-macosx_11_0_arm64.whl
Size 837.5 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0dbff651d767c1af52755f1ae370e8f3b104a8c5aa9810f1e554d52002ee915b
BLAKE2b-256 checksum
How to use checksums
0653f861beb9ab39716c6e6e431f60c7ce46525bc82ed8db1a4372d98435d710
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / chromobius-1.1.dev1702557791-cp311-cp311-macosx_10_15_x86_64.whl

Download URL chromobius-1.1.dev1702557791-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
2b97c959171e4ad82f8a8acc1110d51d124dae63370b7957bee15d75d79d0eed
BLAKE2b-256 checksum
How to use checksums
dd79b02f8ae1a04b0c00333e2659c4d5438a6b0f0b21dfb5f6fd31f52868b836
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / chromobius-1.1.dev1702557791-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL chromobius-1.1.dev1702557791-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
8aad8e813cece3cd081fac46fafe0c3519d1b24b82a4d09467c0d04e93d998da
BLAKE2b-256 checksum
How to use checksums
ee5ea622bc56a243a24bf263fa44e2a60aaec484673275d9004c357097016e7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / chromobius-1.1.dev1702557791-cp310-cp310-macosx_11_0_arm64.whl

Download URL chromobius-1.1.dev1702557791-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
ec182b354c03d372a360b5fc0c02048f68cff37e5b36861ed83bb65498a7d60d
BLAKE2b-256 checksum
How to use checksums
cc6004cf0baf46d7b5f7b6a51276eccaef3f13f84044250f56eb06b07dc4960a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / chromobius-1.1.dev1702557791-cp310-cp310-macosx_10_15_x86_64.whl

Download URL chromobius-1.1.dev1702557791-cp310-cp310-macosx_10_15_x86_64.whl
Size 885.9 kB
Tags CPython 3.10 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
47509a8284161a346f6d1205b981e4b4f5bb772f14788de99b49c6d777a248f7
BLAKE2b-256 checksum
How to use checksums
6888731c3e8094e2e4e3938bd6bc90aa6da7d091fc7a3886c3495bfe82c5929a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

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