Skip to main content

A surface code simulator

Project description

SurfQ

SurfQ is a Python framework for efficiently simulating surface codes under noise. The aim is to enable detailed investigation of the behavior of surface codes under different physical error models, supporting advanced fault-tolerant protocols such as lattice surgery, state injection, and magic state distillation as future extensions.

License

This project is released under the GNU Affero General Public License v3.0 (AGPL-3.0) or later.

Please see the LICENSE file for the full text of the license.

Features

  • Intuitive surface code representation
  • Apply quantum operations: X, Z, H, CNOT, and syndrome measurement
  • Simulate various noise channels: Pauli noise, depolarizing, bit-flip, phase-flip errors
  • Analyse logical error rates and syndrome measurement statistics for error correction
  • Modular and extensible framework for surface code simulation and fault-tolerant quantum protocols

Usage

This package is available on PyPi. To use it you can simply install on your environment with pip:

pip install surfq

Alternatively, if you are using uv package manager, you can get started by simply:

uvx juv init notebook.ipynb
uvx juv run notebook.ipynb --with surfq

Then to get started in python:

from surfq import Lattice

l = Lattice(5)
l[1,1:4].X()
l.show()

Examples

This project contains a set of example scripts to experiment with. We recommend using uv for seamless dependency management.

  • Decoding Test 1: This script showcases a successful example of the current in-progress work on decoding error syndromes.
uv run examples/decoding_1.py
  • Decoding Test 2: This script showcases a wrong example of the current in-progress work on decoding error syndromes.
uv run examples/decoding_2.py

Notebooks

This project contains a set of notebooks to experiment with. We recommend using juv for seamless dependency management.

  • Tutorial: This notebook goes through the basics of Quantum Error Correction, Stabilizer Formalism and the Surface Code, while leveraging surq to make the surface code more interactive and more easily illustrated.
uvx juv run notebooks/tutorial/notebook.py

Testing

Run the unit test suite with:

uv run pytest

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

surfq-0.1.4.tar.gz (98.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

surfq-0.1.4-py3-none-any.whl (97.5 kB view details)

Uploaded Python 3

File details

Details for the file surfq-0.1.4.tar.gz.

File metadata

  • Download URL: surfq-0.1.4.tar.gz
  • Upload date:
  • Size: 98.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for surfq-0.1.4.tar.gz
Algorithm Hash digest
SHA256 870c224ac35672e620bb1c772014f3f3d7407fa4876586186c7bb954b6d14233
MD5 ee04b98d5e504195ae47517d5448a5ce
BLAKE2b-256 76fb5c6af80ef8452e0876f3bb4eeef3e8d0e55b285cdac73b7bef8114c0ab3c

See more details on using hashes here.

File details

Details for the file surfq-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: surfq-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 97.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for surfq-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cb7ab8a69b7473d6cdba03e89c7ae2d8946b12dac56c1d5dbacaf9e154f4a8e9
MD5 5a84997b0a216dea0756b920eaa2f55a
BLAKE2b-256 5baad47b21469aad84d552731ef273e952eaab919f859bd36710d0ec89b03d67

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page