Skip to main content

A fast implementation of the mobius color code decoder.

Project description

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" \

Disclaimer

This is not an officially supported Google product. This project is not eligible for the Google Open Source Software Vulnerability Rewards Program.

Copyright 2025 Google LLC.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

chromobius-1.2.dev1760452970-cp313-cp313-macosx_10_15_x86_64.whl (953.1 kB view details)

Uploaded CPython 3.13macOS 10.15+ x86-64

chromobius-1.2.dev1760452970-cp312-cp312-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.12Windows x86-64

chromobius-1.2.dev1760452970-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

chromobius-1.2.dev1760452970-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

chromobius-1.2.dev1760452970-cp312-cp312-macosx_11_0_arm64.whl (879.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

chromobius-1.2.dev1760452970-cp312-cp312-macosx_10_15_x86_64.whl (952.9 kB view details)

Uploaded CPython 3.12macOS 10.15+ x86-64

chromobius-1.2.dev1760452970-cp311-cp311-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.11Windows x86-64

chromobius-1.2.dev1760452970-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

chromobius-1.2.dev1760452970-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

chromobius-1.2.dev1760452970-cp311-cp311-macosx_11_0_arm64.whl (879.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

chromobius-1.2.dev1760452970-cp311-cp311-macosx_10_15_x86_64.whl (953.3 kB view details)

Uploaded CPython 3.11macOS 10.15+ x86-64

chromobius-1.2.dev1760452970-cp310-cp310-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.10Windows x86-64

chromobius-1.2.dev1760452970-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

chromobius-1.2.dev1760452970-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

chromobius-1.2.dev1760452970-cp310-cp310-macosx_11_0_arm64.whl (878.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

chromobius-1.2.dev1760452970-cp310-cp310-macosx_10_15_x86_64.whl (951.9 kB view details)

Uploaded CPython 3.10macOS 10.15+ x86-64

File details

Details for the file chromobius-1.2.dev1760452970-cp313-cp313-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for chromobius-1.2.dev1760452970-cp313-cp313-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 262f6075f39d0f933f950a4c8cdf1f363f8b58eec43a7a52ff6de31f3ca2a097
MD5 9f5dfc6c57f737476a4bf53c5fe4f1a0
BLAKE2b-256 6a3a406796396bbc686e8f9ee5fcbee4d1d349622a418a1ea51b206f6aaf5e40

See more details on using hashes here.

File details

Details for the file chromobius-1.2.dev1760452970-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for chromobius-1.2.dev1760452970-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 21d6e9f5b6f593d896c9b9c23adc39e64f1f91c72d1cf7c13b28814d4bce9db1
MD5 14fab1cf957a3d0fc9e70e4e26618dd2
BLAKE2b-256 dd91b73c19038f121d96db18a5f91fa7c4fc29147aef5865fffe481ac27a7832

See more details on using hashes here.

File details

Details for the file chromobius-1.2.dev1760452970-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for chromobius-1.2.dev1760452970-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c2781f79ce0ad897740534534e84a58734f575da3ea204b8ba2bb8f795915626
MD5 b3b86e066e705d6673f2a9942e8c0ae2
BLAKE2b-256 46823bf91d967aa3e2217d5420d79cf7fc5b7460f67100fa76293db050fe19c7

See more details on using hashes here.

File details

Details for the file chromobius-1.2.dev1760452970-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for chromobius-1.2.dev1760452970-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c64cead27fd0be487a6fd199c45f55b77329499050a6fc67965c49f4e5df5cea
MD5 0d978fcc2e574f9a135ea642863ca39c
BLAKE2b-256 32838687806db67567c697c377746d4d1f057c6f95f597f6e1d0b1e300dec0e3

See more details on using hashes here.

File details

Details for the file chromobius-1.2.dev1760452970-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chromobius-1.2.dev1760452970-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 48295cf10c314faf55f00c285be087eec1f97029f466ed5cbdcd219ddc3e68cd
MD5 3b4d72aad06c884cd4d07d4a1558f276
BLAKE2b-256 5ba5b94a4bad557d7586f062f80c2a3ea4606af443c0dfde9efa9fc9b1b28db0

See more details on using hashes here.

File details

Details for the file chromobius-1.2.dev1760452970-cp312-cp312-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for chromobius-1.2.dev1760452970-cp312-cp312-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 69c66fe7fb9c289ddf85a67f46f818f1575929ebdc61c3394274bab8a775fd8c
MD5 269c4112ee6eb4ac29aa19fe1487c50c
BLAKE2b-256 d0514e67b1fb473d74f1d66df3a2467d25b72b8b1e3b00631fe7aab229b95459

See more details on using hashes here.

File details

Details for the file chromobius-1.2.dev1760452970-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for chromobius-1.2.dev1760452970-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 786792435c4f3025f555e298d54b00a2995aae587eaaf7890b2cbc3ab9c064a5
MD5 44469d8710f5cdd3994bf788799e7329
BLAKE2b-256 3c9318cca89f7bab9f3e6141e114ec2834aa3e80751751ea7c89d771615b58e3

See more details on using hashes here.

File details

Details for the file chromobius-1.2.dev1760452970-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for chromobius-1.2.dev1760452970-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 01dd43b9d93438d1b020ae0dfbd8d82ffd3d246b3337895bc58787c6702b24c7
MD5 04e4e4df57510508661345a9b27e8d29
BLAKE2b-256 4978656aac32286b2f392b45de053811777af3532f64156664e509cd922d7efb

See more details on using hashes here.

File details

Details for the file chromobius-1.2.dev1760452970-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for chromobius-1.2.dev1760452970-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a0e3963207300543e10ef6177df28d6c369c968229029ea480bc2a5093a71030
MD5 815d946485ab9b5969a5d90b8e279dd0
BLAKE2b-256 cdebee736486ef3a19ac31a11d2ad88c4c05ddcb18bb2b00f79a950b466e0307

See more details on using hashes here.

File details

Details for the file chromobius-1.2.dev1760452970-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chromobius-1.2.dev1760452970-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6dddeebe4e51925e77311eb5201a70fede2fbb87033e291121119158548d0517
MD5 0c3190d7ba766747682d18b604755065
BLAKE2b-256 9d8fb60d016b391cc13edf24e64de96f7d0ddccdf00dd47b67ff9be28303e7db

See more details on using hashes here.

File details

Details for the file chromobius-1.2.dev1760452970-cp311-cp311-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for chromobius-1.2.dev1760452970-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 b91c84a6f7a462f1a8fdecfb468f8e173b3654781e9ab7fb91f0a53af331cf9c
MD5 faf7147ae8c6f2ff557c4244510b07b5
BLAKE2b-256 8d17ab73a166ddc4933d950f1ced187ddc8bc49338d57cea275793241ea40673

See more details on using hashes here.

File details

Details for the file chromobius-1.2.dev1760452970-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for chromobius-1.2.dev1760452970-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 dfbd96c3fd705bdcca02a95bcdf30a2aa6b8d147fda24a04fd57ee5521bdd4cd
MD5 b92a4228ac0607593043eed51451522b
BLAKE2b-256 2b357717ebb5610f16512c6b7dfee71054010d43600ac32f69a1e71475f72828

See more details on using hashes here.

File details

Details for the file chromobius-1.2.dev1760452970-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for chromobius-1.2.dev1760452970-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2700b51a299bb775d39f6b3d7a3032d82fa4c87287978ccb2a464d35fd08a121
MD5 5a680e7a142c378b74e0152d128f2910
BLAKE2b-256 df8e2ca1bfbaa57c859b919dcaaf7777b90218f9b83419ac827a66ef67154396

See more details on using hashes here.

File details

Details for the file chromobius-1.2.dev1760452970-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for chromobius-1.2.dev1760452970-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b71f958b8708fb2084340086dc007f432466df70fc023c4368d9fbce82aabf6d
MD5 3c676a9b66f04c2c6740c452b95bbb6f
BLAKE2b-256 bc4ddf878964acc6e53797aef224f9ae7937fb27e40fd56f80bfbc3a7121cfcb

See more details on using hashes here.

File details

Details for the file chromobius-1.2.dev1760452970-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chromobius-1.2.dev1760452970-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 754d4008a09f7aed22af8d2ad3e1f434d163c3a863707f5cbe555f3014a5772c
MD5 54a76a5c96401b00a5c9ac21c7b4eadc
BLAKE2b-256 12c827c801dfa10c0fa0bd18763d5282ea1cacbf18562a8d86a44a3ef9533822

See more details on using hashes here.

File details

Details for the file chromobius-1.2.dev1760452970-cp310-cp310-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for chromobius-1.2.dev1760452970-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 47a6244c5235c041de11d421c637118a33e83f0bb8e32b4ed05a8e7370e93470
MD5 ea175d55b1ce70e5d8ec8afb5a11ac45
BLAKE2b-256 e7a1e9618d874385ef8e3879d98b76ed04fe1d0ed748f474e3698c716741ab10

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page