qubitclient 0.0.1__py3-none-any.whl → 0.0.3.0__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.

Potentially problematic release.


This version of qubitclient might be problematic. Click here for more details.

qubitclient/__init__.py CHANGED
@@ -1,3 +1,6 @@
1
- from .curve.curve_type import CurveType # noqa: F401
1
+ from .nnscope.nnscope_api.curve.curve_type import CurveType # noqa: F401
2
2
  from .scope.scope import QubitScopeClient
3
- from .scope.task import TaskName
3
+ from .nnscope.nnscope import QubitNNScopeClient
4
+ from .scope.task import TaskName
5
+ from .nnscope.task import NNTaskName
6
+ from .nnscope.nnscope_api.QubitSeg import QubitSegClient
@@ -0,0 +1,51 @@
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/10/20 18:13:37
8
+ ########################################################################
9
+
10
+
11
+ import os
12
+ # import cv2
13
+ import numpy as np
14
+ import sys
15
+ # 获取当前文件的绝对路径,向上两层就是项目根目录
16
+ project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
17
+ if project_root not in sys.path:
18
+ sys.path.insert(0, project_root)
19
+ #
20
+ # `scope_api_client`: this package is generated by `openapi-python-client`
21
+
22
+ from .task import run_task
23
+ import logging
24
+ import numpy as np
25
+
26
+
27
+
28
+ logging.basicConfig(level=logging.INFO)
29
+
30
+
31
+ class QubitNNScopeClient(object):
32
+ def __init__(self, url, api_key):
33
+ self.url = url
34
+ self.api_key = api_key
35
+
36
+ def request(self, file_list:list[str|dict[str,np.ndarray]|np.ndarray],task_type:str="s21peak",*args,**kwargs):
37
+ if len(file_list)>0:
38
+ response = run_task(file_list=file_list,url=self.url,api_key=self.api_key,task_type=task_type,*args,**kwargs)
39
+ else:
40
+ raise ValueError("file_list must not be empty")
41
+ return response
42
+ def get_result(self,response):
43
+ if response.status_code == 200:
44
+ logging.info("Result: %s", response.json())
45
+ result = response.json()
46
+ result = result["result"]
47
+ return result
48
+ else:
49
+ logging.error("Error: %s %s", response.status_code, response.text)
50
+ return []
51
+
@@ -10,10 +10,10 @@
10
10
  import logging
11
11
  import numpy as np
12
12
 
13
- from qubitclient.utils.request_tool import file_request,file_request_with_dict
14
- from qubitclient.utils.result_parser import parser_result
15
- from qubitclient.utils.result_parser import convet_axis
16
- from qubitclient.curve.curve_type import CurveType
13
+ from qubitclient.nnscope.utils.request_tool import file_request,file_request_with_dict
14
+ from qubitclient.nnscope.utils.result_parser import parser_result
15
+ from qubitclient.nnscope.utils.result_parser import convet_axis
16
+ from .curve.curve_type import CurveType
17
17
 
18
18
 
19
19
  logging.basicConfig(level=logging.INFO)
File without changes
@@ -0,0 +1,130 @@
1
+
2
+ import os
3
+ import requests
4
+
5
+ import io
6
+ import numpy as np
7
+
8
+
9
+ from qubitclient.nnscope.utils.data_convert import convert_spectrum_npy2npz,convert_spectrum_dict2npz
10
+
11
+ # load from npz file path
12
+ def load_from_npz_path(file_path_list:list[str]):
13
+ files = []
14
+ npydata = {}
15
+ npydata['id'] = 0
16
+ image_qs = {}
17
+ index = 0
18
+ for file_path in file_path_list:
19
+ if file_path.endswith('.npz'):
20
+ index+=1
21
+ with np.load(file_path, allow_pickle=True) as data: # 修改:添加 allow_pickle=True 参数
22
+ # file_contents[file_name] = dict(data) # 将 .npz 文件内容转换为字典
23
+ content = dict(data) # 将 .npz 文件内容转换为字典
24
+ image_qs[str(index)] = (content['iq_avg'],content['bias'],content['frequency'])
25
+ npydata['image'] = image_qs
26
+ with io.BytesIO() as buffer:
27
+ np.savez(buffer, **npydata)
28
+ bytes_obj = buffer.getvalue()
29
+ files.append(("request", ("None.npz", bytes_obj, "application/octet-stream")))
30
+ return files
31
+ def load_from_npy_path(file_path_list:list[str]):
32
+ files = []
33
+ for file_path in file_path_list:
34
+ if file_path.endswith('.npy'):
35
+ data = np.load(file_path, allow_pickle=True)
36
+ data = data.item() if isinstance(data, np.ndarray) else data
37
+ with io.BytesIO() as buffer:
38
+ np.savez(buffer, **data)
39
+ bytes_obj = buffer.getvalue()
40
+ files.append(("request", ("None.npz", bytes_obj, "application/octet-stream")))
41
+ return files
42
+ def load_from_npz_dict(dict_list:list[dict]):
43
+ files = []
44
+ npydata = {}
45
+ npydata['id'] = 0
46
+ image_qs = {}
47
+ for index,dict_obj in enumerate(dict_list):
48
+ image_qs[str(index)] = (dict_obj['iq_avg'], dict_obj['bias'], dict_obj['frequency'])
49
+ npydata['image'] = image_qs
50
+ with io.BytesIO() as buffer:
51
+ np.savez(buffer, **npydata)
52
+ bytes_obj = buffer.getvalue()
53
+ files.append(("request", ("None.npz", bytes_obj, "application/octet-stream")))
54
+ return files
55
+ def load_from_npy_dict(dict_list:list[dict]):
56
+ files = []
57
+ for dict_obj in dict_list:
58
+ with io.BytesIO() as buffer:
59
+ np.savez(buffer, **dict_obj)
60
+ bytes_obj = buffer.getvalue()
61
+ files.append(("request", ("None.npz",bytes_obj, "application/octet-stream")))
62
+ return files
63
+ def request_task(files,url,api_key,curve_type:str=None):
64
+ headers = {'Authorization': f'Bearer {api_key}'} # 添加API密钥到请求头
65
+ data = {
66
+ "curve_type":curve_type.value if curve_type else None
67
+ }
68
+ response = requests.post(url, files=files, headers=headers,data=data)
69
+ return response
70
+ def load_files(filepath_list: list[str|dict[str,np.ndarray]|np.ndarray]):
71
+ if len(filepath_list)<=0:
72
+ return []
73
+ else:
74
+ if isinstance(filepath_list[0], dict):
75
+ if "image" in filepath_list[0]:
76
+ return load_from_npy_dict(filepath_list)
77
+ else:
78
+ return load_from_npz_dict(filepath_list)
79
+ elif isinstance(filepath_list[0], np.ndarray):
80
+ filepath_list = [filepath_list[i].item() for i in range(len(filepath_list))]
81
+ return load_files(filepath_list)
82
+ elif isinstance(filepath_list[0], str):
83
+ if filepath_list[0].endswith('.npz'):
84
+ return load_from_npz_path(filepath_list)
85
+ elif filepath_list[0].endswith('.npy'):
86
+ return load_from_npy_path(filepath_list)
87
+ else:
88
+ return []
89
+
90
+
91
+
92
+ DEFINED_TASKS = {}
93
+ def task_register(func):
94
+ DEFINED_TASKS[func.__name__.lower()] = func
95
+ return func
96
+
97
+ def run_task(file_list: list[str|dict[str,np.ndarray]|np.ndarray],url,api_key,task_type:str,*args,**kwargs):
98
+ files = load_files(file_list)
99
+ response = DEFINED_TASKS[task_type.value](files,url,api_key,*args,**kwargs)
100
+ return response
101
+
102
+
103
+ @task_register
104
+ def test(files):
105
+
106
+ return "hello"
107
+
108
+ @task_register
109
+ def spectrum2d(files,url,api_key,curve_type):
110
+ spectrum2d_url = url + "/seglines"
111
+ response = request_task(files,spectrum2d_url,api_key,curve_type)
112
+ return response
113
+
114
+ from enum import Enum, unique
115
+ @unique
116
+ class NNTaskName(Enum):
117
+ # S21PEAK = "s21peak"
118
+ # OPTPIPULSE = "optpipulse"
119
+ # RABI = "rabi"
120
+ # RABICOS = "rabicos"
121
+ # S21VFLUX = "s21vflux"
122
+ # SINGLESHOT = "singleshot"
123
+ # SPECTRUM = "spectrum"
124
+ # T1FIT = "t1fit"
125
+ # T2FIT = "t2fit"
126
+ SPECTRUM2D = "spectrum2d"
127
+
128
+
129
+
130
+
@@ -73,9 +73,9 @@ def load_npz_to_image(file_path):
73
73
  def convert_spectrum_npy2npz(npy_file_path:str):
74
74
  data = np.load(npy_file_path, allow_pickle=True)
75
75
  data = data.item() if isinstance(data, np.ndarray) else data
76
- dict_list, name_list = convert_spectrum_dict2npz(data)
76
+ dict_list, name_list = convert_spectrum_dict2npz(data,npy_file_path)
77
77
  return dict_list, name_list
78
- def convert_spectrum_dict2npz(data:dict):
78
+ def convert_spectrum_dict2npz(data:dict,npy_file_path:str="None.npy"):
79
79
  if not isinstance(data, dict) or 'image' not in data:
80
80
  raise ValueError("数据格式无效,缺少 'image' 键")
81
81
  image = data["image"]
@@ -88,6 +88,8 @@ def convert_spectrum_dict2npz(data:dict):
88
88
  image_q = image[q_name]
89
89
 
90
90
  data = image_q[0]
91
+ if data.ndim != 2:
92
+ raise ValueError("数据格式无效,data不是二维数组")
91
93
  data = np.array(data)
92
94
  data = np.abs(data)
93
95
  height_axis = image_q[1]
@@ -10,7 +10,7 @@ import os
10
10
  import requests
11
11
  import io
12
12
  import numpy as np
13
- from qubitclient.curve.curve_type import CurveType
13
+ from qubitclient.nnscope.nnscope_api.curve.curve_type import CurveType
14
14
 
15
15
 
16
16
  def file_request(file_path_list,url,api_key,curve_type:CurveType=None):
@@ -72,11 +72,11 @@ def sync_detailed(
72
72
  ) -> Response[Union[Any, HTTPValidationError]]:
73
73
  r"""Optpipulse
74
74
 
75
- t2 fit
75
+ Common peak detection for optimizing pi pulse
76
76
 
77
77
  Args:
78
78
  files: 上传的.npy文件列表
79
- type: 任务类型,默认为\"s21peak\"
79
+ type: 任务类型,默认为\"optpipulse\"
80
80
 
81
81
  Returns:
82
82
  dict: 包含检测结果的字典
@@ -113,11 +113,11 @@ def sync(
113
113
  ) -> Optional[Union[Any, HTTPValidationError]]:
114
114
  r"""Optpipulse
115
115
 
116
- t2 fit
116
+ Common peak detection for optimizing pi pulse
117
117
 
118
118
  Args:
119
119
  files: 上传的.npy文件列表
120
- type: 任务类型,默认为\"s21peak\"
120
+ type: 任务类型,默认为\"optpipulse\"
121
121
 
122
122
  Returns:
123
123
  dict: 包含检测结果的字典
@@ -149,11 +149,11 @@ async def asyncio_detailed(
149
149
  ) -> Response[Union[Any, HTTPValidationError]]:
150
150
  r"""Optpipulse
151
151
 
152
- t2 fit
152
+ Common peak detection for optimizing pi pulse
153
153
 
154
154
  Args:
155
155
  files: 上传的.npy文件列表
156
- type: 任务类型,默认为\"s21peak\"
156
+ type: 任务类型,默认为\"optpipulse\"
157
157
 
158
158
  Returns:
159
159
  dict: 包含检测结果的字典
@@ -188,11 +188,11 @@ async def asyncio(
188
188
  ) -> Optional[Union[Any, HTTPValidationError]]:
189
189
  r"""Optpipulse
190
190
 
191
- t2 fit
191
+ Common peak detection for optimizing pi pulse
192
192
 
193
193
  Args:
194
194
  files: 上传的.npy文件列表
195
- type: 任务类型,默认为\"s21peak\"
195
+ type: 任务类型,默认为\"optpipulse\"
196
196
 
197
197
  Returns:
198
198
  dict: 包含检测结果的字典
@@ -0,0 +1,218 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.body_spectrum_2d_api_v1_tasks_scope_spectrum_2d_post import BodySpectrum2DApiV1TasksScopeSpectrum2DPost
9
+ from ...models.http_validation_error import HTTPValidationError
10
+ from ...types import UNSET, Response, Unset
11
+
12
+
13
+ def _get_kwargs(
14
+ *,
15
+ body: BodySpectrum2DApiV1TasksScopeSpectrum2DPost,
16
+ type_: Union[Unset, str] = "spectrum2d",
17
+ ) -> dict[str, Any]:
18
+ headers: dict[str, Any] = {}
19
+
20
+ params: dict[str, Any] = {}
21
+
22
+ params["type"] = type_
23
+
24
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
25
+
26
+ _kwargs: dict[str, Any] = {
27
+ "method": "post",
28
+ "url": "/api/v1/tasks/scope/spectrum2d",
29
+ "params": params,
30
+ }
31
+
32
+ _kwargs["files"] = body.to_multipart()
33
+
34
+ _kwargs["headers"] = headers
35
+ return _kwargs
36
+
37
+
38
+ def _parse_response(
39
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
40
+ ) -> Optional[Union[Any, HTTPValidationError]]:
41
+ if response.status_code == 200:
42
+ response_200 = response.json()
43
+ return response_200
44
+
45
+ if response.status_code == 422:
46
+ response_422 = HTTPValidationError.from_dict(response.json())
47
+
48
+ return response_422
49
+
50
+ if client.raise_on_unexpected_status:
51
+ raise errors.UnexpectedStatus(response.status_code, response.content)
52
+ else:
53
+ return None
54
+
55
+
56
+ def _build_response(
57
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
58
+ ) -> Response[Union[Any, HTTPValidationError]]:
59
+ return Response(
60
+ status_code=HTTPStatus(response.status_code),
61
+ content=response.content,
62
+ headers=response.headers,
63
+ parsed=_parse_response(client=client, response=response),
64
+ )
65
+
66
+
67
+ def sync_detailed(
68
+ *,
69
+ client: Union[AuthenticatedClient, Client],
70
+ body: BodySpectrum2DApiV1TasksScopeSpectrum2DPost,
71
+ type_: Union[Unset, str] = "spectrum2d",
72
+ ) -> Response[Union[Any, HTTPValidationError]]:
73
+ r"""Spectrum2D
74
+
75
+ spectrum2d
76
+
77
+ Args:
78
+ files: 上传的.npy文件列表
79
+ type: 任务类型,默认为\"spectrum2d\"
80
+
81
+ Returns:
82
+ dict: 包含检测结果的字典
83
+
84
+ Args:
85
+ type_ (Union[Unset, str]): 任务类型 Default: 'spectrum2d'.
86
+ body (BodySpectrum2DApiV1TasksScopeSpectrum2DPost):
87
+
88
+ Raises:
89
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
90
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
91
+
92
+ Returns:
93
+ Response[Union[Any, HTTPValidationError]]
94
+ """
95
+
96
+ kwargs = _get_kwargs(
97
+ body=body,
98
+ type_=type_,
99
+ )
100
+
101
+ response = client.get_httpx_client().request(
102
+ **kwargs,
103
+ )
104
+
105
+ return _build_response(client=client, response=response)
106
+
107
+
108
+ def sync(
109
+ *,
110
+ client: Union[AuthenticatedClient, Client],
111
+ body: BodySpectrum2DApiV1TasksScopeSpectrum2DPost,
112
+ type_: Union[Unset, str] = "spectrum2d",
113
+ ) -> Optional[Union[Any, HTTPValidationError]]:
114
+ r"""Spectrum2D
115
+
116
+ spectrum2d
117
+
118
+ Args:
119
+ files: 上传的.npy文件列表
120
+ type: 任务类型,默认为\"spectrum2d\"
121
+
122
+ Returns:
123
+ dict: 包含检测结果的字典
124
+
125
+ Args:
126
+ type_ (Union[Unset, str]): 任务类型 Default: 'spectrum2d'.
127
+ body (BodySpectrum2DApiV1TasksScopeSpectrum2DPost):
128
+
129
+ Raises:
130
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
131
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
132
+
133
+ Returns:
134
+ Union[Any, HTTPValidationError]
135
+ """
136
+
137
+ return sync_detailed(
138
+ client=client,
139
+ body=body,
140
+ type_=type_,
141
+ ).parsed
142
+
143
+
144
+ async def asyncio_detailed(
145
+ *,
146
+ client: Union[AuthenticatedClient, Client],
147
+ body: BodySpectrum2DApiV1TasksScopeSpectrum2DPost,
148
+ type_: Union[Unset, str] = "spectrum2d",
149
+ ) -> Response[Union[Any, HTTPValidationError]]:
150
+ r"""Spectrum2D
151
+
152
+ spectrum2d
153
+
154
+ Args:
155
+ files: 上传的.npy文件列表
156
+ type: 任务类型,默认为\"spectrum2d\"
157
+
158
+ Returns:
159
+ dict: 包含检测结果的字典
160
+
161
+ Args:
162
+ type_ (Union[Unset, str]): 任务类型 Default: 'spectrum2d'.
163
+ body (BodySpectrum2DApiV1TasksScopeSpectrum2DPost):
164
+
165
+ Raises:
166
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
167
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
168
+
169
+ Returns:
170
+ Response[Union[Any, HTTPValidationError]]
171
+ """
172
+
173
+ kwargs = _get_kwargs(
174
+ body=body,
175
+ type_=type_,
176
+ )
177
+
178
+ response = await client.get_async_httpx_client().request(**kwargs)
179
+
180
+ return _build_response(client=client, response=response)
181
+
182
+
183
+ async def asyncio(
184
+ *,
185
+ client: Union[AuthenticatedClient, Client],
186
+ body: BodySpectrum2DApiV1TasksScopeSpectrum2DPost,
187
+ type_: Union[Unset, str] = "spectrum2d",
188
+ ) -> Optional[Union[Any, HTTPValidationError]]:
189
+ r"""Spectrum2D
190
+
191
+ spectrum2d
192
+
193
+ Args:
194
+ files: 上传的.npy文件列表
195
+ type: 任务类型,默认为\"spectrum2d\"
196
+
197
+ Returns:
198
+ dict: 包含检测结果的字典
199
+
200
+ Args:
201
+ type_ (Union[Unset, str]): 任务类型 Default: 'spectrum2d'.
202
+ body (BodySpectrum2DApiV1TasksScopeSpectrum2DPost):
203
+
204
+ Raises:
205
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
206
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
207
+
208
+ Returns:
209
+ Union[Any, HTTPValidationError]
210
+ """
211
+
212
+ return (
213
+ await asyncio_detailed(
214
+ client=client,
215
+ body=body,
216
+ type_=type_,
217
+ )
218
+ ).parsed
@@ -6,6 +6,7 @@ from .body_rabicos_api_v1_tasks_scope_rabicospeak_post import BodyRabicosApiV1Ta
6
6
  from .body_s21_peak_api_v1_tasks_scope_s21_peak_post import BodyS21PeakApiV1TasksScopeS21PeakPost
7
7
  from .body_s21_vflux_api_v1_tasks_scope_s21_vflux_post import BodyS21VfluxApiV1TasksScopeS21VfluxPost
8
8
  from .body_singleshot_api_v1_tasks_scope_singleshot_post import BodySingleshotApiV1TasksScopeSingleshotPost
9
+ from .body_spectrum_2d_api_v1_tasks_scope_spectrum_2d_post import BodySpectrum2DApiV1TasksScopeSpectrum2DPost
9
10
  from .body_spectrum_api_v1_tasks_scope_spectrum_post import BodySpectrumApiV1TasksScopeSpectrumPost
10
11
  from .body_t1_fit_api_v1_tasks_scope_t1_fit_post import BodyT1FitApiV1TasksScopeT1FitPost
11
12
  from .body_t1_fit_api_v1_tasks_scope_t2_fit_post import BodyT1FitApiV1TasksScopeT2FitPost
@@ -19,6 +20,7 @@ __all__ = (
19
20
  "BodyS21PeakApiV1TasksScopeS21PeakPost",
20
21
  "BodyS21VfluxApiV1TasksScopeS21VfluxPost",
21
22
  "BodySingleshotApiV1TasksScopeSingleshotPost",
23
+ "BodySpectrum2DApiV1TasksScopeSpectrum2DPost",
22
24
  "BodySpectrumApiV1TasksScopeSpectrumPost",
23
25
  "BodyT1FitApiV1TasksScopeT1FitPost",
24
26
  "BodyT1FitApiV1TasksScopeT2FitPost",
@@ -0,0 +1,83 @@
1
+ from collections.abc import Mapping
2
+ from io import BytesIO
3
+ from typing import Any, TypeVar
4
+
5
+ from attrs import define as _attrs_define
6
+ from attrs import field as _attrs_field
7
+
8
+ from .. import types
9
+ from ..types import File
10
+
11
+ T = TypeVar("T", bound="BodySpectrum2DApiV1TasksScopeSpectrum2DPost")
12
+
13
+
14
+ @_attrs_define
15
+ class BodySpectrum2DApiV1TasksScopeSpectrum2DPost:
16
+ """
17
+ Attributes:
18
+ files (list[File]):
19
+ """
20
+
21
+ files: list[File]
22
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23
+
24
+ def to_dict(self) -> dict[str, Any]:
25
+ files = []
26
+ for files_item_data in self.files:
27
+ files_item = files_item_data.to_tuple()
28
+
29
+ files.append(files_item)
30
+
31
+ field_dict: dict[str, Any] = {}
32
+ field_dict.update(self.additional_properties)
33
+ field_dict.update(
34
+ {
35
+ "files": files,
36
+ }
37
+ )
38
+
39
+ return field_dict
40
+
41
+ def to_multipart(self) -> types.RequestFiles:
42
+ files: types.RequestFiles = []
43
+
44
+ for files_item_element in self.files:
45
+ files.append(("files", files_item_element.to_tuple()))
46
+
47
+ for prop_name, prop in self.additional_properties.items():
48
+ files.append((prop_name, (None, str(prop).encode(), "text/plain")))
49
+
50
+ return files
51
+
52
+ @classmethod
53
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
54
+ d = dict(src_dict)
55
+ files = []
56
+ _files = d.pop("files")
57
+ for files_item_data in _files:
58
+ files_item = File(payload=BytesIO(files_item_data))
59
+
60
+ files.append(files_item)
61
+
62
+ body_spectrum_2d_api_v1_tasks_scope_spectrum_2d_post = cls(
63
+ files=files,
64
+ )
65
+
66
+ body_spectrum_2d_api_v1_tasks_scope_spectrum_2d_post.additional_properties = d
67
+ return body_spectrum_2d_api_v1_tasks_scope_spectrum_2d_post
68
+
69
+ @property
70
+ def additional_keys(self) -> list[str]:
71
+ return list(self.additional_properties.keys())
72
+
73
+ def __getitem__(self, key: str) -> Any:
74
+ return self.additional_properties[key]
75
+
76
+ def __setitem__(self, key: str, value: Any) -> None:
77
+ self.additional_properties[key] = value
78
+
79
+ def __delitem__(self, key: str) -> None:
80
+ del self.additional_properties[key]
81
+
82
+ def __contains__(self, key: str) -> bool:
83
+ return key in self.additional_properties
qubitclient/scope/task.py CHANGED
@@ -9,6 +9,7 @@ from .scope_api.api.defined_tasks import singleshot_api_v1_tasks_scope_singlesho
9
9
  from .scope_api.api.defined_tasks import spectrum_api_v1_tasks_scope_spectrum_post
10
10
  from .scope_api.api.defined_tasks import t1fit_api_v1_tasks_scope_t1fit_post
11
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
12
13
 
13
14
  from .scope_api.models import BodyS21PeakApiV1TasksScopeS21PeakPost
14
15
  from .scope_api.models import BodyOptpipulseApiV1TasksScopeOptpipulsePost
@@ -19,6 +20,7 @@ from .scope_api.models import BodySingleshotApiV1TasksScopeSingleshotPost
19
20
  from .scope_api.models import BodySpectrumApiV1TasksScopeSpectrumPost
20
21
  from .scope_api.models import BodyT1FitApiV1TasksScopeT1FitPost
21
22
  from .scope_api.models import BodyT1FitApiV1TasksScopeT2FitPost
23
+ from .scope_api.models import BodySpectrum2DApiV1TasksScopeSpectrum2DPost
22
24
 
23
25
  from .scope_api.types import Response
24
26
  from .scope_api.types import File
@@ -120,7 +122,11 @@ def t2fit(client,files: File):
120
122
  response: Response[BodyT1FitApiV1TasksScopeT2FitPost] = t1fit_api_v1_tasks_scope_t2fit_post.sync_detailed(client=client,body=body)
121
123
  return response
122
124
 
123
-
125
+ @task_register
126
+ def spectrum2d(client,files: File):
127
+ body: BodySpectrum2DApiV1TasksScopeSpectrum2DPost = BodySpectrum2DApiV1TasksScopeSpectrum2DPost(files=files)
128
+ response: Response[BodySpectrum2DApiV1TasksScopeSpectrum2DPost] = spectrum2d_api_v1_tasks_scope_spectrum2d_post.sync_detailed(client=client,body=body)
129
+ return response
124
130
 
125
131
  from enum import Enum, unique
126
132
  @unique
@@ -134,6 +140,7 @@ class TaskName(Enum):
134
140
  SPECTRUM = "spectrum"
135
141
  T1FIT = "t1fit"
136
142
  T2FIT = "t2fit"
143
+ SPECTRUM2D = "spectrum2d"
137
144
 
138
145
 
139
146
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qubitclient
3
- Version: 0.0.1
3
+ Version: 0.0.3.0
4
4
  Summary: qubit analysis client
5
5
  Home-page: https://github.com/yaqiangsun/QubitClient
6
6
  Author: Yaqiang Sun
@@ -32,12 +32,7 @@ QubitClient 是用于使用Qubit服务的示例。
32
32
  # 使用
33
33
 
34
34
  ### scope功能包
35
- #### 运行示例代码
36
- ```python
37
- python demo/scope_demo.py
38
- ```
39
35
 
40
- ### 曲线分割功能
41
36
  #### 使用说明
42
37
  1.拷贝config.py.example文件为config.py,并修改配置参数。
43
38
  ```
@@ -45,25 +40,33 @@ cp config.py.example config.py
45
40
  ```
46
41
  2.运行
47
42
  单次请求多个文件:
48
- ```bash
49
- python client_demo.py
43
+ ```python
44
+ python tests/test_nnscope.py
50
45
  ```
51
46
  批量多次请求
52
47
  ```bash
53
- python script/test.py
48
+ Not provided
54
49
  ```
50
+ ## 功能集合
51
+ ### 曲线分割功能
52
+
53
+ #### 运行示例代码
54
+ ```python
55
+ python tests/test_nnscope.py
56
+ ```
57
+
55
58
  #### 定义实例
56
59
  ```
57
- client = QubitSegClient(url=url, api_key=api_key,curve_type=CurveType.POLY)
60
+ client = QubitNNScopeClient(url=url,api_key="")
58
61
  ```
59
- curve_type: CurveType.COSINE(cosin拟合) or CurveType.POLY(多项式拟合)
60
62
 
61
63
  #### 请求输入
62
64
 
63
65
  ```python
64
- response = client.request(file_list=dict_list)
66
+ response = client.request(file_list=file_path_list,\
67
+ task_type=NNTaskName.SPECTRUM2D,curve_type=CurveType.COSINE)
65
68
  ```
66
- dict_list格式为:
69
+ - dict_list格式为:
67
70
  ```json
68
71
  [
69
72
  {
@@ -74,6 +77,7 @@ dict_list格式为:
74
77
  ...
75
78
  ]
76
79
  ```
80
+ - curve_type: `CurveType.COSINE`(cosin拟合) or `CurveType.POLY`(多项式拟合)
77
81
 
78
82
 
79
83
  #### 返回值
@@ -103,4 +107,6 @@ res格式为:
103
107
  ]
104
108
  ```
105
109
 
110
+ ### 其他功能完善中
111
+
106
112
 
@@ -1,33 +1,41 @@
1
- qubitclient/QubitSeg.py,sha256=ITBdSzvn5XApSoM9uvRhZjYWNFTVHqUaI_gKbnCxOiY,2604
2
- qubitclient/__init__.py,sha256=m5vF1vnS6dr3U8j0qiIruKcuRkiAhl8Aw6n4jOgZbEw,128
3
- qubitclient/curve/curve_type.py,sha256=Qi1vTjzK6eJWMpaT9QkJtSM9486fEp4Sd27hAHi1LnM,473
1
+ qubitclient/__init__.py,sha256=-B4dKmyVwertyKu7vo8A6tZhG5klzGlqcSCrITk3JPw,290
2
+ qubitclient/nnscope/nnscope.py,sha256=AuvJSb8HY3uzUJ14go16_5Y8jeyytGFJR8qi3KCP6Dk,1684
3
+ qubitclient/nnscope/task.py,sha256=4M8N_VeGjGg3ptkQtyhODSOt3tpMCuD0_UGYGmSz9fc,4465
4
+ qubitclient/nnscope/nnscope_api/QubitSeg.py,sha256=vdH02IiLjJwU0Zihzq07vpIFDdt-yqy6v9oPiyrer8o,2617
5
+ qubitclient/nnscope/nnscope_api/curve/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ qubitclient/nnscope/nnscope_api/curve/curve_type.py,sha256=Qi1vTjzK6eJWMpaT9QkJtSM9486fEp4Sd27hAHi1LnM,473
7
+ qubitclient/nnscope/utils/data_convert.py,sha256=YdvRneYGNVy_Yetpw_9xfu2CSMW3pXLu-X2e6owuGgs,4295
8
+ qubitclient/nnscope/utils/data_parser.py,sha256=2CnrVTRhrg67nrei8wthNhakzUjIBwUh5gJJv6vpg_U,1280
9
+ qubitclient/nnscope/utils/request_tool.py,sha256=SToOpaOJ0GKH0YK428t9s7fReAC9Piae18sJngxctxo,1694
10
+ qubitclient/nnscope/utils/result_parser.py,sha256=5ymB5JSlU1-mqQ3U4fZBGDQdF3CH7NEp4IMt6rDj2uM,2039
4
11
  qubitclient/scope/scope.py,sha256=4wJ4t55QiKtPEJ-l-ADNLliGg04SPFW-SBRho0kiHLQ,1635
5
- qubitclient/scope/task.py,sha256=MVTprSSq4PADBPxIe89Ii5Bp_1DEhaQrpPjB-pTJ0Gg,6339
12
+ qubitclient/scope/task.py,sha256=jBSsPpWhVoI4SVpaSVQoxSBYu_8esegdhioEZVm1NGE,6868
6
13
  qubitclient/scope/scope_api/__init__.py,sha256=qUheje2C4lZ8b26EUHXHRJ3dWuzKiExv_JVOdVCFAek,150
7
14
  qubitclient/scope/scope_api/client.py,sha256=o_mdLqyBCQstu5tS1WZFwqIEbGwkvWQ7eQjuCJw_5VY,12419
8
15
  qubitclient/scope/scope_api/errors.py,sha256=gO8GBmKqmSNgAg-E5oT-oOyxztvp7V_6XG7OUTT15q0,546
9
- qubitclient/scope/scope_api/py.typed,sha256=8ZJUsxZiuOy1oJeVhsTWQhTG_6pTVHVXk5hJL79ebTk,25
10
16
  qubitclient/scope/scope_api/types.py,sha256=AX4orxQZQJat3vZrgjJ-TYb2sNBL8kNo9yqYDT-n8y8,1391
11
17
  qubitclient/scope/scope_api/api/__init__.py,sha256=zTSiG_ujSjAqWPyc435YXaX9XTlpMjiJWBbV-f-YtdA,45
12
18
  qubitclient/scope/scope_api/api/defined_tasks/__init__.py,sha256=5vd9uJWAjRqa9xzxzYkLD1yoZ12Ld_bAaNB5WX4fbE8,56
13
19
  qubitclient/scope/scope_api/api/defined_tasks/get_task_result_api_v1_tasks_demo_pk_get.py,sha256=mWzJoBh2EmCF-iX4jTlN5msvI6L3CzLixel2S-vu_Qc,3908
14
20
  qubitclient/scope/scope_api/api/defined_tasks/get_task_result_api_v1_tasks_scope_pk_get.py,sha256=6SqRkNWS631gZ_zSuhRVfzQQSqab8S4vBNdgxQCpE0A,3909
15
- qubitclient/scope/scope_api/api/defined_tasks/optpipulse_api_v1_tasks_scope_optpipulse_post.py,sha256=Xv5uK16r7P74IBEL6Q867r0K9ae0ZwqveIT-k52oJrQ,5894
21
+ qubitclient/scope/scope_api/api/defined_tasks/optpipulse_api_v1_tasks_scope_optpipulse_post.py,sha256=LBZvC5WH7qosti6CodqI5l_7ka9kOu_zKwOjfJEDWQE,6062
16
22
  qubitclient/scope/scope_api/api/defined_tasks/rabi_api_v1_tasks_scope_rabi_post.py,sha256=OjJPbwk8wzaBQH5pKdBXu1lu77C9YRTI6u88kyA8Rgk,5686
17
23
  qubitclient/scope/scope_api/api/defined_tasks/rabicos_api_v1_tasks_scope_rabicospeak_post.py,sha256=VRZQAQVloC1E066bpFlp3VOndU84WyV4e-TxrPlxgPI,5926
18
24
  qubitclient/scope/scope_api/api/defined_tasks/s21peak_api_v1_tasks_scope_s21peak_post.py,sha256=1tajlqSAPJ0Z9JrK9iFvf9hW_-lXmwyrNt8BmyOs4g0,5848
19
25
  qubitclient/scope/scope_api/api/defined_tasks/s21vflux_api_v1_tasks_scope_s21vflux_post.py,sha256=hHGS24N_2ZGQlsW4XFnVuN5asje3Z6Hh9rdScKmPdKQ,5940
20
26
  qubitclient/scope/scope_api/api/defined_tasks/singleshot_api_v1_tasks_scope_singleshot_post.py,sha256=SZz6OuGsLQMHdT-anFPMcUcEAc99rRhzSB5QX0VAk1k,5942
27
+ qubitclient/scope/scope_api/api/defined_tasks/spectrum2d_api_v1_tasks_scope_spectrum2d_post.py,sha256=Ku2yJA1W9M3ybQGZ4WgGjDfX-qh4QyVizEwLGHj4uFk,5924
21
28
  qubitclient/scope/scope_api/api/defined_tasks/spectrum_api_v1_tasks_scope_spectrum_post.py,sha256=f2vjj-xjWVachjXRb7vtWBXItII0ECWVs-dHIeqDJlU,5914
22
29
  qubitclient/scope/scope_api/api/defined_tasks/t1fit_api_v1_tasks_scope_t1fit_post.py,sha256=yC5nJh4vmNvx4CLOoFAHj2pai4pLlSlJov6gz3mkOhM,5716
23
30
  qubitclient/scope/scope_api/api/defined_tasks/t1fit_api_v1_tasks_scope_t2fit_post.py,sha256=SRbaUDoR5b0nA12ix0RTGapiybnoq5c1MJ48wFIydFg,5716
24
- qubitclient/scope/scope_api/models/__init__.py,sha256=Aq8PxB29kvcxMcEFLDTIqujQUQRqe5HD3pWoAnr5VqA,1520
31
+ qubitclient/scope/scope_api/models/__init__.py,sha256=RzudaJYyMnTqf5f7TxagPAG2Emp3BfFGHxYi4m_l9f4,1681
25
32
  qubitclient/scope/scope_api/models/body_optpipulse_api_v1_tasks_scope_optpipulse_post.py,sha256=jA4fcZ7KwhH7L74kvoxFkmqTPcAqBZA2WQglJAYrrtk,2369
26
33
  qubitclient/scope/scope_api/models/body_rabi_api_v1_tasks_scope_rabi_post.py,sha256=zWGZyxNpb7KYquXYEylGeSVFJLiiR2jM03bJBbMRMRw,2309
27
34
  qubitclient/scope/scope_api/models/body_rabicos_api_v1_tasks_scope_rabicospeak_post.py,sha256=tUaq3bDWVWQafVN7hPsIjjDWpfqtl3V2fnJEpos5TZw,2359
28
35
  qubitclient/scope/scope_api/models/body_s21_peak_api_v1_tasks_scope_s21_peak_post.py,sha256=K4_hwbLYw6Fqn7OVF_VFzhl6WWF702PDsb4iMZ_yPqM,2345
29
36
  qubitclient/scope/scope_api/models/body_s21_vflux_api_v1_tasks_scope_s21_vflux_post.py,sha256=i3Z7BD2T0-7eoNNH_LVOHBosyYW3ZBQvjtRPm7GaYKE,2355
30
37
  qubitclient/scope/scope_api/models/body_singleshot_api_v1_tasks_scope_singleshot_post.py,sha256=iso7Wrq6EERyGzHnEvScZ7sBzgNNb_mLEeB1yqVSgQA,2369
38
+ qubitclient/scope/scope_api/models/body_spectrum_2d_api_v1_tasks_scope_spectrum_2d_post.py,sha256=e8aQqZdvwd7zZk1BmQMzjfMlznz-os41KYr9la0_5g4,2375
31
39
  qubitclient/scope/scope_api/models/body_spectrum_api_v1_tasks_scope_spectrum_post.py,sha256=xCKF1NeRs0FgPstiku6qyT_w0IxBI8Xc5BdLo8E4sfg,2349
32
40
  qubitclient/scope/scope_api/models/body_t1_fit_api_v1_tasks_scope_t1_fit_post.py,sha256=_dMiMzrEkUPA1lY1sMqN7tMC2FkFFffRovh72LPPYIE,2325
33
41
  qubitclient/scope/scope_api/models/body_t1_fit_api_v1_tasks_scope_t2_fit_post.py,sha256=wURlSeo12Yr8kX1SPN71bnLjZw2SUFAsDVUS38n3Vw0,2325
@@ -35,13 +43,9 @@ qubitclient/scope/scope_api/models/http_validation_error.py,sha256=OvQ-alRPbtXXw
35
43
  qubitclient/scope/scope_api/models/validation_error.py,sha256=ZlK9hbhWr4zSC-dxZh9giERvMiYf9s2k8e1O9Rch_NI,2181
36
44
  qubitclient/scope/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
45
  qubitclient/scope/utils/data_parser.py,sha256=pVMR_NdvkmdWS6IEtV326YOejrOSigFwu7Kgezi4wzw,639
38
- qubitclient/utils/data_convert.py,sha256=9NaaA1ZSpTlDYh4R8S9d4guvST1NleDEp_xA7Pesh9I,4149
39
- qubitclient/utils/data_parser.py,sha256=2CnrVTRhrg67nrei8wthNhakzUjIBwUh5gJJv6vpg_U,1280
40
- qubitclient/utils/request_tool.py,sha256=f7ziQtsdCCWOLpugKNgFrVEms3cBEtQ8qdWh159VTr4,1674
41
- qubitclient/utils/result_parser.py,sha256=5ymB5JSlU1-mqQ3U4fZBGDQdF3CH7NEp4IMt6rDj2uM,2039
42
- qubitclient-0.0.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
43
- qubitclient-0.0.1.dist-info/METADATA,sha256=_8ZXIRc2USpuNBjByItS2U3phEP1goM8Ltu1mwaCBjI,2021
44
- qubitclient-0.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
45
- qubitclient-0.0.1.dist-info/top_level.txt,sha256=WykSPDNRJemNN2fgAgiuCxzU4ohtegELAvBMnpgMq4g,12
46
- qubitclient-0.0.1.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
47
- qubitclient-0.0.1.dist-info/RECORD,,
46
+ qubitclient-0.0.3.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
47
+ qubitclient-0.0.3.0.dist-info/METADATA,sha256=gackaPyWrJ6lIFcRqX36rMRdP1wSepdaPlZksSwUiS4,2122
48
+ qubitclient-0.0.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
49
+ qubitclient-0.0.3.0.dist-info/top_level.txt,sha256=WykSPDNRJemNN2fgAgiuCxzU4ohtegELAvBMnpgMq4g,12
50
+ qubitclient-0.0.3.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
51
+ qubitclient-0.0.3.0.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- # Marker file for PEP 561
File without changes
File without changes