Skip to main content

FaultScope

FaultScope is a stabilizer circuit simulator for quantum error correction, with a Rust core and a Python API. It simulates noisy Clifford circuits, samples detector syndromes, and estimates logical error rates with external decoders. It also generates detector error models and estimates how individual noise rates affect logical failure.

Documentation | User Guide | API Reference

  • Sample measurements, detector syndromes, and logical observables from noisy Clifford circuits.
  • Generate detector error models (DEMs) and sample their independent error mechanisms.
  • Integrate decoders and collect logical error rates across code distances and noise rates.
  • Estimate noise sensitivities and rank fault locations by their effect on a chosen loss.

Installation

Use 64-bit CPython 3.10–3.14. Prebuilt wheels are available for supported Linux, macOS, and Windows platforms, so installing on these platforms does not require Rust.

Create and activate a virtual environment, then install from PyPI:

python -m venv .venv
source .venv/bin/activate
pip install faultscope

On Windows, activate the environment with .venv\Scripts\Activate.ps1 in PowerShell instead. For the quickstart below, add the example dependencies:

pip install "faultscope[pymatching]" stim

The pymatching extra supplies PyMatching, NumPy, and SciPy; Stim supplies the example circuit. See the installation guide for more details, or Development for source builds and contributions.

Quickstart: Simulate a Surface-Code Memory

This example runs a distance-3 rotated surface-code Z-memory experiment for three rounds, with depolarizing noise after Clifford gates. Stim constructs the circuit and a decomposed DEM for the decoding graph. FaultScope samples the original circuit, and PyMatching predicts logical flips from the detector syndromes.

Save the following code as surface_code.py and run python -I surface_code.py in the activated environment. The -I option imports the installed package even when the script is inside the source checkout.

import pymatching
import stim

from faultscope import FaultScopeSimulator, PyMatchingDecoder, parse_stim_circuit

stim_circuit = stim.Circuit.generated(
    "surface_code:rotated_memory_z",
    distance=3,
    rounds=3,
    after_clifford_depolarization=0.005,
)
imported = parse_stim_circuit(str(stim_circuit))
simulator = FaultScopeSimulator(imported.circuit)

# Inspect a batch of circuit samples.
batch = simulator.run_batch(shots=1024, seed=1)
detector_ids = tuple(detector.id for detector in imported.detectors)
observable_ids = tuple(observable.id for observable in imported.observables)
print(f"Sampled {batch.shots} shots with {len(batch.detectors)} detectors")
print("First-shot syndrome:", [batch.detector_bit(d, 0) for d in detector_ids])

# Construct a matching decoder for this circuit's detector layout.
stim_dem = stim_circuit.detector_error_model(decompose_errors=True)
matching = pymatching.Matching.from_detector_error_model(stim_dem)
decoder = PyMatchingDecoder(
    matching=matching,
    detector_ids=detector_ids,
    observable_ids=observable_ids,
    edge_count=matching.num_edges,
)

# Sample a new batch and estimate failure after decoding.
result = simulator.estimate(shots=10_000, seed=2, decoder=decoder)
print(f"Logical failure rate: {result.logical_failure_rate:.4%}")

A logical failure occurs when the decoder's predicted logical flips disagree with the sampled logical observable record. The reported rate is a Monte Carlo estimate; increase the shot count to reduce sampling uncertainty.

Batch fields such as batch.detectors hold packed integer masks, with one bit per shot. Helpers such as detector_bit(detector_id, shot) expose individual values. The same compiled simulator can be reused for additional batches.

Simulation Workflows

Task Public entry point Result
Sample a noisy circuit FaultScopeSimulator.run_batch(...) Measurements, detectors, observables, and noise-event masks
Generate a DEM generate_native_dem(circuit) Detector and logical effects of error mechanisms
Sample a DEM DemFaultScopeSimulator(circuit) or DemHotspotEstimator(dem) Detector syndromes and logical flips from independent error mechanisms
Estimate decoded failure simulator.estimate(..., decoder=decoder) Logical failure rate and noise sensitivities
Run repeated QEC experiments Collector with CollectionTask(circuit=...) Logical error-rate statistics with parallel collection and CSV resume

Circuit-based collection uses forward circuit sampling. A DEM used to construct its decoder does not change the sampling path. Collection also supports stopping conditions and analysis of code-distance and noise-rate sweeps; see logical error-rate collection.

DEM sampling operates on independent error mechanisms. Some circuit noise channels convert exactly; others require explicitly enabled approximation. Use forward sampling when the original channel's mutually exclusive outcomes must be preserved. See detector error models.

The simulator supports Clifford gates, Pauli measurements and resets, and the supported stochastic Pauli noise models. Non-Clifford gates, general non-Pauli channels, and general per-shot adaptive branching are outside its scope.

Noise Sensitivity Analysis

The quickstart's estimate also contains sensitivities for the physical noise locations in the circuit. Append this line to surface_code.py to print the five highest-ranked locations from the same estimate:

print(result.hotspot_table(top_k=5))

A sensitivity estimates how the chosen loss changes when a location's noise rate increases, with the decoder held fixed. A positive value indicates increasing loss; a negative value indicates decreasing loss. Hotspot rankings use the absolute sensitivity, so they highlight large effects in either direction.

Location tags allow results to be grouped by qubit, round, gate, or operation. Forward sensitivities refer to physical noise rates. DEM sensitivities refer to DEM edge probabilities; their location summaries are not generally derivatives with respect to the original circuit noise rates. See the sensitivity guide for interpretation and theory for the estimator's statistical assumptions.

Performance

FaultScope processes many shots together using packed bit arrays in Rust. Reuse a compiled simulator when sampling the same circuit repeatedly.

The quickstart uses the Python PyMatching integration. Optional native PyMatching and fusion-blossom backends keep batch decoding in native code; see native decoder integration.

For reproducible measurements, use a release build and report the circuit, shot count, decoder, and hardware alongside the timings. Start with the sampling benchmark or the surface-code decoder benchmark. The benchmark guide documents build instructions, commands, and comparison settings.

Documentation and Development

FaultScope is pre-1.0; Python and Rust APIs may change between releases. Contributions should pass the relevant development checks above.

License

FaultScope is distributed under the MIT License.

Metadata

Release files for faultscope 0.2.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for faultscope 0.2.11
File Size Uploaded Provenance Actions
faultscope-0.2.11.tar.gz 285.3 kB With provenance Details for faultscope-0.2.11.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for faultscope 0.2.11
File Actions
faultscope-0.2.11-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for faultscope-0.2.11-cp310-abi3-win_amd64.whl
faultscope-0.2.11-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for faultscope-0.2.11-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
faultscope-0.2.11-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for faultscope-0.2.11-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
faultscope-0.2.11-cp310-abi3-macosx_11_0_x86_64.whl CPython 3.10 abi3 macOS 11.0+ x86-64 Details for faultscope-0.2.11-cp310-abi3-macosx_11_0_x86_64.whl
faultscope-0.2.11-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for faultscope-0.2.11-cp310-abi3-macosx_11_0_arm64.whl

Total release size: 6.9 MB

Release files / faultscope-0.2.11.tar.gz

Download URL faultscope-0.2.11.tar.gz
Size 285.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d70c589405f802326aecd066ec231a8593bd27bcacb777965a4a8ffd7acfbd64
BLAKE2b-256 checksum
How to use checksums
8591628544f109f3b7f995e77487cf0804bd667c88ccf2da7b2646ea39c94171
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / faultscope-0.2.11-cp310-abi3-win_amd64.whl

Download URL faultscope-0.2.11-cp310-abi3-win_amd64.whl
Size 1.2 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b4d4d641db86327841da9ad3847c7962c0541a6057bdffdd929a8fb751c2365e
BLAKE2b-256 checksum
How to use checksums
b29aaafc8bb9df00644efecef8141d565a1095bf31486eb7028e149ff4b24aee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / faultscope-0.2.11-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL faultscope-0.2.11-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.4 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
931724c94abb13de2f2927a149dc3b9f0aa1be5ad0daed1f439e354e1269272b
BLAKE2b-256 checksum
How to use checksums
6278e7bfeaf64319b949d6a2517b15d647322772f16956fbf907ece3751238a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / faultscope-0.2.11-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL faultscope-0.2.11-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.4 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
83a4ea66872912701c2b16c2084f62469968f06d9cf3231764ed385dbce44514
BLAKE2b-256 checksum
How to use checksums
0d6f587e8b3e9fd5bbee2b17c1fdeb5e7ad28670472db287392f359a5b3c804d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / faultscope-0.2.11-cp310-abi3-macosx_11_0_x86_64.whl

Download URL faultscope-0.2.11-cp310-abi3-macosx_11_0_x86_64.whl
Size 1.4 MB
Tags CPython 3.10 abi3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
2f7bd01bfedf05fc2f5cec9b1d70764c61a6aae65403aef9017bbdac4ac60ab1
BLAKE2b-256 checksum
How to use checksums
59ea51678932ecab1de1316392a7d31885cfb2bfe87c8ac6f0481a6d572cc07b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / faultscope-0.2.11-cp310-abi3-macosx_11_0_arm64.whl

Download URL faultscope-0.2.11-cp310-abi3-macosx_11_0_arm64.whl
Size 1.3 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
44182e20c7b23f14d655d1d9a5bab224b33c951e22e2b69b88e9f93181f35a06
BLAKE2b-256 checksum
How to use checksums
ab3b360b9d98e68f8fa9d055ef83431bbcc84ce23c90a30584943801e7e645c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Security for faultscope 0.2.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for faultscope-0.2.11.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.11 This release

6 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page