QuLab 2.6.2__tar.gz → 2.7.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.
Files changed (111) hide show
  1. {qulab-2.6.2 → qulab-2.7.0}/PKG-INFO +1 -1
  2. {qulab-2.6.2 → qulab-2.7.0}/QuLab.egg-info/PKG-INFO +1 -1
  3. {qulab-2.6.2 → qulab-2.7.0}/qulab/executor/cli.py +20 -10
  4. {qulab-2.6.2 → qulab-2.7.0}/qulab/executor/schedule.py +29 -6
  5. {qulab-2.6.2 → qulab-2.7.0}/qulab/executor/storage.py +1 -0
  6. {qulab-2.6.2 → qulab-2.7.0}/qulab/executor/transform.py +7 -0
  7. {qulab-2.6.2 → qulab-2.7.0}/qulab/executor/utils.py +18 -0
  8. qulab-2.7.0/qulab/version.py +1 -0
  9. qulab-2.6.2/qulab/version.py +0 -1
  10. {qulab-2.6.2 → qulab-2.7.0}/LICENSE +0 -0
  11. {qulab-2.6.2 → qulab-2.7.0}/MANIFEST.in +0 -0
  12. {qulab-2.6.2 → qulab-2.7.0}/QuLab.egg-info/SOURCES.txt +0 -0
  13. {qulab-2.6.2 → qulab-2.7.0}/QuLab.egg-info/dependency_links.txt +0 -0
  14. {qulab-2.6.2 → qulab-2.7.0}/QuLab.egg-info/entry_points.txt +0 -0
  15. {qulab-2.6.2 → qulab-2.7.0}/QuLab.egg-info/requires.txt +0 -0
  16. {qulab-2.6.2 → qulab-2.7.0}/QuLab.egg-info/top_level.txt +0 -0
  17. {qulab-2.6.2 → qulab-2.7.0}/README.md +0 -0
  18. {qulab-2.6.2 → qulab-2.7.0}/pyproject.toml +0 -0
  19. {qulab-2.6.2 → qulab-2.7.0}/qulab/__init__.py +0 -0
  20. {qulab-2.6.2 → qulab-2.7.0}/qulab/__main__.py +0 -0
  21. {qulab-2.6.2 → qulab-2.7.0}/qulab/cli/__init__.py +0 -0
  22. {qulab-2.6.2 → qulab-2.7.0}/qulab/cli/commands.py +0 -0
  23. {qulab-2.6.2 → qulab-2.7.0}/qulab/cli/config.py +0 -0
  24. {qulab-2.6.2 → qulab-2.7.0}/qulab/dicttree.py +0 -0
  25. {qulab-2.6.2 → qulab-2.7.0}/qulab/executor/__init__.py +0 -0
  26. {qulab-2.6.2 → qulab-2.7.0}/qulab/executor/load.py +0 -0
  27. {qulab-2.6.2 → qulab-2.7.0}/qulab/monitor/__init__.py +0 -0
  28. {qulab-2.6.2 → qulab-2.7.0}/qulab/monitor/__main__.py +0 -0
  29. {qulab-2.6.2 → qulab-2.7.0}/qulab/monitor/config.py +0 -0
  30. {qulab-2.6.2 → qulab-2.7.0}/qulab/monitor/dataset.py +0 -0
  31. {qulab-2.6.2 → qulab-2.7.0}/qulab/monitor/event_queue.py +0 -0
  32. {qulab-2.6.2 → qulab-2.7.0}/qulab/monitor/mainwindow.py +0 -0
  33. {qulab-2.6.2 → qulab-2.7.0}/qulab/monitor/monitor.py +0 -0
  34. {qulab-2.6.2 → qulab-2.7.0}/qulab/monitor/ploter.py +0 -0
  35. {qulab-2.6.2 → qulab-2.7.0}/qulab/monitor/qt_compat.py +0 -0
  36. {qulab-2.6.2 → qulab-2.7.0}/qulab/monitor/toolbar.py +0 -0
  37. {qulab-2.6.2 → qulab-2.7.0}/qulab/scan/__init__.py +0 -0
  38. {qulab-2.6.2 → qulab-2.7.0}/qulab/scan/curd.py +0 -0
  39. {qulab-2.6.2 → qulab-2.7.0}/qulab/scan/expression.py +0 -0
  40. {qulab-2.6.2 → qulab-2.7.0}/qulab/scan/models.py +0 -0
  41. {qulab-2.6.2 → qulab-2.7.0}/qulab/scan/optimize.py +0 -0
  42. {qulab-2.6.2 → qulab-2.7.0}/qulab/scan/query.py +0 -0
  43. {qulab-2.6.2 → qulab-2.7.0}/qulab/scan/record.py +0 -0
  44. {qulab-2.6.2 → qulab-2.7.0}/qulab/scan/scan.py +0 -0
  45. {qulab-2.6.2 → qulab-2.7.0}/qulab/scan/server.py +0 -0
  46. {qulab-2.6.2 → qulab-2.7.0}/qulab/scan/space.py +0 -0
  47. {qulab-2.6.2 → qulab-2.7.0}/qulab/scan/utils.py +0 -0
  48. {qulab-2.6.2 → qulab-2.7.0}/qulab/storage/__init__.py +0 -0
  49. {qulab-2.6.2 → qulab-2.7.0}/qulab/storage/__main__.py +0 -0
  50. {qulab-2.6.2 → qulab-2.7.0}/qulab/storage/backend/__init__.py +0 -0
  51. {qulab-2.6.2 → qulab-2.7.0}/qulab/storage/backend/redis.py +0 -0
  52. {qulab-2.6.2 → qulab-2.7.0}/qulab/storage/base_dataset.py +0 -0
  53. {qulab-2.6.2 → qulab-2.7.0}/qulab/storage/chunk.py +0 -0
  54. {qulab-2.6.2 → qulab-2.7.0}/qulab/storage/dataset.py +0 -0
  55. {qulab-2.6.2 → qulab-2.7.0}/qulab/storage/file.py +0 -0
  56. {qulab-2.6.2 → qulab-2.7.0}/qulab/storage/models/__init__.py +0 -0
  57. {qulab-2.6.2 → qulab-2.7.0}/qulab/storage/models/base.py +0 -0
  58. {qulab-2.6.2 → qulab-2.7.0}/qulab/storage/models/config.py +0 -0
  59. {qulab-2.6.2 → qulab-2.7.0}/qulab/storage/models/file.py +0 -0
  60. {qulab-2.6.2 → qulab-2.7.0}/qulab/storage/models/ipy.py +0 -0
  61. {qulab-2.6.2 → qulab-2.7.0}/qulab/storage/models/models.py +0 -0
  62. {qulab-2.6.2 → qulab-2.7.0}/qulab/storage/models/record.py +0 -0
  63. {qulab-2.6.2 → qulab-2.7.0}/qulab/storage/models/report.py +0 -0
  64. {qulab-2.6.2 → qulab-2.7.0}/qulab/storage/models/tag.py +0 -0
  65. {qulab-2.6.2 → qulab-2.7.0}/qulab/storage/storage.py +0 -0
  66. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/__init__.py +0 -0
  67. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/chat.py +0 -0
  68. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/device/__init__.py +0 -0
  69. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/device/basedevice.py +0 -0
  70. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/device/loader.py +0 -0
  71. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/device/utils.py +0 -0
  72. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/drivers/FakeInstrument.py +0 -0
  73. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/drivers/__init__.py +0 -0
  74. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/ipy_events.py +0 -0
  75. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/net/__init__.py +0 -0
  76. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/net/bencoder.py +0 -0
  77. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/net/cli.py +0 -0
  78. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/net/dhcp.py +0 -0
  79. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/net/dhcpd.py +0 -0
  80. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/net/kad.py +0 -0
  81. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/net/kcp.py +0 -0
  82. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/net/nginx.py +0 -0
  83. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/progress.py +0 -0
  84. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/rpc/__init__.py +0 -0
  85. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/rpc/client.py +0 -0
  86. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/rpc/exceptions.py +0 -0
  87. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/rpc/msgpack.py +0 -0
  88. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/rpc/msgpack.pyi +0 -0
  89. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/rpc/router.py +0 -0
  90. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/rpc/rpc.py +0 -0
  91. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/rpc/serialize.py +0 -0
  92. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/rpc/server.py +0 -0
  93. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/rpc/socket.py +0 -0
  94. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/rpc/utils.py +0 -0
  95. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/rpc/worker.py +0 -0
  96. {qulab-2.6.2 → qulab-2.7.0}/qulab/sys/rpc/zmq_socket.py +0 -0
  97. {qulab-2.6.2 → qulab-2.7.0}/qulab/typing.py +0 -0
  98. {qulab-2.6.2 → qulab-2.7.0}/qulab/visualization/__init__.py +0 -0
  99. {qulab-2.6.2 → qulab-2.7.0}/qulab/visualization/__main__.py +0 -0
  100. {qulab-2.6.2 → qulab-2.7.0}/qulab/visualization/_autoplot.py +0 -0
  101. {qulab-2.6.2 → qulab-2.7.0}/qulab/visualization/plot_circ.py +0 -0
  102. {qulab-2.6.2 → qulab-2.7.0}/qulab/visualization/plot_layout.py +0 -0
  103. {qulab-2.6.2 → qulab-2.7.0}/qulab/visualization/plot_seq.py +0 -0
  104. {qulab-2.6.2 → qulab-2.7.0}/qulab/visualization/qdat.py +0 -0
  105. {qulab-2.6.2 → qulab-2.7.0}/qulab/visualization/rot3d.py +0 -0
  106. {qulab-2.6.2 → qulab-2.7.0}/qulab/visualization/widgets.py +0 -0
  107. {qulab-2.6.2 → qulab-2.7.0}/setup.cfg +0 -0
  108. {qulab-2.6.2 → qulab-2.7.0}/setup.py +0 -0
  109. {qulab-2.6.2 → qulab-2.7.0}/src/qulab.h +0 -0
  110. {qulab-2.6.2 → qulab-2.7.0}/tests/test_kad.py +0 -0
  111. {qulab-2.6.2 → qulab-2.7.0}/tests/test_scan.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: QuLab
3
- Version: 2.6.2
3
+ Version: 2.7.0
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,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: QuLab
3
- Version: 2.6.2
3
+ Version: 2.7.0
4
4
  Summary: contral instruments and manage data
5
5
  Author-email: feihoo87 <feihoo87@gmail.com>
6
6
  Maintainer-email: feihoo87 <feihoo87@gmail.com>
@@ -10,9 +10,9 @@ from loguru import logger
10
10
  from ..cli.config import get_config_value, log_options
11
11
  from .load import (WorkflowType, find_unreferenced_workflows, get_entries,
12
12
  load_workflow, make_graph)
13
+ from .schedule import CalibrationFailedError
13
14
  from .schedule import maintain as maintain_workflow
14
15
  from .schedule import run as run_workflow
15
- from .schedule import CalibrationFailedError
16
16
  from .transform import set_config_api
17
17
  from .utils import workflow_template
18
18
 
@@ -137,10 +137,10 @@ def get(key, api):
137
137
  is_flag=True,
138
138
  help='Do not run dependents.')
139
139
  @click.option('--retry', '-r', default=1, type=int, help='Retry times.')
140
- @click.option('--update', '-u', is_flag=True)
140
+ @click.option('--freeze', is_flag=True, help='Freeze the config table.')
141
141
  @log_options
142
142
  @command_option('run')
143
- def run(workflow, code, data, api, plot, no_dependents, retry, update):
143
+ def run(workflow, code, data, api, plot, no_dependents, retry, freeze):
144
144
  """
145
145
  Run a workflow.
146
146
  """
@@ -149,7 +149,7 @@ def run(workflow, code, data, api, plot, no_dependents, retry, update):
149
149
  f'{" --plot" if plot else ""}'
150
150
  f'{" --no-dependents" if no_dependents else ""}'
151
151
  f' --retry {retry}'
152
- f'{" --update " if update else ""}')
152
+ f'{" --freeze " if freeze else ""}')
153
153
  if api is not None:
154
154
  api = importlib.import_module(api)
155
155
  set_config_api(api.query_config, api.update_config, api.export_config)
@@ -173,9 +173,9 @@ def run(workflow, code, data, api, plot, no_dependents, retry, update):
173
173
  code,
174
174
  data,
175
175
  plot=plot,
176
- update=update)
176
+ freeze=freeze)
177
177
  else:
178
- run_workflow(wf, code, data, plot=plot, update=update)
178
+ run_workflow(wf, code, data, plot=plot, freeze=freeze)
179
179
  else:
180
180
  if hasattr(wf, 'entries'):
181
181
  for entry in get_entries(wf, code):
@@ -184,14 +184,14 @@ def run(workflow, code, data, api, plot, no_dependents, retry, update):
184
184
  data,
185
185
  run=True,
186
186
  plot=plot,
187
- update=update)
187
+ freeze=freeze)
188
188
  else:
189
189
  maintain_workflow(wf,
190
190
  code,
191
191
  data,
192
192
  run=True,
193
193
  plot=plot,
194
- update=update)
194
+ freeze=freeze)
195
195
  break
196
196
  except CalibrationFailedError as e:
197
197
  if i == retry - 1:
@@ -232,9 +232,19 @@ def maintain(workflow, code, data, api, retry, plot):
232
232
  try:
233
233
  if hasattr(wf, 'entries'):
234
234
  for entry in get_entries(wf, code):
235
- maintain_workflow(entry, code, data, run=False, plot=plot)
235
+ maintain_workflow(entry,
236
+ code,
237
+ data,
238
+ run=False,
239
+ plot=plot,
240
+ freeze=False)
236
241
  else:
237
- maintain_workflow(wf, code, data, run=False, plot=plot)
242
+ maintain_workflow(wf,
243
+ code,
244
+ data,
245
+ run=False,
246
+ plot=plot,
247
+ freeze=False)
238
248
  except CalibrationFailedError as e:
239
249
  if i == retry - 1:
240
250
  raise e
@@ -9,7 +9,7 @@ from loguru import logger
9
9
  from .load import WorkflowType, get_dependents
10
10
  from .storage import (Result, find_result, renew_result, revoke_result,
11
11
  save_result)
12
- from .transform import current_config, update_parameters
12
+ from .transform import current_config, obey_the_oracle, update_parameters
13
13
 
14
14
 
15
15
  class CalibrationFailedError(Exception):
@@ -100,6 +100,18 @@ def call_analyzer(node,
100
100
  else:
101
101
  result = node.analyze(result, history=history)
102
102
  veryfy_analyzed_result(result, node.__workflow_id__, "analyze")
103
+ if hasattr(node, 'oracle') and callable(node.oracle):
104
+ logger.debug(
105
+ f'"{node.__workflow_id__}" has oracle method, calling ...')
106
+ try:
107
+ result = node.oracle(result, history=history)
108
+ except Exception as e:
109
+ logger.exception(e)
110
+ result.oracle = {}
111
+ if not is_pickleable(result.oracle):
112
+ raise TypeError(
113
+ f'"{node.__workflow_id__}" : "oracle" return not pickleable data'
114
+ )
103
115
  result.fully_calibrated = True
104
116
  if plot:
105
117
  call_plot(node, result)
@@ -276,6 +288,7 @@ def diagnose(workflow: WorkflowType, code_path: str | Path,
276
288
 
277
289
  result = calibrate(workflow, code_path, state_path, plot, session_id)
278
290
  if result.bad_data or not result.in_spec:
291
+ obey_the_oracle(result, state_path)
279
292
  raise CalibrationFailedError(
280
293
  f'"{workflow.__workflow_id__}": All dependents passed, but calibration failed!'
281
294
  )
@@ -290,7 +303,7 @@ def maintain(workflow: WorkflowType,
290
303
  session_id: str | None = None,
291
304
  run: bool = False,
292
305
  plot: bool = False,
293
- update: bool = True):
306
+ freeze: bool = False):
294
307
  if session_id is None:
295
308
  session_id = uuid.uuid4().hex
296
309
  logger.debug(f'run "{workflow.__workflow_id__}"'
@@ -300,7 +313,13 @@ def maintain(workflow: WorkflowType,
300
313
  logger.debug(
301
314
  f'maintain "{n.__workflow_id__}" because it is depended by "{workflow.__workflow_id__}"'
302
315
  )
303
- maintain(n, code_path, state_path, session_id, run=False, plot=plot)
316
+ maintain(n,
317
+ code_path,
318
+ state_path,
319
+ session_id,
320
+ run=False,
321
+ plot=plot,
322
+ freeze=freeze)
304
323
  else:
305
324
  logger.debug(
306
325
  f'"{workflow.__workflow_id__}": All dependents maintained')
@@ -331,10 +350,12 @@ def maintain(workflow: WorkflowType,
331
350
  logger.debug(f'recalibrate "{workflow.__workflow_id__}"')
332
351
  result = calibrate(workflow, code_path, state_path, plot, session_id)
333
352
  if result.bad_data or not result.in_spec:
353
+ if not freeze:
354
+ obey_the_oracle(result, state_path)
334
355
  raise CalibrationFailedError(
335
356
  f'"{workflow.__workflow_id__}": All dependents passed, but calibration failed!'
336
357
  )
337
- if update:
358
+ if not freeze:
338
359
  update_parameters(result, state_path)
339
360
  return
340
361
 
@@ -344,7 +365,7 @@ def run(workflow: WorkflowType,
344
365
  code_path: str | Path,
345
366
  state_path: str | Path,
346
367
  plot: bool = False,
347
- update: bool = True):
368
+ freeze: bool = False):
348
369
  session_id = uuid.uuid4().hex
349
370
  logger.debug(f'run "{workflow.__workflow_id__}" without dependences.')
350
371
  result = calibrate(workflow,
@@ -353,9 +374,11 @@ def run(workflow: WorkflowType,
353
374
  plot,
354
375
  session_id=session_id)
355
376
  if result.bad_data or not result.in_spec:
377
+ if not freeze:
378
+ obey_the_oracle(result, state_path)
356
379
  raise CalibrationFailedError(
357
380
  f'"{workflow.__workflow_id__}": All dependents passed, but calibration failed!'
358
381
  )
359
- if update:
382
+ if not freeze:
360
383
  update_parameters(result, state_path)
361
384
  return
@@ -23,6 +23,7 @@ class Result():
23
23
  checked_time: datetime = field(default_factory=datetime.now)
24
24
  ttl: timedelta = timedelta(days=3650)
25
25
  parameters: dict = field(default_factory=dict)
26
+ oracle: dict = field(default_factory=dict)
26
27
  other_infomation: dict = field(default_factory=dict)
27
28
  data: Any = field(default_factory=tuple)
28
29
  index: int = -1
@@ -43,6 +43,13 @@ def _export_config() -> dict:
43
43
  return parameters
44
44
 
45
45
 
46
+ def obey_the_oracle(result: Result, data_path):
47
+ global __current_config_id
48
+ update_config(result.oracle)
49
+ cfg = export_config()
50
+ __current_config_id = save_config(cfg, data_path)
51
+
52
+
46
53
  def update_parameters(result: Result, data_path):
47
54
  global __current_config_id
48
55
  update_config(result.parameters)
@@ -133,6 +133,24 @@ def check_analyze(result: Result, history: Result | None = None) -> Result:
133
133
  result.state = random.choice(['Outdated', 'OK', 'Bad'])
134
134
 
135
135
  return result
136
+
137
+
138
+ def oracle(result: Result, history: Result | None = None):
139
+ \"\"\"
140
+ 谕示:指凭直觉或经验判断,改动某些配置,以期望下次校准成功。
141
+
142
+ 当校准失败时,根据 analyze 的结果,尝试改变某些配置再重新校准整个系统。
143
+ 比如通常我们在死活测不到 rabi 或能谱时,会换一个 idle bias 再试试。这
144
+ 里我们凭直觉设的那个 bias 值,就是一个谕示,可以通过 oracle 来设定。
145
+
146
+ 该函数代入的参数 result 是 analyze 函数的返回值。
147
+ \"\"\"
148
+ result.oracle = {{}}
149
+
150
+ # result.oracle['Q0.bias'] = 0.1
151
+ # result.oracle['Q1.bias'] = -0.03
152
+
153
+ return result
136
154
  """
137
155
 
138
156
 
@@ -0,0 +1 @@
1
+ __version__ = "2.7.0"
@@ -1 +0,0 @@
1
- __version__ = "2.6.2"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes