Stim ships a singleDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/quantumlib/Stim/llms.txt
Use this file to discover all available pages before exploring further.
stim executable that exposes all of its simulation and analysis capabilities as subcommands. After installing the Python package, the binary is available on your PATH and accepts the general form stim <command> [flags]. You can pipe circuits through stdin, redirect output to files, and chain commands together to build end-to-end quantum error correction workflows directly from the shell.
Installation
Available commands
analyze_errors
Converts a Stim circuit into a detector error model (DEM). Supports error decomposition and loop folding for circuits with
REPEAT blocks.convert
Converts measurement or detection event data between result formats:
01, b8, r8, ptb64, hits, and dets.detect
Samples detection events and observable flips from a noisy circuit. Writes detection data and observable data to separate files.
diagram
Produces ASCII, SVG, or GLTF diagrams of circuits and detector error models, including timeline and detector-slice views.
explain_errors
Maps detector error model errors back to the physical circuit errors that cause them, useful for debugging and decoder analysis.
gen
Generates annotated example circuits for the repetition code, surface code, and color code with configurable noise models.
help
Prints usage information for the
stim binary and its subcommands.m2d
Converts raw measurement data from hardware runs into detection event data by comparing against a reference sample derived from the circuit.
repl
Runs Stim in interactive read-evaluate-print-loop mode, measuring qubits and printing results as you type circuit instructions.
sample
Samples raw measurement results from a circuit. Supports multiple shots, seeded randomness, and all output data formats.
sample_dem
Samples detection events directly from a detector error model. Supports recording and replaying which errors occurred.
Getting help
Every command supports a--help flag that prints its full usage, option list, and examples.
Common usage patterns
Generate a circuit and immediately analyze its errors:All commands read from stdin by default when
--in is not specified, and write to stdout when --out is not specified. This makes it easy to compose commands with shell pipes.