Decode detector samples with BP-OSD
Install the default decoder interfaces:
pip install bloqade-decodersDescribe the errors
Section titled “Describe the errors”A Stim detector error model gives each possible error a probability and the detector or logical-observable bits it flips. This small model has two detectors and one logical observable:
import stim
dem = stim.DetectorErrorModel(""" error(0.1) D0 error(0.1) D0 D1 error(0.1) D1 L0""")Decode a batch
Section titled “Decode a batch”Pass the model to BpOsdDecoder, then provide one row per shot. The return value contains predicted observable corrections in the same row order:
import numpy as npfrom bloqade.decoders import BpOsdDecoder
decoder = BpOsdDecoder(dem)syndromes = np.array([[False, False], [False, True]], dtype=bool)corrections = decoder.decode(syndromes)print(corrections)The same batch shape works with the other decoder interfaces. See the upstream Quick Start for lookup-table and optional Gurobi decoders, or the Overview for package extras and usage notes.