RustQEC 0.3 · Development

From Stim circuit to SVG or JSON

QP101 is a JSON format for circuit diagrams. It preserves gates, repeat blocks, detectors, noise and coordinates in execution order.

Create circuit.stim in your working directory.

cat > circuit.stim <<'STIM'
R 0 1
X_ERROR(0.1) 0
X_ERROR(0.1) 1
CX 0 1
M 0 1
DETECTOR rec[-2]
DETECTOR rec[-1]
OBSERVABLE_INCLUDE(0) rec[-2] rec[-1]
STIM
rstim render_svg --in circuit.stim --out circuit.svg
rstim export_json --in circuit.stim --out circuit.qp101.json

circuit.svg shows the two-qubit circuit; circuit.qp101.json is its ordered circuit document.

Read the diagram

R resets a qubit; XE marks a possible X error, and the filled dot is the CNOT control. M marks a measurement. D0 and D1 label detector checks; L0 labels the logical parity. This is the circuit definition, before sampling a shot.

Two-qubit circuit with possible X errors, a CNOT, measurements, detectors and a logical observable
Operation types
TypePurpose
gate, noiseQuantum operations and faults
repeat, tickStructure and timing
detector, observable_includeQEC annotations
qubit_coords, shift_coordsVisualization coordinates
Interactive schema browser

Loading schema

Fetching qp101.schema.json.

Example documents