Skip to main content

qubit analysis client

Project description

QubitClient

介绍

QubitClient 是一个用于与Qubit服务进行交互的Python客户端库。它提供了丰富的API接口,支持多种量子计算相关的任务,包括曲线分割、参数拟合等功能。

功能特性

  • 曲线分割功能: 支持多项式(POLY)和余弦(COSINE)类型的曲线拟合
  • 多种任务支持: 包括S21峰值检测、最优π脉冲、Rabi振荡、T1/T2拟合等多种量子计算任务
  • 灵活的数据输入: 支持文件路径、NumPy数组、字典等多种数据格式作为输入
  • 批量处理: 支持同时处理多个数据文件
  • 易于集成: 提供简洁明了的API接口,方便快速集成到现有项目中

安装

pip install qubitclient

如果需要使用绘图等功能

pip install qubitclient[full]

或者从源码安装:

cd QubitClient
pip install -e .

快速开始

配置

  1. 拷贝配置文件模板:
cp config.py.example config.py
  1. 修改 config.py 文件中的服务器地址和API密钥:
API_URL = "http://your-server-address:port"
API_KEY = "your-api-key"

使用示例

NNScope功能(曲线分割)

from qubitclient import QubitNNScopeClient, NNTaskName, CurveType
import numpy as np

# 初始化客户端
client = QubitNNScopeClient(url="http://your-server-address:port", api_key="your-api-key")

# 方式1: 直接使用文件路径
file_path_list = ["data/file1.npz", "data/file2.npz"]
response = client.request(
    file_list=file_path_list,
    task_type=NNTaskName.SPECTRUM2D,
    curve_type=CurveType.COSINE
)

# 方式2: 使用NumPy数组字典
data_ndarray = np.load(file_path, allow_pickle=True)
dict_list = [data_ndarray]

response = client.request(
    file_list=dict_list,
    task_type=NNTaskName.SPECTRUM2D,
    curve_type=CurveType.POLY
)

# 获取结果
results = client.get_result(response=response)

Scope功能

from qubitclient import QubitScopeClient, TaskName
import numpy as np

# 初始化客户端
client = QubitScopeClient(url="http://your-server-address:port", api_key="your-api-key")

# 准备数据
dict_list = [{
    "some_key": np.ndarray(...)
}]

# 发起请求
response = client.request(
    file_list=dict_list,
    task_type=TaskName.OPTPIPULSE  # 可选任务见下方任务类型列表
)

# 获取结果
results = client.get_result(response=response)

支持的任务类型

NNScope任务

Scope任务

数据格式说明

输入格式

依据功能不同,输入格式有所不同

输出格式

依据功能任务不同,输出格式有所不同

运行测试示例

测试示例包含在 tests 目录下,可依据文件名运行对应的测试代码

# 运行NNScope测试
python tests/test_nnscope.py

# 运行Scope测试
python tests/test_scope.py

更新日志

近期更新:

  • 增加DRAG分析功能: 增加DRAG任务数据分析(20260205)
  • 增加scope功能包: 增加多种任务功能(20251022)
  • 增加曲线类型: 增加余弦类型曲线拟合(20250606)
  • 构建基础项目: 基础功能与结构构建

许可证

本项目采用GPL-3.0许可证,详见LICENSE文件。

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

qubitclient-0.2.9-py3-none-any.whl (133.5 kB view details)

Uploaded Python 3

File details

Details for the file qubitclient-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: qubitclient-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 133.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for qubitclient-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 31832d754f32f46ab3075280cca697d6dfe6dfd03e587593a8a23e91bf02f44b
MD5 f73a3637be92a09a83f1e62956ab2432
BLAKE2b-256 a4f327952fd801f9fab89ad9ece4e2b47cd89069b8f86801c367f04bb29ac76b

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