qubitclient 0.1.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. qubitclient/__init__.py +5 -0
  2. qubitclient/draw/__init__.py +0 -0
  3. qubitclient/draw/optpipulsepltplotter.py +75 -0
  4. qubitclient/draw/optpipulseplyplotter.py +114 -0
  5. qubitclient/draw/pltmanager.py +50 -0
  6. qubitclient/draw/pltplotter.py +20 -0
  7. qubitclient/draw/plymanager.py +57 -0
  8. qubitclient/draw/plyplotter.py +21 -0
  9. qubitclient/draw/powershiftpltplotter.py +108 -0
  10. qubitclient/draw/powershiftplyplotter.py +194 -0
  11. qubitclient/draw/rabicospltplotter.py +74 -0
  12. qubitclient/draw/rabicosplyplotter.py +90 -0
  13. qubitclient/draw/rabipltplotter.py +66 -0
  14. qubitclient/draw/rabiplyplotter.py +86 -0
  15. qubitclient/draw/s21peakpltplotter.py +67 -0
  16. qubitclient/draw/s21peakplyplotter.py +124 -0
  17. qubitclient/draw/s21vfluxpltplotter.py +84 -0
  18. qubitclient/draw/s21vfluxplyplotter.py +163 -0
  19. qubitclient/draw/singleshotpltplotter.py +149 -0
  20. qubitclient/draw/singleshotplyplotter.py +324 -0
  21. qubitclient/draw/spectrum2dpltplotter.py +107 -0
  22. qubitclient/draw/spectrum2dplyplotter.py +244 -0
  23. qubitclient/draw/spectrum2dscopepltplotter.py +72 -0
  24. qubitclient/draw/spectrum2dscopeplyplotter.py +195 -0
  25. qubitclient/draw/spectrumpltplotter.py +106 -0
  26. qubitclient/draw/spectrumplyplotter.py +133 -0
  27. qubitclient/draw/t1fitpltplotter.py +76 -0
  28. qubitclient/draw/t1fitplyplotter.py +109 -0
  29. qubitclient/draw/t2fitpltplotter.py +70 -0
  30. qubitclient/draw/t2fitplyplotter.py +111 -0
  31. qubitclient/nnscope/nnscope.py +51 -0
  32. qubitclient/nnscope/nnscope_api/curve/__init__.py +0 -0
  33. qubitclient/nnscope/nnscope_api/curve/curve_type.py +15 -0
  34. qubitclient/nnscope/task.py +170 -0
  35. qubitclient/nnscope/utils/data_convert.py +114 -0
  36. qubitclient/nnscope/utils/data_parser.py +41 -0
  37. qubitclient/nnscope/utils/request_tool.py +41 -0
  38. qubitclient/nnscope/utils/result_parser.py +55 -0
  39. qubitclient/scope/scope.py +50 -0
  40. qubitclient/scope/scope_api/__init__.py +8 -0
  41. qubitclient/scope/scope_api/api/__init__.py +1 -0
  42. qubitclient/scope/scope_api/api/defined_tasks/__init__.py +1 -0
  43. qubitclient/scope/scope_api/api/defined_tasks/get_task_result_api_v1_tasks_demo_pk_get.py +155 -0
  44. qubitclient/scope/scope_api/api/defined_tasks/get_task_result_api_v1_tasks_scope_pk_get.py +155 -0
  45. qubitclient/scope/scope_api/api/defined_tasks/optpipulse_api_v1_tasks_scope_optpipulse_post.py +218 -0
  46. qubitclient/scope/scope_api/api/defined_tasks/powershift_api_v1_tasks_scope_powershift_post.py +218 -0
  47. qubitclient/scope/scope_api/api/defined_tasks/rabi_api_v1_tasks_scope_rabi_post.py +218 -0
  48. qubitclient/scope/scope_api/api/defined_tasks/rabicos_api_v1_tasks_scope_rabicospeak_post.py +218 -0
  49. qubitclient/scope/scope_api/api/defined_tasks/s21peak_api_v1_tasks_scope_s21peak_post.py +218 -0
  50. qubitclient/scope/scope_api/api/defined_tasks/s21vflux_api_v1_tasks_scope_s21vflux_post.py +218 -0
  51. qubitclient/scope/scope_api/api/defined_tasks/singleshot_api_v1_tasks_scope_singleshot_post.py +218 -0
  52. qubitclient/scope/scope_api/api/defined_tasks/spectrum2d_api_v1_tasks_scope_spectrum2d_post.py +218 -0
  53. qubitclient/scope/scope_api/api/defined_tasks/spectrum_api_v1_tasks_scope_spectrum_post.py +218 -0
  54. qubitclient/scope/scope_api/api/defined_tasks/t1fit_api_v1_tasks_scope_t1fit_post.py +218 -0
  55. qubitclient/scope/scope_api/api/defined_tasks/t1fit_api_v1_tasks_scope_t2fit_post.py +218 -0
  56. qubitclient/scope/scope_api/client.py +268 -0
  57. qubitclient/scope/scope_api/errors.py +16 -0
  58. qubitclient/scope/scope_api/models/__init__.py +31 -0
  59. qubitclient/scope/scope_api/models/body_optpipulse_api_v1_tasks_scope_optpipulse_post.py +83 -0
  60. qubitclient/scope/scope_api/models/body_powershift_api_v1_tasks_scope_powershift_post.py +83 -0
  61. qubitclient/scope/scope_api/models/body_rabi_api_v1_tasks_scope_rabi_post.py +83 -0
  62. qubitclient/scope/scope_api/models/body_rabicos_api_v1_tasks_scope_rabicospeak_post.py +83 -0
  63. qubitclient/scope/scope_api/models/body_s21_peak_api_v1_tasks_scope_s21_peak_post.py +83 -0
  64. qubitclient/scope/scope_api/models/body_s21_vflux_api_v1_tasks_scope_s21_vflux_post.py +83 -0
  65. qubitclient/scope/scope_api/models/body_singleshot_api_v1_tasks_scope_singleshot_post.py +83 -0
  66. qubitclient/scope/scope_api/models/body_spectrum_2d_api_v1_tasks_scope_spectrum_2d_post.py +83 -0
  67. qubitclient/scope/scope_api/models/body_spectrum_api_v1_tasks_scope_spectrum_post.py +83 -0
  68. qubitclient/scope/scope_api/models/body_t1_fit_api_v1_tasks_scope_t1_fit_post.py +83 -0
  69. qubitclient/scope/scope_api/models/body_t1_fit_api_v1_tasks_scope_t2_fit_post.py +83 -0
  70. qubitclient/scope/scope_api/models/http_validation_error.py +75 -0
  71. qubitclient/scope/scope_api/models/validation_error.py +88 -0
  72. qubitclient/scope/scope_api/types.py +54 -0
  73. qubitclient/scope/task.py +163 -0
  74. qubitclient/scope/utils/__init__.py +0 -0
  75. qubitclient/scope/utils/data_parser.py +20 -0
  76. qubitclient-0.1.4.dist-info/METADATA +173 -0
  77. qubitclient-0.1.4.dist-info/RECORD +81 -0
  78. qubitclient-0.1.4.dist-info/WHEEL +5 -0
  79. qubitclient-0.1.4.dist-info/licenses/LICENSE +674 -0
  80. qubitclient-0.1.4.dist-info/top_level.txt +1 -0
  81. qubitclient-0.1.4.dist-info/zip-safe +1 -0
@@ -0,0 +1,88 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar, Union, cast
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ T = TypeVar("T", bound="ValidationError")
8
+
9
+
10
+ @_attrs_define
11
+ class ValidationError:
12
+ """
13
+ Attributes:
14
+ loc (list[Union[int, str]]):
15
+ msg (str):
16
+ type_ (str):
17
+ """
18
+
19
+ loc: list[Union[int, str]]
20
+ msg: str
21
+ type_: str
22
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23
+
24
+ def to_dict(self) -> dict[str, Any]:
25
+ loc = []
26
+ for loc_item_data in self.loc:
27
+ loc_item: Union[int, str]
28
+ loc_item = loc_item_data
29
+ loc.append(loc_item)
30
+
31
+ msg = self.msg
32
+
33
+ type_ = self.type_
34
+
35
+ field_dict: dict[str, Any] = {}
36
+ field_dict.update(self.additional_properties)
37
+ field_dict.update(
38
+ {
39
+ "loc": loc,
40
+ "msg": msg,
41
+ "type": type_,
42
+ }
43
+ )
44
+
45
+ return field_dict
46
+
47
+ @classmethod
48
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
49
+ d = dict(src_dict)
50
+ loc = []
51
+ _loc = d.pop("loc")
52
+ for loc_item_data in _loc:
53
+
54
+ def _parse_loc_item(data: object) -> Union[int, str]:
55
+ return cast(Union[int, str], data)
56
+
57
+ loc_item = _parse_loc_item(loc_item_data)
58
+
59
+ loc.append(loc_item)
60
+
61
+ msg = d.pop("msg")
62
+
63
+ type_ = d.pop("type")
64
+
65
+ validation_error = cls(
66
+ loc=loc,
67
+ msg=msg,
68
+ type_=type_,
69
+ )
70
+
71
+ validation_error.additional_properties = d
72
+ return validation_error
73
+
74
+ @property
75
+ def additional_keys(self) -> list[str]:
76
+ return list(self.additional_properties.keys())
77
+
78
+ def __getitem__(self, key: str) -> Any:
79
+ return self.additional_properties[key]
80
+
81
+ def __setitem__(self, key: str, value: Any) -> None:
82
+ self.additional_properties[key] = value
83
+
84
+ def __delitem__(self, key: str) -> None:
85
+ del self.additional_properties[key]
86
+
87
+ def __contains__(self, key: str) -> bool:
88
+ return key in self.additional_properties
@@ -0,0 +1,54 @@
1
+ """Contains some shared types for properties"""
2
+
3
+ from collections.abc import Mapping, MutableMapping
4
+ from http import HTTPStatus
5
+ from typing import IO, BinaryIO, Generic, Literal, Optional, TypeVar, Union
6
+
7
+ from attrs import define
8
+
9
+
10
+ class Unset:
11
+ def __bool__(self) -> Literal[False]:
12
+ return False
13
+
14
+
15
+ UNSET: Unset = Unset()
16
+
17
+ # The types that `httpx.Client(files=)` can accept, copied from that library.
18
+ FileContent = Union[IO[bytes], bytes, str]
19
+ FileTypes = Union[
20
+ # (filename, file (or bytes), content_type)
21
+ tuple[Optional[str], FileContent, Optional[str]],
22
+ # (filename, file (or bytes), content_type, headers)
23
+ tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]],
24
+ ]
25
+ RequestFiles = list[tuple[str, FileTypes]]
26
+
27
+
28
+ @define
29
+ class File:
30
+ """Contains information for file uploads"""
31
+
32
+ payload: BinaryIO
33
+ file_name: Optional[str] = None
34
+ mime_type: Optional[str] = None
35
+
36
+ def to_tuple(self) -> FileTypes:
37
+ """Return a tuple representation that httpx will accept for multipart/form-data"""
38
+ return self.file_name, self.payload, self.mime_type
39
+
40
+
41
+ T = TypeVar("T")
42
+
43
+
44
+ @define
45
+ class Response(Generic[T]):
46
+ """A response from an endpoint"""
47
+
48
+ status_code: HTTPStatus
49
+ content: bytes
50
+ headers: MutableMapping[str, str]
51
+ parsed: Optional[T]
52
+
53
+
54
+ __all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"]
@@ -0,0 +1,163 @@
1
+
2
+
3
+ from .scope_api.api.defined_tasks import s21peak_api_v1_tasks_scope_s21peak_post
4
+ from .scope_api.api.defined_tasks import optpipulse_api_v1_tasks_scope_optpipulse_post
5
+ from .scope_api.api.defined_tasks import rabi_api_v1_tasks_scope_rabi_post
6
+ from .scope_api.api.defined_tasks import rabicos_api_v1_tasks_scope_rabicospeak_post
7
+ from .scope_api.api.defined_tasks import s21vflux_api_v1_tasks_scope_s21vflux_post
8
+ from .scope_api.api.defined_tasks import singleshot_api_v1_tasks_scope_singleshot_post
9
+ from .scope_api.api.defined_tasks import spectrum_api_v1_tasks_scope_spectrum_post
10
+ from .scope_api.api.defined_tasks import t1fit_api_v1_tasks_scope_t1fit_post
11
+ from .scope_api.api.defined_tasks import t1fit_api_v1_tasks_scope_t2fit_post
12
+ from .scope_api.api.defined_tasks import spectrum2d_api_v1_tasks_scope_spectrum2d_post
13
+ from .scope_api.api.defined_tasks import powershift_api_v1_tasks_scope_powershift_post
14
+
15
+
16
+ from .scope_api.models import BodyS21PeakApiV1TasksScopeS21PeakPost
17
+ from .scope_api.models import BodyOptpipulseApiV1TasksScopeOptpipulsePost
18
+ from .scope_api.models import BodyRabiApiV1TasksScopeRabiPost
19
+ from .scope_api.models import BodyRabicosApiV1TasksScopeRabicospeakPost
20
+ from .scope_api.models import BodyS21VfluxApiV1TasksScopeS21VfluxPost
21
+ from .scope_api.models import BodySingleshotApiV1TasksScopeSingleshotPost
22
+ from .scope_api.models import BodySpectrumApiV1TasksScopeSpectrumPost
23
+ from .scope_api.models import BodyT1FitApiV1TasksScopeT1FitPost
24
+ from .scope_api.models import BodyT1FitApiV1TasksScopeT2FitPost
25
+ from .scope_api.models import BodySpectrum2DApiV1TasksScopeSpectrum2DPost
26
+ from .scope_api.models import BodyPowershiftApiV1TasksScopePowershiftPost
27
+
28
+
29
+ from .scope_api.types import Response
30
+ from .scope_api.types import File
31
+
32
+ import io
33
+ import numpy as np
34
+ def load_from_dict(dict_list: list[dict]):
35
+ files = []
36
+ for index, dict_obj in enumerate(dict_list):
37
+ with io.BytesIO() as buffer:
38
+ np.savez(buffer, **dict_obj)
39
+ bytes_obj = buffer.getvalue()
40
+ # 假设File类定义如下:
41
+ # File(payload=bytes内容, file_name=字符串)
42
+ files.append(File(payload=bytes_obj, file_name=f"file_{index}.npz"))
43
+ return files
44
+
45
+ def load_from_ndarray(ndarray_list: list[np.ndarray]):
46
+ files = []
47
+ for idx, ndarray_data in enumerate(ndarray_list):
48
+ buffer = io.BytesIO()
49
+ np.save(buffer, ndarray_data)
50
+ buffer.seek(0)
51
+ files.append(File(payload=buffer.read(), file_name=f"file_{idx}.npy"))
52
+ return files
53
+
54
+ def load_from_path(filepath_list: list[str]):
55
+ files = []
56
+ for file_path in filepath_list:
57
+ with open(file_path, "rb") as f:
58
+ file_content = f.read()
59
+ files.append(File(payload=file_content, file_name=file_path))
60
+ return files
61
+ def load_files(filepath_list: list[str|dict[str,np.ndarray]|np.ndarray]):
62
+ if len(filepath_list)<=0:
63
+ return []
64
+ else:
65
+ if isinstance(filepath_list[0], dict):
66
+ return load_from_dict(filepath_list)
67
+ elif isinstance(filepath_list[0], np.ndarray):
68
+ return load_from_ndarray(filepath_list)
69
+ elif isinstance(filepath_list[0], str):
70
+ return load_from_path(filepath_list)
71
+
72
+ DEFINED_TASKS = {}
73
+ def task_register(func):
74
+ DEFINED_TASKS[func.__name__.lower()] = func
75
+ return func
76
+
77
+ def run_task(client,file_list: list[str|dict[str,np.ndarray]|np.ndarray],task_type:str):
78
+ files = load_files(file_list)
79
+ response = DEFINED_TASKS[task_type.value](client,files)
80
+ return response
81
+
82
+
83
+ @task_register
84
+ def s21peak(client,files: File):
85
+ body: BodyS21PeakApiV1TasksScopeS21PeakPost = BodyS21PeakApiV1TasksScopeS21PeakPost(files=files)
86
+ response: Response[BodyS21PeakApiV1TasksScopeS21PeakPost] = s21peak_api_v1_tasks_scope_s21peak_post.sync_detailed(client=client,body=body)
87
+ return response
88
+ @task_register
89
+ def optpipulse(client,files: File):
90
+ body: BodyOptpipulseApiV1TasksScopeOptpipulsePost = BodyOptpipulseApiV1TasksScopeOptpipulsePost(files=files)
91
+ response: Response[BodyOptpipulseApiV1TasksScopeOptpipulsePost] = optpipulse_api_v1_tasks_scope_optpipulse_post.sync_detailed(client=client,body=body)
92
+ return response
93
+ @task_register
94
+ def rabi(client,files: File):
95
+ body: BodyRabiApiV1TasksScopeRabiPost = BodyRabiApiV1TasksScopeRabiPost(files=files)
96
+ response: Response[BodyRabiApiV1TasksScopeRabiPost] = rabi_api_v1_tasks_scope_rabi_post.sync_detailed(client=client,body=body)
97
+ return response
98
+ @task_register
99
+ def ramsy(client,files: File):
100
+ body: BodyRabiApiV1TasksScopeRabiPost = BodyRabiApiV1TasksScopeRabiPost(files=files)
101
+ response: Response[BodyRabiApiV1TasksScopeRabiPost] = rabi_api_v1_tasks_scope_rabi_post.sync_detailed(client=client,body=body)
102
+ return response
103
+ @task_register
104
+ def rabicos(client,files: File):
105
+ body: BodyRabicosApiV1TasksScopeRabicospeakPost = BodyRabicosApiV1TasksScopeRabicospeakPost(files=files)
106
+ response: Response[BodyRabicosApiV1TasksScopeRabicospeakPost] = rabicos_api_v1_tasks_scope_rabicospeak_post.sync_detailed(client=client,body=body)
107
+ return response
108
+ @task_register
109
+ def s21vflux(client,files: File):
110
+ body: BodyS21VfluxApiV1TasksScopeS21VfluxPost = BodyS21VfluxApiV1TasksScopeS21VfluxPost(files=files)
111
+ response: Response[BodyS21VfluxApiV1TasksScopeS21VfluxPost] = s21vflux_api_v1_tasks_scope_s21vflux_post.sync_detailed(client=client,body=body)
112
+ return response
113
+ @task_register
114
+ def singleshot(client,files: File):
115
+ body: BodySingleshotApiV1TasksScopeSingleshotPost = BodySingleshotApiV1TasksScopeSingleshotPost(files=files)
116
+ response: Response[BodySingleshotApiV1TasksScopeSingleshotPost] = singleshot_api_v1_tasks_scope_singleshot_post.sync_detailed(client=client,body=body)
117
+ return response
118
+ @task_register
119
+ def spectrum(client,files: File):
120
+ body: BodySpectrumApiV1TasksScopeSpectrumPost = BodySpectrumApiV1TasksScopeSpectrumPost(files=files)
121
+ response: Response[BodySpectrumApiV1TasksScopeSpectrumPost] = spectrum_api_v1_tasks_scope_spectrum_post.sync_detailed(client=client,body=body)
122
+ return response
123
+ @task_register
124
+ def t1fit(client,files: File):
125
+ body: BodyT1FitApiV1TasksScopeT1FitPost = BodyT1FitApiV1TasksScopeT1FitPost(files=files)
126
+ response: Response[BodyT1FitApiV1TasksScopeT1FitPost] = t1fit_api_v1_tasks_scope_t1fit_post.sync_detailed(client=client,body=body)
127
+ return response
128
+ @task_register
129
+ def t2fit(client,files: File):
130
+ body: BodyT1FitApiV1TasksScopeT2FitPost = BodyT1FitApiV1TasksScopeT2FitPost(files=files)
131
+ response: Response[BodyT1FitApiV1TasksScopeT2FitPost] = t1fit_api_v1_tasks_scope_t2fit_post.sync_detailed(client=client,body=body)
132
+ return response
133
+
134
+ @task_register
135
+ def spectrum2dscope(client,files: File):
136
+ body: BodySpectrum2DApiV1TasksScopeSpectrum2DPost = BodySpectrum2DApiV1TasksScopeSpectrum2DPost(files=files)
137
+ response: Response[BodySpectrum2DApiV1TasksScopeSpectrum2DPost] = spectrum2d_api_v1_tasks_scope_spectrum2d_post.sync_detailed(client=client,body=body)
138
+ return response
139
+ @task_register
140
+ def powershift(client,files: File):
141
+ body: BodyPowershiftApiV1TasksScopePowershiftPost = BodyPowershiftApiV1TasksScopePowershiftPost(files=files)
142
+ response: Response[BodyPowershiftApiV1TasksScopePowershiftPost] = powershift_api_v1_tasks_scope_powershift_post.sync_detailed(client=client,body=body)
143
+ return response
144
+
145
+ from enum import Enum, unique
146
+ @unique
147
+ class TaskName(Enum):
148
+ S21PEAK = "s21peak"
149
+ OPTPIPULSE = "optpipulse"
150
+ RABI = "rabi"
151
+ RAMSY = "ramsy"
152
+ RABICOS = "rabicos"
153
+ S21VFLUX = "s21vflux"
154
+ SINGLESHOT = "singleshot"
155
+ SPECTRUM = "spectrum"
156
+ T1FIT = "t1fit"
157
+ T2FIT = "t2fit"
158
+ SPECTRUM2DSCOPE = "spectrum2dscope"
159
+ POWERSHIFT = "powershift"
160
+
161
+
162
+
163
+
File without changes
@@ -0,0 +1,20 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2025 yaqiang.sun.
3
+ # This source code is licensed under the license found in the LICENSE file
4
+ # in the root directory of this source tree.
5
+ #########################################################################
6
+ # Author: yaqiangsun
7
+ # Created Time: 2025/04/11 17:58:29
8
+ ########################################################################
9
+
10
+ import os
11
+ import numpy as np
12
+ import cv2
13
+
14
+
15
+ def load_npy_file(file_path):
16
+ try:
17
+ array = np.load(file_path, allow_pickle=True)
18
+ return array
19
+ except Exception as e:
20
+ raise ValueError(f"加载文件 {file_path} 时出错: {str(e)}")
@@ -0,0 +1,173 @@
1
+ Metadata-Version: 2.4
2
+ Name: qubitclient
3
+ Version: 0.1.4
4
+ Summary: qubit analysis client
5
+ Home-page: https://github.com/yaqiangsun/QubitClient
6
+ Author: Yaqiang Sun
7
+ Author-email: Yaqiang Sun <sunyaking@163.com>
8
+ License: GPL-3.0
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: attrs>=25.4.0
13
+ Requires-Dist: httpx>=0.28.1
14
+ Requires-Dist: matplotlib>=3.10.7
15
+ Requires-Dist: opencv-python>=4.12.0.88
16
+ Requires-Dist: opencv-python-headless>=4.12.0.88
17
+ Requires-Dist: plotly>=6.4.0
18
+ Requires-Dist: requests>=2.32.5
19
+ Requires-Dist: scipy>=1.15.3
20
+ Dynamic: author
21
+ Dynamic: home-page
22
+ Dynamic: license-file
23
+ Dynamic: requires-python
24
+
25
+ # QubitClient
26
+
27
+ ## 介绍
28
+
29
+ **QubitClient** 是一个用于与Qubit服务进行交互的Python客户端库。它提供了丰富的API接口,支持多种量子计算相关的任务,包括曲线分割、参数拟合等功能。
30
+
31
+ ## 功能特性
32
+
33
+ - **曲线分割功能**: 支持多项式(POLY)和余弦(COSINE)类型的曲线拟合
34
+ - **多种任务支持**: 包括S21峰值检测、最优π脉冲、Rabi振荡、T1/T2拟合等多种量子计算任务
35
+ - **灵活的数据输入**: 支持文件路径、NumPy数组、字典等多种数据格式作为输入
36
+ - **批量处理**: 支持同时处理多个数据文件
37
+ - **易于集成**: 提供简洁明了的API接口,方便快速集成到现有项目中
38
+
39
+ ## 安装
40
+
41
+ ```bash
42
+ pip install qubitclient
43
+ ```
44
+
45
+ 或者从源码安装:
46
+
47
+ ```bash
48
+ cd QubitClient
49
+ pip install -e .
50
+ ```
51
+
52
+ ## 快速开始
53
+
54
+ ### 配置
55
+
56
+ 1. 拷贝配置文件模板:
57
+ ```bash
58
+ cp config.py.example config.py
59
+ ```
60
+
61
+ 2. 修改 [config.py]() 文件中的服务器地址和API密钥:
62
+ ```python
63
+ API_URL = "http://your-server-address:port"
64
+ API_KEY = "your-api-key"
65
+ ```
66
+
67
+ ### 使用示例
68
+ #### NNScope功能(曲线分割)
69
+
70
+ ```python
71
+ from qubitclient import QubitNNScopeClient, NNTaskName, CurveType
72
+ import numpy as np
73
+
74
+ # 初始化客户端
75
+ client = QubitNNScopeClient(url="http://your-server-address:port", api_key="your-api-key")
76
+
77
+ # 方式1: 直接使用文件路径
78
+ file_path_list = ["data/file1.npz", "data/file2.npz"]
79
+ response = client.request(
80
+ file_list=file_path_list,
81
+ task_type=NNTaskName.SPECTRUM2D,
82
+ curve_type=CurveType.COSINE
83
+ )
84
+
85
+ # 方式2: 使用NumPy数组字典
86
+ data_ndarray = np.load(file_path, allow_pickle=True)
87
+ dict_list = [data_ndarray]
88
+
89
+ response = client.request(
90
+ file_list=dict_list,
91
+ task_type=NNTaskName.SPECTRUM2D,
92
+ curve_type=CurveType.POLY
93
+ )
94
+
95
+ # 获取结果
96
+ results = client.get_result(response=response)
97
+ ```
98
+
99
+ #### Scope功能
100
+
101
+ ```python
102
+ from qubitclient import QubitScopeClient, TaskName
103
+ import numpy as np
104
+
105
+ # 初始化客户端
106
+ client = QubitScopeClient(url="http://your-server-address:port", api_key="your-api-key")
107
+
108
+ # 准备数据
109
+ dict_list = [{
110
+ "some_key": np.ndarray(...)
111
+ }]
112
+
113
+ # 发起请求
114
+ response = client.request(
115
+ file_list=dict_list,
116
+ task_type=TaskName.OPTPIPULSE # 可选任务见下方任务类型列表
117
+ )
118
+
119
+ # 获取结果
120
+ results = client.get_result(response=response)
121
+ ```
122
+
123
+ ## 支持的任务类型
124
+
125
+ ### NNScope任务
126
+
127
+ - `NNTaskName.SPECTRUM2D`: 二维频谱数据曲线分割,详见 [SPECTRUM2D详细文档](docs/SPECTRUM2D.md)
128
+
129
+ ### Scope任务
130
+
131
+ - `TaskName.S21PEAK`: S21参数峰值检测,详见 [S21PEAK详细文档](docs/S21PEAK.md)
132
+ - `TaskName.OPTPIPULSE`: 最优π脉冲计算,详见 [OPTPIPULSE详细文档](docs/OPTPIPULSE.md)
133
+ - `TaskName.RABI`: Rabi振荡分析,详见 [RABI详细文档](docs/RABI.md)
134
+ - `TaskName.RABICOS`: Rabi振荡余弦拟合,详见 [RABICOS详细文档](docs/RABICOS.md)
135
+ - `TaskName.RAMSY`: RAMSY衰减震荡余弦拟合,详见 [RABICOS详细文档](docs/RABICOS.md)
136
+ - `TaskName.S21VFLUX`: S21 vs Flux分析,详见 [S21VFLUX详细文档](docs/S21VFLUX.md)
137
+ - `TaskName.SINGLESHOT`: 单次测量分析,详见 [SINGLESHOT详细文档](docs/SINGLESHOT.md)
138
+ - `TaskName.SPECTRUM`: 频谱分析,详见 [SPECTRUM详细文档](docs/SPECTRUM.md)
139
+ - `TaskName.T1FIT`: T1时间拟合,详见 [T1FIT详细文档](docs/T1FIT.md)
140
+ - `TaskName.T2FIT`: T2时间拟合,详见 [T2FIT详细文档](docs/T2FIT.md)
141
+ - `TaskName.POWERSHIFT`: 分析功率偏移曲线,详见 [POWERSHIFT详细文档](docs/POWERSHIFT.md)
142
+
143
+ ## 数据格式说明
144
+
145
+ ### 输入格式
146
+
147
+ 依据功能不同,输入格式有所不同
148
+
149
+ ### 输出格式
150
+
151
+ 依据功能任务不同,输出格式有所不同
152
+
153
+ ## 运行测试示例
154
+
155
+ ```bash
156
+ # 运行NNScope测试
157
+ python tests/test_nnscope.py
158
+
159
+ # 运行Scope测试
160
+ python tests/test_scope.py
161
+ ```
162
+
163
+ ## 更新日志
164
+
165
+ 近期更新:
166
+
167
+ - **增加scope功能包**: 增加多种任务功能(20251022)
168
+ - **增加曲线类型**: 增加余弦类型曲线拟合(20250606)
169
+ - **构建基础项目**: 基础功能与结构构建
170
+
171
+ ## 许可证
172
+
173
+ 本项目采用GPL-3.0许可证,详见[LICENSE](LICENSE)文件。
@@ -0,0 +1,81 @@
1
+ qubitclient/__init__.py,sha256=tCSVsemgfFU-f9mqPykgHJ6PqGzmuabB3ivJIjGuLyI,233
2
+ qubitclient/draw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ qubitclient/draw/optpipulsepltplotter.py,sha256=WWSmotG7zIZwboch9RgL1F7L0g7mMpmqIRG_sehsUqo,2985
4
+ qubitclient/draw/optpipulseplyplotter.py,sha256=Q0T5GNal3KUjeRIj5_JTxw1iAKtLVXwOeZ83xzxa-mU,4412
5
+ qubitclient/draw/pltmanager.py,sha256=SWLWq7DcffT2APegDYrUiLaYVfIJ2tFVowcdUbR0yKo,2319
6
+ qubitclient/draw/pltplotter.py,sha256=oZ7yZY_3-__P4uXvMuyrmESNjqOHNJaMpNqaPAkOtPU,550
7
+ qubitclient/draw/plymanager.py,sha256=FKi8tlKctB_ACOr7WBZvT_t1AhsG3KAZJ9qDewF-9m8,2329
8
+ qubitclient/draw/plyplotter.py,sha256=7sYkPQLdG_oO1wiMKJRcpXgzt4E0L8o5ZjoHn63WEf0,568
9
+ qubitclient/draw/powershiftpltplotter.py,sha256=Y9YE_Wwr_rYPO77UEhLvata3Z1o3dy9kA6ikHPw_Pm0,4124
10
+ qubitclient/draw/powershiftplyplotter.py,sha256=FfSFm6UBL7dFI1ID9wcS8aX6xfYxzUpXDWTEC1IV58k,7400
11
+ qubitclient/draw/rabicospltplotter.py,sha256=ahztgx_vZFZXYj0ORNW4GuFacRw5nVej_XZ6PiJ1jDU,3037
12
+ qubitclient/draw/rabicosplyplotter.py,sha256=aBBgtA9Al11pxrNu7TZIHqd0oywYb7DbVpRZNo1hfMA,3269
13
+ qubitclient/draw/rabipltplotter.py,sha256=QdSNgnViPjI_5ql8iH_eNy_hf7_4f8GQ-w6T2hsEvrs,2632
14
+ qubitclient/draw/rabiplyplotter.py,sha256=qa_nCMR4PAWPxM_RWI3zflk3VW3Ui6uwMiepr0keBbQ,3526
15
+ qubitclient/draw/s21peakpltplotter.py,sha256=1X5PlLKSFM44OzUUO3hW4-4oh3OB-D3XjMF6NnzXBvI,2205
16
+ qubitclient/draw/s21peakplyplotter.py,sha256=su9tCkPCvAKnRqTJleSSSd8Alc4-CPVSqVkuPAFM-Lw,3868
17
+ qubitclient/draw/s21vfluxpltplotter.py,sha256=TGU7s0hxRuKUG1ihg1_aIVWIdkvOJEjdJBLSNJp0tdQ,3086
18
+ qubitclient/draw/s21vfluxplyplotter.py,sha256=XPcWgNhqn_fZ_DgmnumULdPh3trg19AYg3YSyvfxmdM,5948
19
+ qubitclient/draw/singleshotpltplotter.py,sha256=JMMl31NGFB_5JK424IS0EYPmKl5RUQTsWR8VIEWNtMY,6072
20
+ qubitclient/draw/singleshotplyplotter.py,sha256=LxTzi_SnzbHM6h0TV905i087QDMYsGqWn6tDcEeP0Pw,10770
21
+ qubitclient/draw/spectrum2dpltplotter.py,sha256=dZbb38--KQ3DMI-lCPkSEBQ0FQd1tTrPadD1yQ2eJIg,4287
22
+ qubitclient/draw/spectrum2dplyplotter.py,sha256=o_Xgs4eAVJT0ns4ojtDcyUHqOhegWrNt1VC6YmdkJp4,8282
23
+ qubitclient/draw/spectrum2dscopepltplotter.py,sha256=Rl9oHHPjsZbCU4sslWYv60yoIZNW8wf7F6ZWVC-0A8o,2818
24
+ qubitclient/draw/spectrum2dscopeplyplotter.py,sha256=PduzuM3FJzdIRh9EKoTwiQROUXqILCntGO3Lz6WUUm8,7389
25
+ qubitclient/draw/spectrumpltplotter.py,sha256=lo--7_guUAWx3cPikDH2mwyUbCbyHvg-XL2TOZE_lN4,4158
26
+ qubitclient/draw/spectrumplyplotter.py,sha256=vs_SzOD3iOCzddqmjmu2chQ_1g90WXwUdzgN5SVTowA,4690
27
+ qubitclient/draw/t1fitpltplotter.py,sha256=GY9cpNrs_0XN9IJneHdt8b0mwh2X32MoAPRmq-mdnb4,2850
28
+ qubitclient/draw/t1fitplyplotter.py,sha256=aAiA1wTYYa6wmHNIoWk1Uh9YgkiYlWaa2aFY27HtWnI,3911
29
+ qubitclient/draw/t2fitpltplotter.py,sha256=-xud2jS9-cH5LcWecQAXabHvA2IGi4rUEiMFFOm9qhI,2795
30
+ qubitclient/draw/t2fitplyplotter.py,sha256=xnTqyM0IDekGmL-Eut99Z2sO7ZZPLXaHgvYKY5_scgA,4024
31
+ qubitclient/nnscope/nnscope.py,sha256=AuvJSb8HY3uzUJ14go16_5Y8jeyytGFJR8qi3KCP6Dk,1684
32
+ qubitclient/nnscope/task.py,sha256=CWUnkzXXUHoHAwjCoTpR3li1dT3XY04R6SorAEkvZhA,6381
33
+ qubitclient/nnscope/nnscope_api/curve/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
+ qubitclient/nnscope/nnscope_api/curve/curve_type.py,sha256=Qi1vTjzK6eJWMpaT9QkJtSM9486fEp4Sd27hAHi1LnM,473
35
+ qubitclient/nnscope/utils/data_convert.py,sha256=YdvRneYGNVy_Yetpw_9xfu2CSMW3pXLu-X2e6owuGgs,4295
36
+ qubitclient/nnscope/utils/data_parser.py,sha256=2CnrVTRhrg67nrei8wthNhakzUjIBwUh5gJJv6vpg_U,1280
37
+ qubitclient/nnscope/utils/request_tool.py,sha256=SToOpaOJ0GKH0YK428t9s7fReAC9Piae18sJngxctxo,1694
38
+ qubitclient/nnscope/utils/result_parser.py,sha256=5ymB5JSlU1-mqQ3U4fZBGDQdF3CH7NEp4IMt6rDj2uM,2039
39
+ qubitclient/scope/scope.py,sha256=mqPAu1dhNUwxRbP6vJ_uF5-oG7TuxRo9MaG9Djjymok,1679
40
+ qubitclient/scope/task.py,sha256=eZcSbuiU2a9cXKdTf6d52dysacO1U6uBCDSBJHPS_8c,7721
41
+ qubitclient/scope/scope_api/__init__.py,sha256=qUheje2C4lZ8b26EUHXHRJ3dWuzKiExv_JVOdVCFAek,150
42
+ qubitclient/scope/scope_api/client.py,sha256=o_mdLqyBCQstu5tS1WZFwqIEbGwkvWQ7eQjuCJw_5VY,12419
43
+ qubitclient/scope/scope_api/errors.py,sha256=gO8GBmKqmSNgAg-E5oT-oOyxztvp7V_6XG7OUTT15q0,546
44
+ qubitclient/scope/scope_api/types.py,sha256=AX4orxQZQJat3vZrgjJ-TYb2sNBL8kNo9yqYDT-n8y8,1391
45
+ qubitclient/scope/scope_api/api/__init__.py,sha256=zTSiG_ujSjAqWPyc435YXaX9XTlpMjiJWBbV-f-YtdA,45
46
+ qubitclient/scope/scope_api/api/defined_tasks/__init__.py,sha256=5vd9uJWAjRqa9xzxzYkLD1yoZ12Ld_bAaNB5WX4fbE8,56
47
+ qubitclient/scope/scope_api/api/defined_tasks/get_task_result_api_v1_tasks_demo_pk_get.py,sha256=mWzJoBh2EmCF-iX4jTlN5msvI6L3CzLixel2S-vu_Qc,3908
48
+ qubitclient/scope/scope_api/api/defined_tasks/get_task_result_api_v1_tasks_scope_pk_get.py,sha256=6SqRkNWS631gZ_zSuhRVfzQQSqab8S4vBNdgxQCpE0A,3909
49
+ qubitclient/scope/scope_api/api/defined_tasks/optpipulse_api_v1_tasks_scope_optpipulse_post.py,sha256=LBZvC5WH7qosti6CodqI5l_7ka9kOu_zKwOjfJEDWQE,6062
50
+ qubitclient/scope/scope_api/api/defined_tasks/powershift_api_v1_tasks_scope_powershift_post.py,sha256=yC6tUQhQlWqWc2ajrcBzgCbhG09THdV_bjahgtGV6hE,5922
51
+ qubitclient/scope/scope_api/api/defined_tasks/rabi_api_v1_tasks_scope_rabi_post.py,sha256=OjJPbwk8wzaBQH5pKdBXu1lu77C9YRTI6u88kyA8Rgk,5686
52
+ qubitclient/scope/scope_api/api/defined_tasks/rabicos_api_v1_tasks_scope_rabicospeak_post.py,sha256=VRZQAQVloC1E066bpFlp3VOndU84WyV4e-TxrPlxgPI,5926
53
+ qubitclient/scope/scope_api/api/defined_tasks/s21peak_api_v1_tasks_scope_s21peak_post.py,sha256=1tajlqSAPJ0Z9JrK9iFvf9hW_-lXmwyrNt8BmyOs4g0,5848
54
+ qubitclient/scope/scope_api/api/defined_tasks/s21vflux_api_v1_tasks_scope_s21vflux_post.py,sha256=hHGS24N_2ZGQlsW4XFnVuN5asje3Z6Hh9rdScKmPdKQ,5940
55
+ qubitclient/scope/scope_api/api/defined_tasks/singleshot_api_v1_tasks_scope_singleshot_post.py,sha256=SZz6OuGsLQMHdT-anFPMcUcEAc99rRhzSB5QX0VAk1k,5942
56
+ qubitclient/scope/scope_api/api/defined_tasks/spectrum2d_api_v1_tasks_scope_spectrum2d_post.py,sha256=Ku2yJA1W9M3ybQGZ4WgGjDfX-qh4QyVizEwLGHj4uFk,5924
57
+ qubitclient/scope/scope_api/api/defined_tasks/spectrum_api_v1_tasks_scope_spectrum_post.py,sha256=f2vjj-xjWVachjXRb7vtWBXItII0ECWVs-dHIeqDJlU,5914
58
+ qubitclient/scope/scope_api/api/defined_tasks/t1fit_api_v1_tasks_scope_t1fit_post.py,sha256=yC5nJh4vmNvx4CLOoFAHj2pai4pLlSlJov6gz3mkOhM,5716
59
+ qubitclient/scope/scope_api/api/defined_tasks/t1fit_api_v1_tasks_scope_t2fit_post.py,sha256=SRbaUDoR5b0nA12ix0RTGapiybnoq5c1MJ48wFIydFg,5716
60
+ qubitclient/scope/scope_api/models/__init__.py,sha256=KlunE291YrMKjgA720FHQlVuJG5dpSzHe1JSWzIYvVI,1840
61
+ qubitclient/scope/scope_api/models/body_optpipulse_api_v1_tasks_scope_optpipulse_post.py,sha256=jA4fcZ7KwhH7L74kvoxFkmqTPcAqBZA2WQglJAYrrtk,2369
62
+ qubitclient/scope/scope_api/models/body_powershift_api_v1_tasks_scope_powershift_post.py,sha256=rHZ0LxPOkh4T46W58IojdWTVo1XUv_homQe-NU_emfk,2369
63
+ qubitclient/scope/scope_api/models/body_rabi_api_v1_tasks_scope_rabi_post.py,sha256=zWGZyxNpb7KYquXYEylGeSVFJLiiR2jM03bJBbMRMRw,2309
64
+ qubitclient/scope/scope_api/models/body_rabicos_api_v1_tasks_scope_rabicospeak_post.py,sha256=tUaq3bDWVWQafVN7hPsIjjDWpfqtl3V2fnJEpos5TZw,2359
65
+ qubitclient/scope/scope_api/models/body_s21_peak_api_v1_tasks_scope_s21_peak_post.py,sha256=K4_hwbLYw6Fqn7OVF_VFzhl6WWF702PDsb4iMZ_yPqM,2345
66
+ qubitclient/scope/scope_api/models/body_s21_vflux_api_v1_tasks_scope_s21_vflux_post.py,sha256=i3Z7BD2T0-7eoNNH_LVOHBosyYW3ZBQvjtRPm7GaYKE,2355
67
+ qubitclient/scope/scope_api/models/body_singleshot_api_v1_tasks_scope_singleshot_post.py,sha256=iso7Wrq6EERyGzHnEvScZ7sBzgNNb_mLEeB1yqVSgQA,2369
68
+ qubitclient/scope/scope_api/models/body_spectrum_2d_api_v1_tasks_scope_spectrum_2d_post.py,sha256=e8aQqZdvwd7zZk1BmQMzjfMlznz-os41KYr9la0_5g4,2375
69
+ qubitclient/scope/scope_api/models/body_spectrum_api_v1_tasks_scope_spectrum_post.py,sha256=xCKF1NeRs0FgPstiku6qyT_w0IxBI8Xc5BdLo8E4sfg,2349
70
+ qubitclient/scope/scope_api/models/body_t1_fit_api_v1_tasks_scope_t1_fit_post.py,sha256=_dMiMzrEkUPA1lY1sMqN7tMC2FkFFffRovh72LPPYIE,2325
71
+ qubitclient/scope/scope_api/models/body_t1_fit_api_v1_tasks_scope_t2_fit_post.py,sha256=wURlSeo12Yr8kX1SPN71bnLjZw2SUFAsDVUS38n3Vw0,2325
72
+ qubitclient/scope/scope_api/models/http_validation_error.py,sha256=OvQ-alRPbtXXwrQunI1Cp1-BWf7ZkVHkigk-YVMFXN0,2213
73
+ qubitclient/scope/scope_api/models/validation_error.py,sha256=ZlK9hbhWr4zSC-dxZh9giERvMiYf9s2k8e1O9Rch_NI,2181
74
+ qubitclient/scope/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
75
+ qubitclient/scope/utils/data_parser.py,sha256=pVMR_NdvkmdWS6IEtV326YOejrOSigFwu7Kgezi4wzw,639
76
+ qubitclient-0.1.4.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
77
+ qubitclient-0.1.4.dist-info/METADATA,sha256=CnODqPHPoxyc8laV6ap2Y6feyBxv7yK9gLdrKCEKV_0,4783
78
+ qubitclient-0.1.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
79
+ qubitclient-0.1.4.dist-info/top_level.txt,sha256=WykSPDNRJemNN2fgAgiuCxzU4ohtegELAvBMnpgMq4g,12
80
+ qubitclient-0.1.4.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
81
+ qubitclient-0.1.4.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+