Skip to main content

九章光量子真机云接入软件包(jiuzhang SDK)

Project description

jiuzhang SDK - 九章光量子云平台 Python SDK

jiuzhang-sdk is the Python SDK for the JiuZhang photonic quantum cloud platform. It helps Python scripts and Jupyter notebooks submit Gaussian Boson Sampling (GBS) tasks, poll task status, and parse returned results.

SDK 只调用九章云平台 API,不直接调用天衍平台,也不在本地执行真实 GBS 物理仿真。

Installation / 安装

Current pre-release:

pip install --pre jiuzhang-sdk

Install a specific version:

pip install jiuzhang-sdk==0.1.0a18

Quickstart / 快速开始

Set your API Key before running:

export JIUZHANG_API_KEY="your-api-key-here"
export JIUZHANG_PROJECT_ID="EXP-39dfbfdcab444d32"
export JIUZHANG_QUANTUM_COMPUTER_ID="PH_QC_04"

PowerShell:

$env:JIUZHANG_API_KEY="your-api-key-here"
$env:JIUZHANG_PROJECT_ID="EXP-39dfbfdcab444d32"
$env:JIUZHANG_QUANTUM_COMPUTER_ID="PH_QC_04"

Python:

from jiuzhang import CloudClient, GBSParams

client = CloudClient.from_env()

params = GBSParams(
    project_id="EXP-39dfbfdcab444d32",
    quantum_computer_id="PH_QC_04",
    mt=300,
    pump_energy_nj=4.6,
    task_name="GBS experiment 001",
)

result = client.run_gbs(params)
print(result.task_id)
print(result.status_name)
print(result.quantum_computer_id)

client.close()

GBSParams / GBS 参数

GBSParams is the typed task configuration object.

from jiuzhang import GBSParams

params = GBSParams(
    project_id="EXP-39dfbfdcab444d32",
    quantum_computer_id="PH_QC_04",
    mt=300,
    pump_energy_nj=4.6,
    task_name="GBS experiment 001",
)
Field / 字段 Type / 类型 Required / 必填 Description / 说明
project_id str Yes Project experiment_code / 平台项目 experiment_code
quantum_computer_id str Yes Cloud quantum computer id / 云平台量子计算机 ID
mt int Yes Time-bin count, 1 <= mt <= 500 / 泵浦脉冲时序数
pump_energy_nj float Yes Pump energy in nJ / 泵浦能量
squeezing_param `float None` No
task_name str No Task display name / 任务展示名

params.to_cloud_payload() emits project_id, quantum_computer_id, task_name, mt_value, pump_energy_nj, and optional task fields.

GBSResult / GBS 结果

GBSResult parses the JiuZhang task wrapper and result fields.

Property / 属性 Description / 说明
task_id JiuZhang task id / 九章任务 ID
status_name Normalized status / 标准化状态
project_id Project id / 项目 ID
quantum_computer_id Cloud quantum computer id / 云平台量子计算机 ID
experimental_distribution Experimental curve / 实验分布曲线
ground_truth_distribution Ground-truth curve / 参考分布曲线
result_map_points All visualization curves / 全部分布验证曲线
raw Original response / 原始响应

Cloud API Contract / 云平台接口约定

SDK method / SDK 方法 HTTP endpoint / HTTP 接口
estimate_runtime(...) / estimate_gbs(params) POST /estimate
submit_task(...) / submit_gbs(params) POST /tasks/submit
get_result(task_id) GET /tasks/{task_id}
run_experiment(...) / run_gbs(params) estimate → submit → poll → parse

Authentication uses the X-Jiuzhang-API-Key header. The SDK checks the response code field and raises SDK exceptions for code != 0.

SDK 请求和返回结果都使用 quantum_computer_id,不再使用 device_idmachine_id

Jupyter / Notebook

Notebook helpers avoid printing the full API Key:

from jiuzhang.jupyter import display_gbs_result, get_notebook_client, show_environment

show_environment()
client = get_notebook_client()
result = client.run_gbs(params)
display_gbs_result(result)

Development / 开发测试

ruff format src tests
ruff check src tests
mypy src
pytest

License / 授权

Proprietary. Copyright 2026 JiuZhang Quantum. All rights reserved.

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

jiuzhang_sdk-0.1.0a19.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

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

jiuzhang_sdk-0.1.0a19-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

Details for the file jiuzhang_sdk-0.1.0a19.tar.gz.

File metadata

  • Download URL: jiuzhang_sdk-0.1.0a19.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for jiuzhang_sdk-0.1.0a19.tar.gz
Algorithm Hash digest
SHA256 46da1d7dea4285660bf84c8e921ae509075c50d8cc4aef9bbe0bd0ba84f03e28
MD5 5095f45116f0a0764a345d834a170f96
BLAKE2b-256 1e78365fc1eca2d7f41d60c2da32754709788364628e60ef2167ff5e91e2835e

See more details on using hashes here.

File details

Details for the file jiuzhang_sdk-0.1.0a19-py3-none-any.whl.

File metadata

File hashes

Hashes for jiuzhang_sdk-0.1.0a19-py3-none-any.whl
Algorithm Hash digest
SHA256 acfe0fd765ff5cd08e9602e5279e0f16a2fc7e4169c202baa264dda97861be0b
MD5 5147cceb8413664636d3255614ec2890
BLAKE2b-256 6de1d8c2251e25dec0c9ee89c35a5fb1985b50d51b514ab9c32d14a71c39049a

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