Skip to content

quip0/QLEX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QLEX

The Quantum Lexicon

QEC code registry and intelligence layer
Install · Quickstart · Python API · Terminal UI · CLI · API Reference

Version Python License


QLEX is a pip-installable Python library and interactive terminal experience that serves as the authoritative registry and query interface for Quantum Error Correction (QEC) codes. It is the first product from Qorex — a quantum computing infrastructure company.

QLEX does not simulate or decode quantum circuits. It knows everything about QEC codes so that other tools don't have to. It is the language layer — the lexicon — that the entire Qorex ecosystem speaks.

Why QLEX?

QEC code information is scattered across hundreds of papers, and there's no single place to look it up programmatically. If you're building a quantum computing tool — a simulator, a decoder benchmark, a hardware planner — you need to know things like: what's the threshold of the surface code? What decoders work with color codes? Which codes run on trapped ions? Right now you'd dig through arxiv papers or maintain your own spreadsheet.

QLEX is that spreadsheet, except it's a pip-installable Python library with a real API.

Who it's for:

  • Researchers picking a code for an experiment — browse 45 codes, compare thresholds, check hardware compatibility, follow key papers
  • Tool builders in the Qorex ecosystem — to_export_config() gives a standardized dict any downstream tool can ingest, so every tool speaks the same language about code properties
  • Students learning QEC — the TUI lets you explore codes interactively, and the describe screen (d) explains what every field means

Why not just a wiki or PDF? Because you can't import a wiki. QLEX is designed to be a dependency — the single source of truth that other software reads from at runtime. When a new code gets added to the registry, every tool that imports QLEX gets it automatically.

Install

pip install qlex

PyPI

Requires Python 3.10+. The only runtime dependency is Pydantic v2.

Or install from source:

git clone https://github.com/qorex/qlex.git
cd qlex
pip install .

Quickstart

Get up and running in under a minute. QLEX gives you three ways to interact with the QEC code registry: Python, terminal UI, and CLI.

1. Python — look up a code and inspect it

import qlex

code = qlex.get("surface")
print(code.name)                        # Surface Code
print(code.parameters)                  # n='2d^2 - 1' k=1 d='variable'
print(code.threshold.circuit_level)     # 0.0057
print(code.hardware_compatibility)      # ['superconducting', 'trapped_ion', ...]

2. Python — filter, search, and compare

# Find all topological codes that work on trapped ions
codes = qlex.filter(family="topological", hardware="trapped_ion")
for c in codes:
    print(c.name)
# Color Code
# Rotated Surface Code
# Surface Code
# Toric Code

# Fuzzy search across names, descriptions, and tags
qlex.search("biased")                   # codes mentioning biased noise

# Compare two codes head-to-head
comp = qlex.compare("surface", "color")
print(comp.winner("circuit_level_threshold"))   # surface
print(comp.table())                             # formatted ASCII table

3. Python — export for downstream tools

config = qlex.get("surface").to_export_config()

Returns a versioned dict that any Qorex tool can ingest:

{
  "code_id": "surface",
  "code_name": "Surface Code",
  "parameters": {"n": "2d^2 - 1", "k": 1, "d": "variable"},
  "supported_noise_models": ["depolarizing", "biased", "erasure", "circuit_level", "amplitude_damping"],
  "recommended_decoders": ["MWPM", "Union-Find", "Belief Propagation", "Neural Network"],
  "threshold_reference": {"depolarizing": 0.189, "circuit_level": 0.0057, "notes": "..."},
  "qlex_version": "0.1.0"
}

4. Terminal UI — explore interactively

qlex

Opens a keyboard-driven ASCII explorer with animated transitions, real-time search, and side-by-side comparison. Use / to browse, / to search, c to stage codes for comparison, Enter for detail, d for field descriptions. Press ? for the full keyboard reference.

5. CLI — script and pipe

qlex list                                    # all codes
qlex get surface                             # full detail
qlex search biased                           # substring search
qlex compare surface color                   # comparison table
qlex export surface                          # JSON config for tooling
qlex filter --family topological --fault-tolerant   # combined filters
qlex export surface | jq '.recommended_decoders'    # pipe into jq

Python API

import qlex

# Look up a code by ID
surface = qlex.get("surface")
print(surface.summary())

# List everything in the registry
all_codes = qlex.list_codes()          # sorted alphabetically
print(qlex.count(), "codes across", qlex.families())

# Filter codes
topological = qlex.filter(family="topological")
ft_sc = qlex.filter(fault_tolerant=True, hardware="superconducting")
css_stab = qlex.filter(tags=["CSS", "stabilizer"])

# Search (case-insensitive substring across name, description, tags, noise models)
results = qlex.search("surface")       # Surface Code, Rotated Surface Code, ...

# Compare codes side-by-side
comp = qlex.compare("surface", "color", "steane")
print(comp.table())
print(comp.winner("circuit_level_threshold"))

# Export for downstream Qorex tools
config = surface.to_export_config()
# {
#   "code_id": "surface",
#   "code_name": "Surface Code",
#   "parameters": {"n": "2d^2 - 1", "k": 1, "d": "variable"},
#   "supported_noise_models": ["depolarizing", "biased", ...],
#   "recommended_decoders": ["MWPM", "Union-Find", ...],
#   "threshold_reference": {"depolarizing": 0.189, "circuit_level": 0.0057, ...},
#   "qlex_version": "0.1.0"
# }

See the full API Reference for detailed documentation.

Terminal UI

qlex

The TUI is an entirely keyboard-driven ASCII explorer built on Python's curses stdlib — no external TUI frameworks. It features animated screen transitions, real-time search, threshold bar charts, and side-by-side code comparison.

 ┌──────────────────────────────────────────────────────────────────────────────┐
 │ QLEX                                                        9 codes        │
 ├──────────────────────────────┬───────────────────────────────────────────────┤
 │ CODES                       │  Surface Code                                │
 │                              │  [[2d^2 - 1, 1, variable]]                  │
 │    Bacon-Shor Code  [sub.]  │                                              │
 │    Color Code        [top.]  │  Circuit-level: ████████░░░░░░ 0.0057       │
 │    Gross [[144,12..  [qLD.]  │  Depolarizing:  █████████████░ 0.1890       │
 │    Repetition Code   [sta.]  │                                              │
 │    Rotated Surface   [top.]  │  Hardware:                                   │
 │    Shor [[9,1,3]]    [sta.]  │  [superconducting] [trapped_ion]            │
 │    Steane [[7,1,3]]  [CSS ]  │  [neutral_atom] [NV_center]                 │
 │  ▶ Surface Code      [top.]  │                                              │
 │    Toric Code        [top.]  │  The surface code is a topological           │
 │                              │  stabilizer code defined on a 2D lattice     │
 │                              │  of qubits.                                  │
 ├──────────────────────────────┴───────────────────────────────────────────────┤
 │ ENTER detail · / search · c compare · C compare view · f filter · ? help   │
 └──────────────────────────────────────────────────────────────────────────────┘

Screens

Screen Description
SPLASH Animated boot sequence with loading bar
BROWSE Main explorer — scrollable code list with live preview
DETAIL Full-page view of a single code with all properties
SEARCH Real-time substring filter overlay on BROWSE
COMPARE Side-by-side comparison of 2-3 codes with winner metrics
DESCRIBE Plain-language explanations of every code field
HELP Complete keyboard reference

Keyboard Shortcuts

Key BROWSE DETAIL SEARCH COMPARE
/k Move up
/j Move down
Enter Open detail Select first result
/ Enter search
c Stage for compare Stage for compare Clear selection
C Open compare
d Describe fields Describe fields
f Cycle family filter
e Export JSON
b/Esc Clear filters Back to browse Cancel search Back to browse
? Help
q Quit

See the full Terminal UI Guide for details.

CLI

QLEX also provides a scriptable CLI for use in pipelines and automation. All output is clean plain text — no TUI rendering.

# List all codes
$ qlex list
  bacon-shor                Bacon-Shor Code
  color                     Color Code
  gross-144-12-12           Gross [[144,12,12]] qLDPC Code
  repetition                Repetition Code
  rotated-surface           Rotated Surface Code
  shor                      Shor [[9,1,3]] Code
  steane                    Steane [[7,1,3]] Code
  surface                   Surface Code
  toric                     Toric Code

# Get a specific code
$ qlex get surface

# Search
$ qlex search biased

# Compare codes
$ qlex compare surface color steane

# Export for downstream tools
$ qlex export surface

# Filter (flags are combinable)
$ qlex filter --family topological
$ qlex filter --hardware trapped_ion --fault-tolerant
$ qlex filter --tag CSS --tag stabilizer

# Version
$ qlex version
QLEX 0.1.0
by Qorex

See the full CLI Reference for all options.

Registry

QLEX ships with 45 QEC codes sourced from published literature. Every threshold value has a citation.

Code Family [[n, k, d]] Circuit Threshold Depolarizing Threshold
Surface Code topological [[2d²-1, 1, d]] 0.0057 0.189
Rotated Surface Code topological [[d², 1, d]] 0.0057 0.189
Toric Code topological [[2d², 2, d]] 0.0075 0.189
Color Code topological [[18, 1, 5]] 0.0046 0.109
XZZX Surface Code topological [[d², 1, d]] 0.0057 0.189
Floquet Honeycomb topological [[2d², 1, d]] 0.002
Steane [[7,1,3]] CSS [[7, 1, 3]] 0.00027
Shor [[9,1,3]] stabilizer [[9, 1, 3]]
Knill C4/C6 stabilizer [[var, 2, var]] 0.01
Bacon-Shor subsystem [[m×m, 1, d]] 0.00042
Gauge Color Code subsystem [[var, 1, var]] 0.0031
Repetition Code stabilizer [[n, 1, d]] 0.0029
Gross [[144,12,12]] qLDPC [[144, 12, 12]]
Quantum Tanner qLDPC [[var, var, var]]
GKP Code bosonic [[1, 1, var]]
Cat Code bosonic [[1, 1, var]]

Showing 16 of 45 codes. See the Registry Guide for the full list, including hardware compatibility, supported decoders, and key papers.

Ecosystem

Qorex

QLEX is the foundational layer in the Qorex quantum computing infrastructure stack.

  ┌─────────────────────────────────────────────────────┐
  │         Future Qorex tools                          │
  │   (simulator · benchmarker · paper tracker)         │
  └────────────────────┬────────────────────────────────┘
                       │  imports
  ┌────────────────────▼────────────────────────────────┐
  │                   QLEX                              │
  │      QEC code registry & intelligence layer         │
  │              pip install qlex                       │
  └─────────────────────────────────────────────────────┘

Downstream tools consume QLEX's export configs to standardize how QEC code properties are passed between systems. The to_export_config() method produces a versioned dict that any Qorex tool can ingest:

config = qlex.get("surface").to_export_config()
# Pass config["recommended_decoders"] to a decoder benchmarker
# Pass config["parameters"] to a circuit simulator
# Pass config["supported_noise_models"] to a noise characterizer

Project Structure

qlex/
├── qlex/
│   ├── __init__.py          # Public API surface
│   ├── registry.py          # Core registry: load, query, filter
│   ├── models.py            # Pydantic v2 data models
│   ├── filters.py           # Filter and search logic
│   ├── compare.py           # Side-by-side code comparison
│   ├── export.py            # Export helpers for downstream Qorex tools
│   ├── exceptions.py        # All custom exceptions
│   ├── cli.py               # CLI entry point (argparse)
│   ├── ui/
│   │   ├── app.py           # Main TUI entry point
│   │   ├── renderer.py      # ASCII rendering primitives
│   │   ├── screens.py       # Screen render functions
│   │   ├── state.py         # UI state machine
│   │   └── theme.py         # Colors, glyphs, animations
│   └── data/
│       └── codes.json       # The full code registry
├── tests/                   # pytest test suite
├── docs/                    # Documentation
└── assets/
    └── logos/               # QLEX and Qorex brand assets

Development

# Clone and install in dev mode
git clone https://github.com/qorex/qlex.git
cd qlex
pip install -e ".[dev]"

# Run tests
pytest -v

# Launch the TUI
qlex

Contributing

To add a new QEC code, submit a PR that adds an entry to qlex/data/codes.json. Each entry must include all required fields — see the Registry Guide for the full schema. Threshold values must be sourced from published literature with appropriate citations in the key_papers field.

See CONTRIBUTING.md for full guidelines.

License

MIT — Qorex

About

QLEX is Qorex's QEC code registry — a Python library and terminal explorer that stores everything about quantum error correcting codes: parameters, thresholds, hardware compatibility, decoders, and key papers. Query it programmatically or explore it through a fluid, keyboard-driven ASCII interface. The foundation every Qorex tool builds on.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Languages