A lightweight experiment-runner and lab notebook for quantum computing
Project description
qex
A lightweight experiment-runner and lab notebook for quantum computing, built on top of Cirq.
qex decouples your quantum experiment definitions from execution backends, persisting your runs in a local SQLite database and providing a visual web dashboard to analyze state metrics, density matrices, and compare state fidelities side-by-side.
Key Features
- 🧪 Experiment Abstraction: Define parameterized quantum circuits independent of physical backends.
- 💾 SQLite Lab Notebook: All runs, timestamps, parameters, backends, and density matrices are tracked and stored automatically.
- 📉 Noisy Simulation Backend: Run ideal simulations or inject custom physical depolarizing noise.
- 📐 Quantum State Metrics: Real-time evaluation of Purity and Von Neumann Entropy for simulated mixed states.
- 📊 Interactive Web Dashboard: Beautiful dark-mode SPA visualizer containing a 3D Bloch sphere (Three.js), density matrix grids, and run creators.
- ⚖️ Side-by-Side Run Comparison: Compare any two runs side-by-side and compute their quantum State Fidelity.
- 💻 Robust CLI Tool: Start the UI server, list runs, execute experiments, and open visualizations from the terminal.
- 📡 Multi-Qubit Scaling: Simulate circuits from 1 up to 10 qubits ($1024 \times 1024$ density matrix dimension) with grid rendering performance optimization.
Installation
pip install qex
Quick Start
1. Define and Run an Experiment in Python
import cirq
from qex import CirqBackend, Runner, ResultStore, Experiment
# 1. Define a parameterized experiment (e.g. Hadamard on N qubits)
def multi_hadamard():
def builder(qubits, params):
return cirq.Circuit(cirq.H(q) for q in qubits)
return Experiment(name="multi_hadamard", builder=builder)
# 2. Setup the runner and database store
backend = CirqBackend()
runner = Runner(backend, base_dir="qex_data")
store = ResultStore("qex_data/qex.db")
# 3. Simulate a 3-qubit execution
qubits = [cirq.GridQubit(0, i) for i in range(3)]
record = runner.run(multi_hadamard(), params={}, config={"qubits": qubits})
# 4. Save to your lab notebook
store.save_run(record)
store.close()
2. Control via CLI
# List all executed runs in the notebook
qex list
# Execute a new run with depolarizing noise (p = 0.05) on 4 qubits
qex run hadamard --qubits 4 --noise 0.05
# Open a 3D Bloch Sphere visualization in the browser
qex view <run_id>
3. Open the Interactive Web Dashboard
qex ui
This launches a local server on port 8000. Use the visual dashboard to run new circuits, view 3D Bloch vectors, analyze purity/entropy, and toggle Compare Mode to check quantum state fidelity between different ideal and noisy runs.
Requirements
- Python >= 3.12
- Cirq >= 1.6.1
- NumPy >= 1.24.0
License
Apache License 2.0
FYI / Disclaimer
[!NOTE] The author is not a professional physicist. This library is built as an exploratory workspace, educational tool, and local lab notebook. It may contain bugs, experimental behaviors, or mathematical/physical inconsistencies. Contributions and corrections are highly welcome!
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-1.0.0.tar.gz.
File metadata
- Download URL: qex-1.0.0.tar.gz
- Upload date:
- Size: 31.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8976047a9464c4688e91f435ec1d1b3f9d4a61b90a521168a5248fccd9eee2b4
|
|
| MD5 |
88a8993911771ed1f2e2ddf8ae6ff883
|
|
| BLAKE2b-256 |
d0e4daafc5f7c6b37f9dcb4adbb7092ea18e66bf0607150875211526f037686b
|
Provenance
The following attestation bundles were made for qex-1.0.0.tar.gz:
Publisher:
publish.yml on AndreaPallotta/qex
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qex-1.0.0.tar.gz -
Subject digest:
8976047a9464c4688e91f435ec1d1b3f9d4a61b90a521168a5248fccd9eee2b4 - Sigstore transparency entry: 2082529464
- Sigstore integration time:
-
Permalink:
AndreaPallotta/qex@c3748d875524280feb411ff62d0344e43436a295 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/AndreaPallotta
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c3748d875524280feb411ff62d0344e43436a295 -
Trigger Event:
push
-
Statement type:
File details
Details for the file qex-1.0.0-py3-none-any.whl.
File metadata
- Download URL: qex-1.0.0-py3-none-any.whl
- Upload date:
- Size: 32.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c3ef83ff7d3fa68bef2b048a81ed5c3ee59fce32bd7669fde21f3be356cf6bb
|
|
| MD5 |
4afbfb482a10df254d26e16c26745f47
|
|
| BLAKE2b-256 |
c1334713e4dbfb846bc5cc5f1a7b614d020a4132be335d413729f177ba863eca
|
Provenance
The following attestation bundles were made for qex-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on AndreaPallotta/qex
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qex-1.0.0-py3-none-any.whl -
Subject digest:
7c3ef83ff7d3fa68bef2b048a81ed5c3ee59fce32bd7669fde21f3be356cf6bb - Sigstore transparency entry: 2082529466
- Sigstore integration time:
-
Permalink:
AndreaPallotta/qex@c3748d875524280feb411ff62d0344e43436a295 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/AndreaPallotta
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c3748d875524280feb411ff62d0344e43436a295 -
Trigger Event:
push
-
Statement type: