Skip to main content

qex

qex logo

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!

Download files

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

Source Distribution

qex-1.1.0.tar.gz (38.5 kB view details)

Uploaded Source

Built Distribution

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

qex-1.1.0-py3-none-any.whl (39.9 kB view details)

Uploaded Python 3

File details

Details for the file qex-1.1.0.tar.gz.

File metadata

  • Download URL: qex-1.1.0.tar.gz
  • Upload date:
  • Size: 38.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for qex-1.1.0.tar.gz
Algorithm Hash digest
SHA256 2dac1e410f30905aff6a115d7ffe4bd46dea6f71a0abf00f9855ea3ee1875edd
MD5 cee9e3c8600b0185ceab25085c248b7e
BLAKE2b-256 6c7d5dafae0cb4eddc82d61055a2e4de963b1573fa96a922c8f1bdd134cecaa3

See more details on using hashes here.

Provenance

The following attestation bundles were made for qex-1.1.0.tar.gz:

Publisher: publish.yml on AndreaPallotta/qex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qex-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: qex-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 39.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for qex-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9377875814fdb4c019d47d56478437c72cda7be29f8d48565f5cb29208fbb4b
MD5 59fed202b0b8ad2ffe558e751b29d912
BLAKE2b-256 b9b8b50b6b6488a9897cee82b27544cea203a7643e985f4964b4c39b3a0421e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for qex-1.1.0-py3-none-any.whl:

Publisher: publish.yml on AndreaPallotta/qex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 files

1.0.0

2 files

0.1.2

2 files

0.1.1

2 files

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