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

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.dev1760419877-cp312-cp312-macosx_10_15_x86_64.whl (952.8 kB view details)

Uploaded CPython 3.12macOS 10.15+ x86-64

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

Uploaded CPython 3.11Windows x86-64

chromobius-1.2.dev1760419877-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.dev1760419877-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.dev1760419877-cp311-cp311-macosx_11_0_arm64.whl (879.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

chromobius-1.2.dev1760419877-cp311-cp311-macosx_10_15_x86_64.whl (953.2 kB view details)

Uploaded CPython 3.11macOS 10.15+ x86-64

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

Uploaded CPython 3.10Windows x86-64

chromobius-1.2.dev1760419877-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.dev1760419877-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.dev1760419877-cp310-cp310-macosx_11_0_arm64.whl (878.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

chromobius-1.2.dev1760419877-cp310-cp310-macosx_10_15_x86_64.whl (951.8 kB view details)

Uploaded CPython 3.10macOS 10.15+ x86-64

File details

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

File metadata

File hashes

Hashes for chromobius-1.2.dev1760419877-cp312-cp312-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 ddfbd93079b3fbfb32399fe3c408959670b7d2be698fbf95cb8a18fd275df6e1
MD5 daffe486dafbe71ea9bda031df3bd72e
BLAKE2b-256 daa9cb89e2ec1c8d3b9d440b73c142ede59662df0fe5f040095998c8ae9c78fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromobius-1.2.dev1760419877-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 712912d3d07e15d1af76a1af7a11bb487c8cb1c7ce490b3f5143bf029c7291d0
MD5 61e075bcf0c7dd09e2b2de3094d1f539
BLAKE2b-256 f1c3866f8c0e4376deb43035884909902a13e3563e3db302e53efeb94de44951

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromobius-1.2.dev1760419877-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a610756b8913853e4a4bef6fdd5ff39cbd3eebb8c3b2177ef0e8201f2084d38b
MD5 10d487b297c812075955741f57153058
BLAKE2b-256 ab728df2daa5da9035f5a44d80e50aa92155de59960396efce5e29385d362d96

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromobius-1.2.dev1760419877-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2d0a270833857f6a1e2cd41bb14af872b930a54e814758e8283d24b9fded3db5
MD5 1fc00b8063cf2b46543ed63c69448a6e
BLAKE2b-256 b0204657bf11cadb2b3381ce63b5464d7e8c23f3fad50f3a1223f44fd4b03888

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromobius-1.2.dev1760419877-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e9371e826c349dae1e1ed729403f8bb5ccb3f3ab23857822e1e7430c12538f3b
MD5 158efc3d9e7b0c3eeb1cae460e217d3c
BLAKE2b-256 643046fd314992e1539aa4eb7ad84f9334b485e7ddb9f3ea24ea1d0c867c638f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromobius-1.2.dev1760419877-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 5cfed36191e8874302fda028cebcffdb6380cbc8b004df78ede4fb8338c1284a
MD5 47c20ce5429487778500d52001ac0f6d
BLAKE2b-256 c1a6f06194599e96ac6f988e31d33f90d65317bb52d9298d3f3679f71c88ffde

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromobius-1.2.dev1760419877-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4ed9c03650dec1294011d398cecd1d8f587a5c344455eef82c8056972e99cffb
MD5 56aa4707d9462d4fe3ae7f2ee705bd75
BLAKE2b-256 7d17879e9fa3bb54cb2e7e68cf48bdcb0ded79c76cae36aa3f97c9f5fb987830

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromobius-1.2.dev1760419877-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0c1068ef5f1a7a5423cb4ef07d620603cbda50de7d5b1c4a7fa61c4b2c2ebce2
MD5 948a1f3251a0a00bd80ec9f377e0402f
BLAKE2b-256 1df285d4eb8a371008cba8d873c6cb4c66d83cfca76d44a8ad0bf63e8cae26eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromobius-1.2.dev1760419877-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 07ccba72cc169b89a4cbfee89a881b537c73ddd955fa76f7c14118620faa1471
MD5 00ffb1e79d307a7a1ea8275fa9a7cca9
BLAKE2b-256 6a9305787a1746228ae5241528b3673b544f659189d9d08f8e71dae5786ff0e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromobius-1.2.dev1760419877-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a8a7aa65eb75d2a96b3949a08c7a824c248190414630b8fc245be876fc03e2a0
MD5 ffe81bd84e4826201d88941cec624730
BLAKE2b-256 96a9112562836d12d9ff22b48ee6c6f14fa4546d6f159d0627de0db02e267cde

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromobius-1.2.dev1760419877-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 f9fc51bb08dff6d143c778316fbc9caf1c1c1fb615ac4879a502c33e3c8d394c
MD5 4f6c38fb260e609e26f8420c21e9c3e8
BLAKE2b-256 26d0b717290fed516623f3deddb851de7c1641c4622c0acc4ae0a065ac376206

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