Sinter

raw JSON →
1.15.0 verified Fri May 01 auth: no python

Sinter is a Python library for sampling and decoding quantum error correction circuits using Stim, with integrated support for PyMatching and various decoders. Current version 1.15.0; released roughly monthly. It provides CLI tools and a Python API for collecting statistics, plotting error curves, and managing batch jobs.

pip install sinter
error ModuleNotFoundError: No module named 'sinter'
cause Sinter is not installed or installed in a different environment.
fix
Run pip install sinter in your active Python environment.
error AttributeError: module 'sinter' has no attribute 'collect'
cause Outdated version of sinter (<0.1). The API changed significantly in earlier versions.
fix
Upgrade to latest version: pip install --upgrade sinter.
error RuntimeError: Failed to decode: decoder 'pymatching' not available
cause pymatching library is not installed.
fix
Install pymatching: pip install pymatching.
breaking In sinter v1.10+, the `sinter.plot.error_rate_vs_error_probability` function changed its signature: the `collection` argument is now positional-only and `show` parameter is removed.
fix Use `sinter.plot.error_rate_vs_error_probability(sample, ax=ax)` instead of passing collection as keyword or using `show=True`.
deprecated `sinter.collect()` parameter `num_workers` is deprecated in favor of `num_processes`.
fix Replace `num_workers=4` with `num_processes=4`.
gotcha If you don't install pymatching, sinter will raise a runtime error when trying to use 'pymatching' decoder. It is not installed by default.
fix Install pymatching via `pip install pymatching` or use a different decoder like 'fusion_blossom' that doesn't require pymatching.

Create a repetition code circuit, sample it with PyMatching decoder, and plot error rate vs physical error probability.

import sinter
import stim

tasks = [
    sinter.Task(
        circuit=stim.Circuit.generated(
            'repetition_code:memory',
            rounds=100,
            distance=5
        ),
        decoder='pymatching',
    )
]

sample = sinter.collect(
    num_workers=4,
    max_errors=1_000,
    start_batch_size=100,
    tasks=tasks,
)

print(sample)

# Plot results
fig, ax = sinter.plot.error_rate_vs_error_probability(sample)
fig.savefig('plot.png')