Skip to main content

A lightweight experiment-runner and lab notebook for quantum computing

Project description

qex

qex logo

A lightweight experiment-runner and lab notebook for quantum computing, built on top of Cirq.

Overview

qex 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 qex import CirqBackend, Runner, ResultStore
from qex.demos import hadamard_experiment
from pathlib import Path

# Setup
backend = CirqBackend()
runner = Runner(backend)
store = ResultStore(Path("qex_data/qex.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

qex 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 parameter theta

Documentation

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


Download files

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

Source Distribution

qex-0.1.2.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

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

qex-0.1.2-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qex-0.1.2.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for qex-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e73a53db022e5b2256f2f3b02736ae70f4e92dc8dc36cf3b867e3015653fe43c
MD5 f43e328b257fed139d789a64f695dfce
BLAKE2b-256 8c8c3effcfd809757708a6cdfb529d215ea90d5294f9e9ffc6b9e974a4137166

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qex-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for qex-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9d94148394fac5febe68ab436d7f2d5663e0a23d3b81c44f74a658795706dd4f
MD5 359373d4a2d32c4b9703610da5b65651
BLAKE2b-256 ee502df5b67558cef026a715bfaef3133218877b708b2a7d93104a7dae2429f3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page