qubitclient 0.0.1__tar.gz → 0.0.3.0__tar.gz

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.

Files changed (62) hide show
  1. {qubitclient-0.0.1/qubitclient.egg-info → qubitclient-0.0.3.0}/PKG-INFO +19 -13
  2. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/README.md +18 -12
  3. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/pyproject.toml +1 -1
  4. qubitclient-0.0.3.0/qubitclient/__init__.py +6 -0
  5. qubitclient-0.0.3.0/qubitclient/nnscope/nnscope.py +51 -0
  6. {qubitclient-0.0.1/qubitclient → qubitclient-0.0.3.0/qubitclient/nnscope/nnscope_api}/QubitSeg.py +4 -4
  7. qubitclient-0.0.3.0/qubitclient/nnscope/task.py +130 -0
  8. {qubitclient-0.0.1/qubitclient → qubitclient-0.0.3.0/qubitclient/nnscope}/utils/data_convert.py +4 -2
  9. {qubitclient-0.0.1/qubitclient → qubitclient-0.0.3.0/qubitclient/nnscope}/utils/request_tool.py +1 -1
  10. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/api/defined_tasks/optpipulse_api_v1_tasks_scope_optpipulse_post.py +8 -8
  11. qubitclient-0.0.3.0/qubitclient/scope/scope_api/api/defined_tasks/spectrum2d_api_v1_tasks_scope_spectrum2d_post.py +218 -0
  12. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/models/__init__.py +2 -0
  13. qubitclient-0.0.3.0/qubitclient/scope/scope_api/models/body_spectrum_2d_api_v1_tasks_scope_spectrum_2d_post.py +83 -0
  14. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/task.py +8 -1
  15. qubitclient-0.0.3.0/qubitclient/scope/utils/__init__.py +0 -0
  16. {qubitclient-0.0.1 → qubitclient-0.0.3.0/qubitclient.egg-info}/PKG-INFO +19 -13
  17. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient.egg-info/SOURCES.txt +12 -7
  18. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/setup.py +1 -1
  19. qubitclient-0.0.3.0/tests/test_nnscope.py +205 -0
  20. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/tests/test_scope.py +1 -1
  21. qubitclient-0.0.1/qubitclient/__init__.py +0 -3
  22. qubitclient-0.0.1/qubitclient/scope/scope_api/py.typed +0 -1
  23. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/LICENSE +0 -0
  24. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/MANIFEST.in +0 -0
  25. {qubitclient-0.0.1/qubitclient/scope/utils → qubitclient-0.0.3.0/qubitclient/nnscope/nnscope_api/curve}/__init__.py +0 -0
  26. {qubitclient-0.0.1/qubitclient → qubitclient-0.0.3.0/qubitclient/nnscope/nnscope_api}/curve/curve_type.py +0 -0
  27. {qubitclient-0.0.1/qubitclient → qubitclient-0.0.3.0/qubitclient/nnscope}/utils/data_parser.py +0 -0
  28. {qubitclient-0.0.1/qubitclient → qubitclient-0.0.3.0/qubitclient/nnscope}/utils/result_parser.py +0 -0
  29. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope.py +0 -0
  30. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/__init__.py +0 -0
  31. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/api/__init__.py +0 -0
  32. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/api/defined_tasks/__init__.py +0 -0
  33. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/api/defined_tasks/get_task_result_api_v1_tasks_demo_pk_get.py +0 -0
  34. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/api/defined_tasks/get_task_result_api_v1_tasks_scope_pk_get.py +0 -0
  35. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/api/defined_tasks/rabi_api_v1_tasks_scope_rabi_post.py +0 -0
  36. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/api/defined_tasks/rabicos_api_v1_tasks_scope_rabicospeak_post.py +0 -0
  37. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/api/defined_tasks/s21peak_api_v1_tasks_scope_s21peak_post.py +0 -0
  38. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/api/defined_tasks/s21vflux_api_v1_tasks_scope_s21vflux_post.py +0 -0
  39. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/api/defined_tasks/singleshot_api_v1_tasks_scope_singleshot_post.py +0 -0
  40. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/api/defined_tasks/spectrum_api_v1_tasks_scope_spectrum_post.py +0 -0
  41. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/api/defined_tasks/t1fit_api_v1_tasks_scope_t1fit_post.py +0 -0
  42. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/api/defined_tasks/t1fit_api_v1_tasks_scope_t2fit_post.py +0 -0
  43. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/client.py +0 -0
  44. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/errors.py +0 -0
  45. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/models/body_optpipulse_api_v1_tasks_scope_optpipulse_post.py +0 -0
  46. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/models/body_rabi_api_v1_tasks_scope_rabi_post.py +0 -0
  47. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/models/body_rabicos_api_v1_tasks_scope_rabicospeak_post.py +0 -0
  48. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/models/body_s21_peak_api_v1_tasks_scope_s21_peak_post.py +0 -0
  49. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/models/body_s21_vflux_api_v1_tasks_scope_s21_vflux_post.py +0 -0
  50. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/models/body_singleshot_api_v1_tasks_scope_singleshot_post.py +0 -0
  51. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/models/body_spectrum_api_v1_tasks_scope_spectrum_post.py +0 -0
  52. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/models/body_t1_fit_api_v1_tasks_scope_t1_fit_post.py +0 -0
  53. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/models/body_t1_fit_api_v1_tasks_scope_t2_fit_post.py +0 -0
  54. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/models/http_validation_error.py +0 -0
  55. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/models/validation_error.py +0 -0
  56. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/scope_api/types.py +0 -0
  57. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient/scope/utils/data_parser.py +0 -0
  58. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient.egg-info/dependency_links.txt +0 -0
  59. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient.egg-info/top_level.txt +0 -0
  60. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/qubitclient.egg-info/zip-safe +0 -0
  61. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/setup.cfg +0 -0
  62. {qubitclient-0.0.1 → qubitclient-0.0.3.0}/tests/test_scope_api.py +0 -0
@@ -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
 
@@ -16,12 +16,7 @@ QubitClient 是用于使用Qubit服务的示例。
16
16
  # 使用
17
17
 
18
18
  ### scope功能包
19
- #### 运行示例代码
20
- ```python
21
- python demo/scope_demo.py
22
- ```
23
19
 
24
- ### 曲线分割功能
25
20
  #### 使用说明
26
21
  1.拷贝config.py.example文件为config.py,并修改配置参数。
27
22
  ```
@@ -29,25 +24,33 @@ cp config.py.example config.py
29
24
  ```
30
25
  2.运行
31
26
  单次请求多个文件:
32
- ```bash
33
- python client_demo.py
27
+ ```python
28
+ python tests/test_nnscope.py
34
29
  ```
35
30
  批量多次请求
36
31
  ```bash
37
- python script/test.py
32
+ Not provided
38
33
  ```
34
+ ## 功能集合
35
+ ### 曲线分割功能
36
+
37
+ #### 运行示例代码
38
+ ```python
39
+ python tests/test_nnscope.py
40
+ ```
41
+
39
42
  #### 定义实例
40
43
  ```
41
- client = QubitSegClient(url=url, api_key=api_key,curve_type=CurveType.POLY)
44
+ client = QubitNNScopeClient(url=url,api_key="")
42
45
  ```
43
- curve_type: CurveType.COSINE(cosin拟合) or CurveType.POLY(多项式拟合)
44
46
 
45
47
  #### 请求输入
46
48
 
47
49
  ```python
48
- response = client.request(file_list=dict_list)
50
+ response = client.request(file_list=file_path_list,\
51
+ task_type=NNTaskName.SPECTRUM2D,curve_type=CurveType.COSINE)
49
52
  ```
50
- dict_list格式为:
53
+ - dict_list格式为:
51
54
  ```json
52
55
  [
53
56
  {
@@ -58,6 +61,7 @@ dict_list格式为:
58
61
  ...
59
62
  ]
60
63
  ```
64
+ - curve_type: `CurveType.COSINE`(cosin拟合) or `CurveType.POLY`(多项式拟合)
61
65
 
62
66
 
63
67
  #### 返回值
@@ -87,4 +91,6 @@ res格式为:
87
91
  ]
88
92
  ```
89
93
 
94
+ ### 其他功能完善中
95
+
90
96
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "qubitclient"
3
- version = "0.0.1"
3
+ version = "0.0.3.0"
4
4
  description = "qubit analysis client"
5
5
  authors = [
6
6
  { name = "Yaqiang Sun", email = "sunyaking@163.com" },
@@ -0,0 +1,6 @@
1
+ from .nnscope.nnscope_api.curve.curve_type import CurveType # noqa: F401
2
+ from .scope.scope import QubitScopeClient
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)
@@ -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",