Skip to main content

Python modules for QubitOS quantum control kernel

Project description

QubitOS Core

CI License Python Architecture Phase Tests Coverage

Open-source real-time quantum control system: pulse optimization, calibration management, and hardware abstraction.

Why This Exists

Quantum processors drift. Gate fidelities measured during Tuesday's calibration are wrong by Thursday. Coherence times shift with temperature, TLS defects come and go, and crosstalk changes as you bring neighboring qubits online. So every serious quantum experiment starts the same way: recalibrate, re-optimize pulses, hope the hardware holds still long enough to run your circuit.

Most quantum software treats this as somebody else's problem. Qiskit and Cirq give you circuit-level abstractions and assume calibration data is accurate and static. But if you have actually tried to run a multi-qubit algorithm on real hardware, you know it is not. The gap between "my simulation says 99.9% fidelity" and "the QPU returned garbage" is almost always a calibration or pulse-level problem, and there is no open-source tool that closes that loop.

QubitOS is built to sit between your compiler output and the hardware. It takes circuit-level instructions, optimizes pulses against current calibration data (not last week's), and executes them through a hardware abstraction layer that talks to real backends. The control loop is designed to be fast enough for feedback-based protocols where you need microsecond-scale decisions.

This started because I kept running into the same problem across QubitPulseOpt, qco-integration, and the circuit optimizer: optimizing gates in isolation does not help if the hardware has drifted since calibration. QubitOS is the system that ties all of those pieces together.

Overview

QubitOS Core provides:

  • pulsegen - GRAPE/DRAG pulse optimization with Lindblad noise modeling (99.9% single-qubit fidelity)
  • calibrator - Live calibration tracking, drift detection, and automatic re-optimization triggers
  • client - gRPC client for the Rust Hardware Abstraction Layer
  • cli - Command-line interface for pulse generation, execution, and calibration management

Installation

# From PyPI (when available)
pip install qubitos

# From source
git clone https://github.com/qubit-os/qubit-os-core.git
cd qubit-os-core
pip install -e ".[dev]"

Quick Start

Generate an X-gate pulse

from qubitos.pulsegen import generate_pulse
from qubitos.client import HALClient

# Generate optimized pulse
pulse = generate_pulse(gate="X", duration_ns=20, target_fidelity=0.999)

# Execute on simulator
async with HALClient("localhost:50051") as client:
    result = await client.execute_pulse(
        i_envelope=pulse.i_envelope.tolist(),
        q_envelope=pulse.q_envelope.tolist(),
        duration_ns=20,
        target_qubits=[0],
        num_shots=1000,
    )
    print(f"Counts: {result.bitstring_counts}")
    if result.fidelity_estimate is not None:
        print(f"Fidelity: {result.fidelity_estimate:.4f}")

CLI Usage

# Generate a pulse
qubit-os pulse generate --gate X --duration 20 --output x_gate.json

# Execute a pulse
qubit-os pulse execute x_gate.json --shots 1000

# Check backend health
qubit-os hal health

# Show calibration
qubit-os calibration show

Architecture

qubitos/
├── client/         # HAL gRPC client
├── pulsegen/       # Pulse optimization (GRAPE, DRAG)
├── calibrator/     # Calibration management
├── validation/     # AgentBible integration
└── cli/            # Command-line interface

Configuration

QubitOS uses a configuration hierarchy (later overrides earlier):

  1. Built-in defaults
  2. Environment variables (QUBITOS_*)
  3. config.yaml
  4. CLI arguments
# Environment variables
export QUBITOS_HAL_HOST=localhost
export QUBITOS_HAL_PORT=50051
export QUBITOS_LOG_LEVEL=info

Development

Setup

# Clone and install
git clone https://github.com/qubit-os/qubit-os-core.git
cd qubit-os-core
pip install -e ".[dev]"

# Run tests
pytest tests/

# Type checking
mypy src/qubitos/

# Linting
ruff check src/
ruff format src/

Running Tests

# All tests
pytest

# With coverage
pytest --cov=qubitos --cov-report=html

# Specific module
pytest tests/unit/test_grape.py

# Integration tests (requires HAL running)
pytest tests/integration/

Documentation

License

Apache 2.0 - See LICENSE for details.

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

qubitos-0.2.0.tar.gz (434.9 kB view details)

Uploaded Source

Built Distribution

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

qubitos-0.2.0-py3-none-any.whl (137.9 kB view details)

Uploaded Python 3

File details

Details for the file qubitos-0.2.0.tar.gz.

File metadata

  • Download URL: qubitos-0.2.0.tar.gz
  • Upload date:
  • Size: 434.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for qubitos-0.2.0.tar.gz
Algorithm Hash digest
SHA256 57290202996ab6b5a2b3570819820a73a0506aaaaeaeac932f93dd695c1d5674
MD5 79278ae3c8602e18c5fb6604ec5a039e
BLAKE2b-256 1d9090a167c5ec8181ab5cf32f8ba83ff6b548b0235150dac7a605afe6d02094

See more details on using hashes here.

Provenance

The following attestation bundles were made for qubitos-0.2.0.tar.gz:

Publisher: release.yaml on qubit-os/qubit-os-core

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

File details

Details for the file qubitos-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: qubitos-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 137.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for qubitos-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0d0b4bc7760a4ed0e20f6f1217af9e8d648cf2332dc4d466c7bd5653e3b86d4
MD5 0f66d8092abed64753f082d47ae3ed38
BLAKE2b-256 872560d457b3a8052a94b0b7477bef897ec172682fe13e1fb88caa1d11861e99

See more details on using hashes here.

Provenance

The following attestation bundles were made for qubitos-0.2.0-py3-none-any.whl:

Publisher: release.yaml on qubit-os/qubit-os-core

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

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