QuLab 2.4.4__cp310-cp310-win_amd64.whl → 2.4.6__cp310-cp310-win_amd64.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: QuLab
3
- Version: 2.4.4
3
+ Version: 2.4.6
4
4
  Summary: contral instruments and manage data
5
5
  Author-email: feihoo87 <feihoo87@gmail.com>
6
6
  Maintainer-email: feihoo87 <feihoo87@gmail.com>
@@ -1,15 +1,15 @@
1
1
  qulab/__init__.py,sha256=vkFybY8YSsQilYdThPRD83-btPAR41sy_WCXiM-6mME,141
2
2
  qulab/__main__.py,sha256=sQ1z8lk9Q4pq7X9lEzLcY8t6Izr6uxQXO0t3qnTUxEs,575
3
3
  qulab/dicttree.py,sha256=ZoSJVWK4VMqfzj42gPb_n5RqLlM6K1Me0WmLIfLEYf8,14195
4
- qulab/fun.cp310-win_amd64.pyd,sha256=oD7gx55ReJ4LcZjOiz23Bdd6FewfavJpfOHE2aS6PuM,31232
5
- qulab/version.py,sha256=eqe1IjXqXc-Xs4eOzTI446GCAcUfeCDsvtEbD5f7b1A,21
4
+ qulab/fun.cp310-win_amd64.pyd,sha256=eJQEy1F2QY5IlzZ-m8oRhiTlnfLb-1lJDOGKrlahNVE,31232
5
+ qulab/version.py,sha256=jzWsJzFuYAnC9Fllul1PYEIxXD-Lspqc6-IMg65EXLc,21
6
6
  qulab/executor/__init__.py,sha256=LosPzOMaljSZY1thy_Fxtbrgq7uubJszMABEB7oM7tU,101
7
- qulab/executor/__main__.py,sha256=soBde_CbTJvvzIU1r2W2DCfQQY4fXMiwtzsXwTfohqw,2273
7
+ qulab/executor/__main__.py,sha256=1Mg5fJ0dYSWQnP6wgTa0s6U_WH7NT2lCnCQOHyx_I7c,2430
8
8
  qulab/executor/load.py,sha256=jZHkEzFF8ufFAIajkRDKmHYYJxbxI3RcEbAFIbl9VQ0,6208
9
- qulab/executor/schedule.py,sha256=-jd8cr-C6gv2WbJr8OUTQceqaqeV6fgGrSZ74xLN-Fo,8999
9
+ qulab/executor/schedule.py,sha256=blxX1wYEjbJcV6Su3ftQma8fGoMMQ_1t276PPoDjhfU,9524
10
10
  qulab/executor/storage.py,sha256=M66Q5_Uc5MMfc_QAuuaaexwAz7wxBPMkeleB5nRpQmI,4621
11
11
  qulab/executor/transform.py,sha256=inaOn6eqCs22ZZ0xAQl8s8YCoEACaXSwFNNu7jqdwAk,2148
12
- qulab/executor/utils.py,sha256=vrwk2fAfSp3YLVZfrYPvxsVPpeuE2n-4G2Ae0eqdT4s,3080
12
+ qulab/executor/utils.py,sha256=n3uCSKh-qdDFFeNvOpj7_es2_B4AaC-ASAlV9gPmSO0,3086
13
13
  qulab/monitor/__init__.py,sha256=xEVDkJF8issrsDeLqQmDsvtRmrf-UiViFcGTWuzdlFU,43
14
14
  qulab/monitor/__main__.py,sha256=k2H1H5Zf9LLXTDLISJkbikLH-z0f1e5i5i6wXXYPOrE,105
15
15
  qulab/monitor/config.py,sha256=y_5StMkdrbZO1ziyKBrvIkB7Jclp9RCPK1QbsOhCxnY,785
@@ -89,9 +89,9 @@ qulab/visualization/plot_seq.py,sha256=Uo1-dB1YE9IN_A9tuaOs9ZG3S5dKDQ_l98iD2Wbxp
89
89
  qulab/visualization/qdat.py,sha256=HubXFu4nfcA7iUzghJGle1C86G6221hicLR0b-GqhKQ,5887
90
90
  qulab/visualization/rot3d.py,sha256=jGHJcqj1lEWBUV-W4GUGONGacqjrYvuFoFCwPse5h1Y,757
91
91
  qulab/visualization/widgets.py,sha256=HcYwdhDtLreJiYaZuN3LfofjJmZcLwjMfP5aasebgDo,3266
92
- QuLab-2.4.4.dist-info/LICENSE,sha256=b4NRQ-GFVpJMT7RuExW3NwhfbrYsX7AcdB7Gudok-fs,1086
93
- QuLab-2.4.4.dist-info/METADATA,sha256=hOQ-0Zjv6-o1E0uCKLsq9g5m3LOWXgkndX7k2m7DT4g,3803
94
- QuLab-2.4.4.dist-info/WHEEL,sha256=rzGfZgUcGeKSgIHGYMuqg4xE4VPHxnaldXH6BG0zjVk,101
95
- QuLab-2.4.4.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
96
- QuLab-2.4.4.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
97
- QuLab-2.4.4.dist-info/RECORD,,
92
+ QuLab-2.4.6.dist-info/LICENSE,sha256=b4NRQ-GFVpJMT7RuExW3NwhfbrYsX7AcdB7Gudok-fs,1086
93
+ QuLab-2.4.6.dist-info/METADATA,sha256=dXxMT8Nr0xEqQVWXkHMyA8idl_gbgkZPhrABWkek-PQ,3803
94
+ QuLab-2.4.6.dist-info/WHEEL,sha256=rzGfZgUcGeKSgIHGYMuqg4xE4VPHxnaldXH6BG0zjVk,101
95
+ QuLab-2.4.6.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
96
+ QuLab-2.4.6.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
97
+ QuLab-2.4.6.dist-info/RECORD,,
@@ -4,7 +4,8 @@ from pathlib import Path
4
4
  import click
5
5
 
6
6
  from .load import find_unreferenced_workflows
7
- from .schedule import maintain as maintain_workflow, run as run_workflow
7
+ from .schedule import maintain as maintain_workflow
8
+ from .schedule import run as run_workflow
8
9
  from .transform import set_config_api
9
10
  from .utils import workflow_template
10
11
 
@@ -41,9 +42,10 @@ def create(workflow, code):
41
42
  @click.argument('workflow')
42
43
  @click.option('--code', '-c', default=None)
43
44
  @click.option('--data', '-d', default=None)
44
- @click.option('--api', '-g', default=None)
45
+ @click.option('--api', '-a', default=None)
46
+ @click.option('--plot', '-p', is_flag=True)
45
47
  @click.option('--no-dependents', '-n', is_flag=True)
46
- def run(workflow, code, data, api, no_dependents):
48
+ def run(workflow, code, data, api, plot, no_dependents):
47
49
  """
48
50
  Run a workflow.
49
51
  """
@@ -56,17 +58,18 @@ def run(workflow, code, data, api, no_dependents):
56
58
  data = Path(code) / 'logs'
57
59
 
58
60
  if no_dependents:
59
- run_workflow(workflow, code, data)
61
+ run_workflow(workflow, code, data, plot=plot)
60
62
  else:
61
- maintain_workflow(workflow, code, data, run=True)
63
+ maintain_workflow(workflow, code, data, run=True, plot=plot)
62
64
 
63
65
 
64
66
  @click.command()
65
67
  @click.argument('workflow')
66
68
  @click.option('--code', '-c', default=None)
67
69
  @click.option('--data', '-d', default=None)
68
- @click.option('--api', '-g', default=None)
69
- def maintain(workflow, code, data, api):
70
+ @click.option('--api', '-a', default=None)
71
+ @click.option('--plot', '-p', is_flag=True)
72
+ def maintain(workflow, code, data, api, plot):
70
73
  """
71
74
  Maintain a workflow.
72
75
  """
@@ -78,7 +81,7 @@ def maintain(workflow, code, data, api):
78
81
  if data is None:
79
82
  data = Path(code) / 'logs'
80
83
 
81
- maintain_workflow(workflow, code, data, run=False)
84
+ maintain_workflow(workflow, code, data, run=False, plot=plot)
82
85
 
83
86
 
84
87
  cli.add_command(maintain)
@@ -59,7 +59,7 @@ def check_state(workflow: str, code_path: str | Path,
59
59
  return True
60
60
 
61
61
 
62
- def call_analyzer(node, data, history, check=False):
62
+ def call_analyzer(node, data, history, check=False, plot=False):
63
63
  if check:
64
64
  result = transform.params_to_result(
65
65
  node.check_analyze(*data,
@@ -69,13 +69,21 @@ def call_analyzer(node, data, history, check=False):
69
69
  result = transform.params_to_result(
70
70
  node.analyze(*data, history=transform.result_to_params(history)))
71
71
  result.fully_calibrated = True
72
+ if plot:
73
+ call_plot(node, result)
72
74
  result.data = data
73
75
  return result
74
76
 
75
77
 
78
+ def call_plot(node, result, check=False):
79
+ if hasattr(node, 'plot') and callable(node.plot):
80
+ state, params, other = transform.result_to_params(result)
81
+ node.plot(state, params, other)
82
+
83
+
76
84
  @functools.lru_cache(maxsize=128)
77
85
  def check_data(workflow: str, code_path: str | Path, state_path: str | Path,
78
- session_id: str) -> Result:
86
+ plot: bool, session_id: str) -> Result:
79
87
  """
80
88
  check data answers two questions:
81
89
  Is the parameter associated with this cal in spec,
@@ -109,7 +117,7 @@ def check_data(workflow: str, code_path: str | Path, state_path: str | Path,
109
117
  save_result(workflow, result, state_path)
110
118
 
111
119
  logger.debug(f'Checked "{workflow}" !')
112
- result = call_analyzer(node, data, history, check=True)
120
+ result = call_analyzer(node, data, history, check=True, plot=plot)
113
121
  if result.in_spec:
114
122
  logger.debug(f'"{workflow}": checked in spec, renewing result')
115
123
  renew_result(workflow, state_path)
@@ -124,7 +132,7 @@ def check_data(workflow: str, code_path: str | Path, state_path: str | Path,
124
132
  save_result(workflow, result, state_path)
125
133
 
126
134
  logger.debug(f'Calibrated "{workflow}" !')
127
- result = call_analyzer(node, data, history, check=False)
135
+ result = call_analyzer(node, data, history, check=False, plot=plot)
128
136
  save_result(workflow, result, state_path,
129
137
  get_head(workflow, state_path))
130
138
 
@@ -133,7 +141,7 @@ def check_data(workflow: str, code_path: str | Path, state_path: str | Path,
133
141
 
134
142
  @functools.lru_cache(maxsize=128)
135
143
  def calibrate(workflow, code_path: str | Path, state_path: str | Path,
136
- session_id: str) -> Result:
144
+ plot: bool, session_id: str) -> Result:
137
145
  node = load_workflow(workflow, code_path)
138
146
  history = find_result(workflow, state_path)
139
147
 
@@ -143,38 +151,36 @@ def calibrate(workflow, code_path: str | Path, state_path: str | Path,
143
151
  result.data = data
144
152
  save_result(workflow, result, state_path)
145
153
  logger.debug(f'Calibrated "{workflow}" !')
146
- result = call_analyzer(node, data, history, check=False)
154
+ result = call_analyzer(node, data, history, check=False, plot=plot)
147
155
  save_result(workflow, result, state_path, get_head(workflow, state_path))
148
156
  return result
149
157
 
150
158
 
151
- def diagnose(node, code_path: str | Path, state_path: str | Path,
159
+ def diagnose(node, code_path: str | Path, state_path: str | Path, plot: bool,
152
160
  session_id: str):
153
161
  '''
154
162
  Returns: True if node or dependent recalibrated.
155
163
  '''
156
164
  logger.debug(f'diagnose "{node}"')
157
165
  # check_data
158
- result = check_data(node, code_path, state_path, session_id)
166
+ result = check_data(node, code_path, state_path, plot, session_id)
159
167
  # in spec case
160
168
  if result.in_spec:
169
+ logger.debug(f'"{node}": Checked! In spec, no need to diagnose')
161
170
  return False
162
171
  # bad data case
163
172
  recalibrated = []
164
173
  if result.bad_data:
165
174
  recalibrated = [
166
- diagnose(n, code_path, state_path, session_id)
175
+ diagnose(n, code_path, state_path, plot, session_id)
167
176
  for n in get_dependents(node, code_path)
168
177
  ]
169
- if not any(recalibrated):
178
+ if not any(recalibrated) and recalibrated:
179
+ logger.debug(f'"{node}": no dependents recalibrated.')
170
180
  return False
171
181
  # calibrate
172
- if result.fully_calibrated and result.in_spec:
173
- pass
174
- else:
175
- logger.debug(
176
- f'recalibrate "{node}" because some dependents recalibrated')
177
- result = calibrate(node, code_path, state_path, session_id)
182
+ logger.debug(f'recalibrate "{node}" because some dependents recalibrated')
183
+ result = calibrate(node, code_path, state_path, plot, session_id)
178
184
  if result.bad_data or not result.in_spec:
179
185
  raise CalibrationFailedError(
180
186
  f'"{node}": All dependents passed, but calibration failed!')
@@ -191,7 +197,8 @@ def maintain(node,
191
197
  code_path: str | Path,
192
198
  state_path: str | Path,
193
199
  session_id: str | None = None,
194
- run: bool = False):
200
+ run: bool = False,
201
+ plot: bool = False):
195
202
  if session_id is None:
196
203
  session_id = uuid.uuid4().hex
197
204
  logger.debug(f'run "{node}"' if run else f'maintain "{node}"')
@@ -206,7 +213,7 @@ def maintain(node,
206
213
  logger.debug(f'"{node}": In spec, no need to maintain')
207
214
  return
208
215
  # check_data
209
- result = check_data(node, code_path, state_path, session_id)
216
+ result = check_data(node, code_path, state_path, plot, session_id)
210
217
  if result.in_spec:
211
218
  if not run:
212
219
  logger.debug(f'"{node}": In spec, no need to maintain')
@@ -215,12 +222,12 @@ def maintain(node,
215
222
  logger.debug(f'"{node}": Bad data, diagnosing dependents')
216
223
  for n in get_dependents(node, code_path):
217
224
  logger.debug(f'diagnose "{n}" because of "{node}" bad data')
218
- diagnose(n, code_path, state_path, session_id)
225
+ diagnose(n, code_path, state_path, plot, session_id)
219
226
  else:
220
227
  logger.debug(f'"{node}": All dependents diagnosed')
221
228
  # calibrate
222
229
  logger.debug(f'recalibrate "{node}"')
223
- result = calibrate(node, code_path, state_path, session_id)
230
+ result = calibrate(node, code_path, state_path, plot, session_id)
224
231
  if result.bad_data or not result.in_spec:
225
232
  raise CalibrationFailedError(
226
233
  f'"{node}": All dependents passed, but calibration failed!')
@@ -228,9 +235,12 @@ def maintain(node,
228
235
  return
229
236
 
230
237
 
231
- def run(node, code_path: str | Path, state_path: str | Path):
238
+ def run(node,
239
+ code_path: str | Path,
240
+ state_path: str | Path,
241
+ plot: bool = False):
232
242
  logger.debug(f'run "{node}" without dependences.')
233
- result = calibrate(node, code_path, state_path)
243
+ result = calibrate(node, code_path, state_path, plot)
234
244
  if result.bad_data or not result.in_spec:
235
245
  raise CalibrationFailedError(
236
246
  f'"{node}": All dependents passed, but calibration failed!')
qulab/executor/utils.py CHANGED
@@ -38,7 +38,7 @@ import numpy as np
38
38
 
39
39
 
40
40
  # 多长时间应该检查一次校准实验,单位是秒。
41
- __timeout__ = 200
41
+ __timeout__ = 7*24*3600
42
42
 
43
43
  def depends():
44
44
  return [{deps!r}]
Binary file
qulab/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.4.4"
1
+ __version__ = "2.4.6"
File without changes
File without changes