QuLab 2.5.3__cp312-cp312-macosx_10_13_universal2.whl → 2.5.4__cp312-cp312-macosx_10_13_universal2.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.5.3
3
+ Version: 2.5.4
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,19 +1,19 @@
1
1
  qulab/__init__.py,sha256=XnSePkDDgfbmEpu5uXK6spygxaqVt9emMubHYKIjSwc,244
2
2
  qulab/__main__.py,sha256=fjaRSL_uUjNIzBGNgjlGswb9TJ2VD5qnkZHW3hItrD4,68
3
3
  qulab/dicttree.py,sha256=tRRMpGZYVOLw0TEByE3_2Ss8FdOmzuGL9e1DWbs8qoY,13684
4
- qulab/fun.cpython-312-darwin.so,sha256=qd8SnofcjuEYWZA-RI1Kh3f1nwX60ck2E4kudttPs9c,126864
4
+ qulab/fun.cpython-312-darwin.so,sha256=Xy5kG_e3ih1w_mhSG3jDBLzIaN53MgKXEsXfXA6T6ec,126864
5
5
  qulab/typing.py,sha256=5xCLfrp1aZpKpDy4p2arbFszw2eK3hGUjZa-XSvC_-8,69
6
- qulab/version.py,sha256=Znn1LprC8WFThPHcZ2uVYHDtCMP4LIy30e8v1CDWFvU,21
6
+ qulab/version.py,sha256=kUk6VjaCueGXZEsY69h4VouFnQXNOenbPlluQV766gk,21
7
7
  qulab/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  qulab/cli/commands.py,sha256=tgDIkkeIoasQXAifJZ6NU8jDgpNgb2a-B0C4nF0evrE,559
9
9
  qulab/cli/config.py,sha256=SdNmWzweWAdyk8M2oKYhMxnkaJ0qIayPlsLGCNlVqME,3108
10
10
  qulab/executor/__init__.py,sha256=LosPzOMaljSZY1thy_Fxtbrgq7uubJszMABEB7oM7tU,101
11
- qulab/executor/cli.py,sha256=5rbAOnG8Me46qeWh9LbutE3zIcPD-MZVqmYoWUY4l3o,6674
12
- qulab/executor/load.py,sha256=OZmE_Pj2XcHzRDw5-1lF-ZDoMVqpaR-dWXf1K39ThXQ,12925
13
- qulab/executor/schedule.py,sha256=4D8o68Cx6vCkpSTMHzULTwuuq1tS8unc2n8WdBA9oB0,12013
11
+ qulab/executor/cli.py,sha256=ZGnQdUFZmU812gsnqbKhaJzwWLdoPt42CukPbZ7Yv8k,6684
12
+ qulab/executor/load.py,sha256=M4_CfWU65y5wXTNSaaJFp9Plui0wOtxPF181prD-HVU,14345
13
+ qulab/executor/schedule.py,sha256=SeeP3QwABoa8KWee_5QMwaSSjv6VwbRpDVTF1pHRnR0,12367
14
14
  qulab/executor/storage.py,sha256=s1xrI4bPTnyM4Nj0CkPxr3NdmnSp18LKnwm-ZoxR-Q0,7191
15
15
  qulab/executor/transform.py,sha256=AazWdlkEoOBaUJpTYsT5J4f0RanzCEeo-ThwEg8BB4Y,1262
16
- qulab/executor/utils.py,sha256=RNDEo17M-n_tge7uLITHxmoNNYSTm9OES75wQygR8dM,4065
16
+ qulab/executor/utils.py,sha256=VZ_VPYT2MFIfrCtfEW1I7T4NKFIbOvfVac8Sv377MTY,4221
17
17
  qulab/monitor/__init__.py,sha256=nTHelnDpxRS_fl_B38TsN0njgq8eVTEz9IAnN3NbDlM,42
18
18
  qulab/monitor/__main__.py,sha256=w3yUcqq195LzSnXTkQcuC1RSFRhy4oQ_PEBmucXguME,97
19
19
  qulab/monitor/config.py,sha256=fQ5JcsMApKc1UwANEnIvbDQZl8uYW0tle92SaYtX9lI,744
@@ -93,9 +93,9 @@ qulab/visualization/plot_seq.py,sha256=UWTS6p9nfX_7B8ehcYo6UnSTUCjkBsNU9jiOeW2ca
93
93
  qulab/visualization/qdat.py,sha256=ZeevBYWkzbww4xZnsjHhw7wRorJCBzbG0iEu-XQB4EA,5735
94
94
  qulab/visualization/rot3d.py,sha256=lMrEJlRLwYe6NMBlGkKYpp_V9CTipOAuDy6QW_cQK00,734
95
95
  qulab/visualization/widgets.py,sha256=6KkiTyQ8J-ei70LbPQZAK35wjktY47w2IveOa682ftA,3180
96
- QuLab-2.5.3.dist-info/LICENSE,sha256=PRzIKxZtpQcH7whTG6Egvzl1A0BvnSf30tmR2X2KrpA,1065
97
- QuLab-2.5.3.dist-info/METADATA,sha256=3Q3eK40_NlhnO2IeI2Ok-tPG7aEkDMQWj88cKwErDR0,3698
98
- QuLab-2.5.3.dist-info/WHEEL,sha256=iDXcyuxg-66TzzqHGH-kgw_HJdaJE_1RHznrvPNCSNs,115
99
- QuLab-2.5.3.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
100
- QuLab-2.5.3.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
101
- QuLab-2.5.3.dist-info/RECORD,,
96
+ QuLab-2.5.4.dist-info/LICENSE,sha256=PRzIKxZtpQcH7whTG6Egvzl1A0BvnSf30tmR2X2KrpA,1065
97
+ QuLab-2.5.4.dist-info/METADATA,sha256=TwwWVTHbmI2g3NKVmVe_gpJG-w5WgzzynlzzXe4yjBU,3698
98
+ QuLab-2.5.4.dist-info/WHEEL,sha256=iDXcyuxg-66TzzqHGH-kgw_HJdaJE_1RHznrvPNCSNs,115
99
+ QuLab-2.5.4.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
100
+ QuLab-2.5.4.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
101
+ QuLab-2.5.4.dist-info/RECORD,,
qulab/executor/cli.py CHANGED
@@ -83,7 +83,7 @@ def create(workflow, code):
83
83
  deps = find_unreferenced_workflows(code)
84
84
 
85
85
  with open(fname, 'w') as f:
86
- f.write(workflow_template(list(deps)))
86
+ f.write(workflow_template(workflow, list(deps)))
87
87
  click.echo(f'{workflow} created')
88
88
 
89
89
 
qulab/executor/load.py CHANGED
@@ -355,18 +355,50 @@ def load_workflow(workflow: str | tuple[str, dict],
355
355
 
356
356
  def get_dependents(workflow: WorkflowType,
357
357
  code_path: str | Path) -> list[WorkflowType]:
358
- return [
359
- load_workflow(n, code_path, mtime=workflow.__mtime__)
360
- for n in workflow.depends()
361
- ]
358
+ if callable(getattr(workflow, 'depends', None)):
359
+ if not can_call_without_args(workflow.depends):
360
+ raise AttributeError(
361
+ f'Workflow {workflow.__workflow_id__} "depends" function should not have any parameters'
362
+ )
363
+ return [
364
+ load_workflow(n, code_path, mtime=workflow.__mtime__)
365
+ for n in workflow.depends()
366
+ ]
367
+ elif isinstance(getattr(workflow, 'depends', None), (list, tuple)):
368
+ return [
369
+ load_workflow(n, code_path, mtime=workflow.__mtime__)
370
+ for n in workflow.depends
371
+ ]
372
+ elif getattr(workflow, 'entries', None) is None:
373
+ return []
374
+ else:
375
+ raise AttributeError(
376
+ f'Workflow {workflow.__workflow_id__} "depends" should be a callable or a list'
377
+ )
362
378
 
363
379
 
364
380
  def get_entries(workflow: WorkflowType,
365
381
  code_path: str | Path) -> list[WorkflowType]:
366
- return [
367
- load_workflow(n, code_path, mtime=workflow.__mtime__)
368
- for n in workflow.entries()
369
- ]
382
+ if callable(getattr(workflow, 'entries', None)):
383
+ if not can_call_without_args(workflow.entries):
384
+ raise AttributeError(
385
+ f'Workflow {workflow.__workflow_id__} "entries" function should not have any parameters'
386
+ )
387
+ return [
388
+ load_workflow(n, code_path, mtime=workflow.__mtime__)
389
+ for n in workflow.entries()
390
+ ]
391
+ elif isinstance(getattr(workflow, 'entries', None), (list, tuple)):
392
+ return [
393
+ load_workflow(n, code_path, mtime=workflow.__mtime__)
394
+ for n in workflow.entries
395
+ ]
396
+ elif getattr(workflow, 'entries', None) is None:
397
+ return []
398
+ else:
399
+ raise AttributeError(
400
+ f'Workflow {workflow.__workflow_id__} "entries" should be a callable or a list'
401
+ )
370
402
 
371
403
 
372
404
  def make_graph(workflow: WorkflowType, graph: dict, code_path: str | Path):
@@ -73,9 +73,17 @@ def call_analyzer(node,
73
73
  plot=False) -> Result:
74
74
  if check:
75
75
  result = node.check_analyze(result, history=history)
76
+ if not isinstance(result, Result):
77
+ raise TypeError(
78
+ f'"{node.__workflow_id__}" : "check_analyze" must return a Result object'
79
+ )
76
80
  result.fully_calibrated = False
77
81
  else:
78
82
  result = node.analyze(result, history=history)
83
+ if not isinstance(result, Result):
84
+ raise TypeError(
85
+ f'"{node.__workflow_id__}" : "analyze" must return a Result object'
86
+ )
79
87
  result.fully_calibrated = True
80
88
  if plot:
81
89
  call_plot(node, result)
qulab/executor/utils.py CHANGED
@@ -30,7 +30,7 @@ def dependent_tree(node: str, code_path: str | Path) -> dict[str, list[str]]:
30
30
  return tree
31
31
 
32
32
 
33
- def workflow_template(deps: list[str]) -> str:
33
+ def workflow_template(workflow: str, deps: list[str]) -> str:
34
34
  return f"""def VAR(s): pass # 没有实际作用,只是用来抑制编辑器的警告。
35
35
 
36
36
  import numpy as np
@@ -47,7 +47,7 @@ def depends():
47
47
 
48
48
 
49
49
  def calibrate():
50
- logger.info(f"run {{__name__}}")
50
+ logger.info(f"running {workflow} ...")
51
51
 
52
52
  # calibrate 是一个完整的校准实验,如power Rabi,Ramsey等。
53
53
  # 你需要足够的扫描点,以使得后续的 analyze 可以拟合出合适的参数。
@@ -58,10 +58,11 @@ def calibrate():
58
58
  for i in x:
59
59
  y.append(np.sin(i))
60
60
 
61
+ logger.info(f"running {workflow} ... finished!")
61
62
  return x, y
62
63
 
63
64
 
64
- def analyze(result: Result, history: Result | None) -> Result:
65
+ def analyze(result: Result, history: Result | None = None) -> Result:
65
66
  \"\"\"
66
67
  分析校准结果。
67
68
 
@@ -93,7 +94,7 @@ def analyze(result: Result, history: Result | None) -> Result:
93
94
 
94
95
 
95
96
  def check():
96
- logger.info(f"check {{__name__}}")
97
+ logger.info(f"checking {workflow} ...")
97
98
 
98
99
  # check 是一个快速检查实验,用于检查校准是否过时。
99
100
  # 你只需要少数扫描点,让后续的 check_analyze 知道参数是否漂移,数据
@@ -105,10 +106,11 @@ def check():
105
106
  for i in x:
106
107
  y.append(np.sin(i))
107
108
 
109
+ logger.info(f"checking {workflow} ... finished!")
108
110
  return x, y
109
111
 
110
112
 
111
- def check_analyze(result: Result, history: Result) -> Result:
113
+ def check_analyze(result: Result, history: Result | None = None) -> Result:
112
114
  \"\"\"
113
115
  分析检查结果。
114
116
 
Binary file
qulab/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.5.3"
1
+ __version__ = "2.5.4"
File without changes
File without changes