Skip to main content

Python SDK for the Quave quantum computing platform

Project description

Quave SDK

quave-sdk provides a Python interface to Quave's platform for executing quantum circuits, and retrieving results in hybrid quantum-classical workflows.

Installation

# For users
pip install quave-sdk

# For developers
pip install -e .

Usage

from qiskit import QuantumCircuit
from quave_sdk.quave import Quave

# --- 1. Authentication ---

# initialize a quave object using environment variable authentication
import os
email = os.getenv("EMAIL")
password = os.getenv("PASSWORD")
quave = Quave(email, password)

# or using command line inputs
quave = Quave()


# --- 2. View Backends ---

# see all available backends
backends = quave.list_backends()

# or for a specific QPU provider
backends = quave.list_backends("ibm")

# retrieve statistics for a specific backend
backend_stats = quave.get_backend_stats(backend_name="ibm_brisbane")


# --- 3. Simple Execution (No Parameters) ---

# build a simple circuit
qc = QuantumCircuit(1)
qc.h(0)
qc.t(0)
qc.measure_all()

# execute the circuit
job = quave.execute(circuit=qc, shots=10, backend="AerSimulator")

# check the status and retrieve counts
status = job.get_status()
if status == "COMPLETED":
    execution = job.get_executions()[0]
    counts = execution.get_counts()

# or wait for the job to be complete
asyncio.run(job.await_completion())
execution = job.get_executions()[0]
counts = execution.get_counts()

# --- 4. Batch Execution (Parameterized Circuit) ---

# define a simple parameterized circuit
theta = Parameter("θ")
qc = QuantumCircuit(1, 1)
qc.rx(theta, 0)
qc.measure(0, 0)

# define parameter values
from math import pi
params = [{"θ": x * pi/2} for x in range(5)]

# execute the job and await completion
job = quave.execute(circuit=qc, parameters=params, shots=10, backend="AerSimulator")
asyncio.run(job.await_completion())

# retrieve counts for each execution
executions = job.get_executions()
for x in executions:
    print(f"Counts for parameters {x.parameters}: {x.get_counts()}")


# --- 5. Iterative Execution ---

# define a function to generate new parameters from result counts
def update_parameters(counts):
    if counts.get("0", 0) > 0:
        return {"θ": pi}
    else:
        return {"θ": 0}

# execute the iterative workload
job = asyncio.run(quave.iterative_execute(
    circuit=qc, 
    parameter_update_fn=update_parameters, 
    initial_parameters={"θ": 0}, 
    num_iterations=3, 
    shots=10, 
    backend="AerSimulator"
))

# retrieve the counts for each iteration
executions = job.get_executions()
for x in executions:
    print(f"Counts for parameters {x.parameters}: {x.get_counts()}")

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

quave_sdk-0.1.2.tar.gz (381.0 kB view details)

Uploaded Source

Built Distribution

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

quave_sdk-0.1.2-cp313-cp313-macosx_10_13_universal2.whl (783.3 kB view details)

Uploaded CPython 3.13macOS 10.13+ universal2 (ARM64, x86-64)

File details

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

File metadata

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

File hashes

Hashes for quave_sdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 906104ab782dd37c853ff7923c5e8b36d0a5b53c9059ab6615f4e1571612d21b
MD5 44491a1b6cef3bef7f8a42f9a58fa5a2
BLAKE2b-256 ab4c48ad5ce442d45c3cf291211775ddf8bd1f73be01becf52079a0bc56ac9a2

See more details on using hashes here.

File details

Details for the file quave_sdk-0.1.2-cp313-cp313-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for quave_sdk-0.1.2-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 f0f038ee4030c223c919af3834943be645f08c87c082ddda9f740ccf223d43d8
MD5 34f6de7311c92180b4366f061bb3e368
BLAKE2b-256 edb63ee4d8f36f921d0c5eb312757904b9c286732e69acf19ccea9e40bf82bd4

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