Skip to main content

📦 Loom

PyPI version Python versions

Loom is a Python library to create and run quantum error correction (QEC) experiments. It provides API that allows users to easily define custom stabilizer codes and corresponding lattice surgery operations. It also provides all tools required to convert any experiments to executables compatible with the most used backend (Stim, QASM, etc...).

Disclaimer: major breaking changes to be expected in the first month from release v0.1.0.

Loom is licensed under Apache 2.0.

✨ Features

  • ✅ Build QEC experiments with lattice surgery, surface codes and more.
  • ⚡ Simulate circuits on multiple backends (Stim, QASM3, etc...)
  • 🧠 Analyze stabilizers, syndromes, and logical error rates
  • 🧰 Extensible API for custom experiments and backends

📦 Installation

Install the latest release from PyPI:

pip install el-loom

Install the development version directly from GitHub:

pip install git+https://github.com/entropicalabs/el-loom.git

🚀 Quick Start

Here's a simple example of an experiment designed with Eka. Have a look to the documentation for more information on the available features.

from loom.eka import Eka, Lattice
from loom.eka.operations import (
    ResetAllDataQubits, 
    Merge, 
    MeasureBlockSyndromes, 
    MeasureLogicalZ
)
from loom.interpreter import interpret_eka
from loom.executor import EkaToStimConverter
from loom_rotated_surface_code.code_factory import RotatedSurfaceCode

lattice = Lattice.square_2d((15, 15))

# Create rotated surface blocks on a lattice
rsc_block_1 = RotatedSurfaceCode.create(5, 5, lattice, unique_label="rsc_block_1")
rsc_block_2 = RotatedSurfaceCode.create(
    5, 5, lattice, unique_label="rsc_block_2", position=(6, 0)
)

# Define lattice surgery operations to process
operations = [
    ResetAllDataQubits(rsc_block_1.unique_label),
    Merge([rsc_block_1.unique_label, rsc_block_2.unique_label], "rsc_block_3"),
    MeasureBlockSyndromes("rsc_block_3", n_cycles=1),
    MeasureLogicalZ("rsc_block_3"),
]

# Interpret the operations on the rotated surface code blocks
eka_experiment = Eka(
    lattice, blocks=[rsc_block_1, rsc_block_2], operations=operations
)
# This will contain the circuit, syndromes and detectors of the system resulting from the operations.
final_state = interpret_eka(eka_experiment)

# Get the Stim code ready for simulation
stim_circuit = EkaToStimConverter().convert(final_state)

🧑‍💻 Development Setup

To contribute to Loom, set up a development environment using Poetry:

# Clone the repository
git clone https://github.com/entropicalabs/el-loom.git
cd el-loom

# Install Poetry if needed
curl -sSL https://install.python-poetry.org | python3 -

# Install dependencies including dev dependencies
poetry install --with dev

# Get the command to activate the virtual environment
poetry env activate     # or run all commands with "poetry run" prefix

# Run tests
pytest

# Run linting/formatting
poetry run black src tests

🧱 Project Structure

el-loom/
├── .github/workflows/                  # CI/CD workflows
├── docs/                               # Documentation
├── src/
│   ├── checkers/                       # Pylint checkers
│   ├── loom/
│   │   ├── __init__.py
│   │   ├── eka/                        # Error correction algorithms
│   │   ├── executor/                   # Circuit execution and conversion
│   │   ├── interpreter/                # Syndrome interpretation
│   │   └── visualizer/                 # Plotting and visualization
│   ├── loom_five_qubit_perfect_code/
│   │   ├── __init__.py
│   │   ├── selectors.py                    
│   │   ├── applicator/                 # Code-specific interpretation instructions
│   │   └── code_factory/               # Code-specific algorithmic instructions
│   ├── loom_repetition_code/
│   │   └── ...
│   ├── loom_rotated_surface_code/
│   │   └── ...
│   ├── loom_shor_code/
│   │   └── ...
│   └── loom_steane_code/
│       └── ...
├── tests
├── poetry.lock
├── pyproject.toml
└── README.md
 

🪪 License

Loom is licensed under Apache 2.0.


📬 Contact

Created by Entropica Labs. Feel free to open issues, request features, or contribute via pull requests.

Metadata

Release files for el-loom 0.4.0

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

Source distribution (sdist)

Source distribution for el-loom 0.4.0
File Size Uploaded Provenance Actions
el_loom-0.4.0.tar.gz 304.1 kB Without provenance Details for el_loom-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for el-loom 0.4.0
File Interpreter ABI Platform Actions
el_loom-0.4.0-cp312-cp312-manylinux_2_39_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.39+ x86-64 Details for el_loom-0.4.0-cp312-cp312-manylinux_2_39_x86_64.whl

Total release size: 747.7 kB

Release files / el_loom-0.4.0.tar.gz

Download URL el_loom-0.4.0.tar.gz
Size 304.1 kB
Tags Source
SHA-256 checksum
How to use checksums
20b9f3d77cc0bdfdd310f91c6ad66c091c5f58667539beaa5fd4f2ed4e01100a
BLAKE2b-256 checksum
How to use checksums
bcb6df67ee68f952ccf28b8d62881f3efde6054798ac1a49cf0b23055c36a772
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / el_loom-0.4.0-cp312-cp312-manylinux_2_39_x86_64.whl

Download URL el_loom-0.4.0-cp312-cp312-manylinux_2_39_x86_64.whl
Size 443.7 kB
Tags CPython 3.12 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
d8b88a120be21bfc6c59e02ac7c357a16369a0af98e14faf663fb0eb9f9bd806
BLAKE2b-256 checksum
How to use checksums
6d10ea8d74b80c121c52a9fe94fdc1a948322266473c4a041f9be256d97f9796
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Security for el-loom 0.4.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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