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.0.dev1702554066

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.0.dev1702554066
File Size Uploaded
chromobius-1.0.dev1702554066.tar.gz 53.5 kB Details

Built distributions (wheels)

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

Download URL chromobius-1.0.dev1702554066.tar.gz
Size 53.5 kB
Tags Source
SHA-256 checksum
How to use checksums
83b356cc01d0c288346961f565b9b055e5584277e2449089f9bf48c51286c62f
BLAKE2b-256 checksum
How to use checksums
4de8482a7ace1b355b046117db96a66337bfeb00e691a0468aa9442b06fbcce1
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.0.dev1702554066-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL chromobius-1.0.dev1702554066-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
5493213820a6a6a86bc6cf41b9f354e174150b113497685984776ece3bb1518b
BLAKE2b-256 checksum
How to use checksums
99c1a13102b5ba92f55eec48095575be5853c9c880e538f6140d03fe1034373a
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.0.dev1702554066-cp312-cp312-macosx_11_0_arm64.whl

Download URL chromobius-1.0.dev1702554066-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
688d1ca0b2aea3e2b56e7006792e27ce3a98ef64078d75f20221d279cdefc4b0
BLAKE2b-256 checksum
How to use checksums
029c8cd032e8c23f31267e43a08fc83d28095d8df24676146d2882e3cd3d315e
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.0.dev1702554066-cp312-cp312-macosx_10_15_x86_64.whl

Download URL chromobius-1.0.dev1702554066-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
5c0a3f292db386cf005d05827bca16f98927d7058f0c65a11673a4e7bd6c0921
BLAKE2b-256 checksum
How to use checksums
12392057fc08741d50ffc8e4f32c6979724a51f0f3b75a205af3cfff95ae6cd6
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.0.dev1702554066-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL chromobius-1.0.dev1702554066-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
aa766d54a39a234f472f26d07d249a826f1291abadeee3041479d119a9ba4ed0
BLAKE2b-256 checksum
How to use checksums
6dee178ef5a84fe5c9b86d653584fb791256b1fa0a840e97841e02f85979f9aa
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.0.dev1702554066-cp311-cp311-macosx_11_0_arm64.whl

Download URL chromobius-1.0.dev1702554066-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
fe711efb7e82defdc1d1f36ff22d73b8fa052e9a8f1ac11b86b0512ea0e8ea93
BLAKE2b-256 checksum
How to use checksums
430218389f8eeb8650027b1460fc46370555de0c8d6a4b6619eeaa454ec0d4bc
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.0.dev1702554066-cp311-cp311-macosx_10_15_x86_64.whl

Download URL chromobius-1.0.dev1702554066-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
885ffbdcc5bc9c71de3ca97e707aa1a4ae2f659cc7b1a2cd041c054595834c31
BLAKE2b-256 checksum
How to use checksums
8608e8a647abb4b0d52616e13252e733bf517e9d3271a129ec8df7574cd4ef62
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.0.dev1702554066-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL chromobius-1.0.dev1702554066-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
04c06186510399319025d52ef919ed6ce157bbf3c8982e2182c91f4159c8e357
BLAKE2b-256 checksum
How to use checksums
0b2a77ceb453aac9fc9aa7e8404fa74452648da1195161cd128985c385c1b480
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.0.dev1702554066-cp310-cp310-macosx_11_0_arm64.whl

Download URL chromobius-1.0.dev1702554066-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
a968a658b7ba32637419a3457e2746a90ea042af413e9ea6256ac65e59dce17e
BLAKE2b-256 checksum
How to use checksums
542e56feb493b1aac1731ab4728f1cdfa2661be6947a7182ab030e37f861b993
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.0.dev1702554066-cp310-cp310-macosx_10_15_x86_64.whl

Download URL chromobius-1.0.dev1702554066-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
8e1d80abe4133c3265bad9a2e284dea68815acc09121dce7f8653607fea67e84
BLAKE2b-256 checksum
How to use checksums
107eee357f8ef630fb7ce0956fc0349ac28ff047f33fe66ff6371e001420e9ed
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