A lightweight experiment-runner and lab notebook for quantum computing
Project description
qlab
A lightweight experiment-runner and lab notebook for quantum computing, built on top of Cirq.
Overview
qlab is designed for running quantum experiments, tracking results, and visualizing outcomes. It focuses on reproducibility, persistence, and visualization rather than being a general-purpose quantum framework.
Key Features:
- 🧪 Experiment Management: Define parametric quantum circuits and run them systematically
- 💾 Result Persistence: Store runs, results, and metadata in SQLite
- 📊 Visualization: Automatic Bloch sphere visualization for 1-qubit states
- 🔬 Reproducibility: All parameters and results are stored for later analysis
- 🚀 Simple API: Minimal, opinionated design focused on experiments
Installation
pip install qex
Quick Start
from qlab import CirqBackend, Runner, ResultStore
from qlab.demos import hadamard_experiment
from pathlib import Path
# Setup
backend = CirqBackend()
runner = Runner(backend)
store = ResultStore(Path("qlab_data/qlab.db"))
# Run an experiment
experiment = hadamard_experiment()
record = runner.run(experiment, params={})
# Persist results
store.save_run(record)
# Retrieve and view
runs = store.list_runs(experiment_name="hadamard")
rho = runs[0].get_density_matrix()
print(f"Density matrix:\n{rho}")
store.close()
Built-in Experiments
qlab includes three demo experiments for validation:
- X Gate:
|0⟩ → X → |1⟩- Simple bit flip - Hadamard:
|0⟩ → H → superposition- Creates equal superposition - Ry Sweep:
|0⟩ → Ry(θ)- Rotation around Y-axis with parametertheta
Documentation
- API Reference: Complete API documentation
- Design Specification: Architecture and design decisions
- Database Schema: SQLite schema documentation
- Bloch Sphere Contract: Visualization math and interface
Current Scope (MVP)
- ✅ 1-qubit experiments only
- ✅ Ideal simulation (no noise)
- ✅ Density matrix results
- ✅ SQLite persistence
- ✅ Bloch sphere HTML visualization
- ✅ Cirq-based backend
Requirements
- Python >= 3.12
- Cirq >= 1.6.1
- NumPy >= 1.24.0
License
Apache License 2.0
Contributing
Contributions are welcome! Please see the Design Specification for architecture details and constraints.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qex-0.1.1.tar.gz.
File metadata
- Download URL: qex-0.1.1.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88003ca167d2a254bf263d4f851e3375572f7c376fca6bd6732098bc1106e056
|
|
| MD5 |
7116b4b57dfdb524333c805b58b521fc
|
|
| BLAKE2b-256 |
089ff9056664ffcdfc19a981fe6da3d91acbe1ddffa1794e3a10ae285434cb37
|
File details
Details for the file qex-0.1.1-py3-none-any.whl.
File metadata
- Download URL: qex-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
421947a3a90000ab3eb52212991206883793624431107a36fe3cd88ac7213dcf
|
|
| MD5 |
af9b941bfccff1bb8de854f618782173
|
|
| BLAKE2b-256 |
babd6e6cb1d9c4fca90540a9ac1792a9e94c43ff0043cc361b36befaf300d5bb
|