QuLab 2.4.2__cp310-cp310-macosx_10_9_universal2.whl → 2.4.4__cp310-cp310-macosx_10_9_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.4.2
3
+ Version: 2.4.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,14 +1,14 @@
1
1
  qulab/__init__.py,sha256=P-Mx2p4TVmL91SoxoeXcj8Qm0x4xUf5Q_FLk0Yc_gIQ,138
2
2
  qulab/__main__.py,sha256=V5jIyfuCSi5dI6jvqgH_BpXG0URd6bgneDdVCM1dGSA,545
3
3
  qulab/dicttree.py,sha256=tRRMpGZYVOLw0TEByE3_2Ss8FdOmzuGL9e1DWbs8qoY,13684
4
- qulab/fun.cpython-310-darwin.so,sha256=gvblHrHtC05bG4q-RkPStkuft_g0qLVUS-SuKKysCDQ,126864
5
- qulab/version.py,sha256=-Jl0X_XeIIfpbtU5rpBV7cuIV0QKuAB3xXzeRWGaObE,21
4
+ qulab/fun.cpython-310-darwin.so,sha256=oIGlzkghvNCx6DMriXrvHThAWZRuN_PYx1ZtH_F9pnQ,126864
5
+ qulab/version.py,sha256=eqe1IjXqXc-Xs4eOzTI446GCAcUfeCDsvtEbD5f7b1A,21
6
6
  qulab/executor/__init__.py,sha256=LosPzOMaljSZY1thy_Fxtbrgq7uubJszMABEB7oM7tU,101
7
7
  qulab/executor/__main__.py,sha256=soBde_CbTJvvzIU1r2W2DCfQQY4fXMiwtzsXwTfohqw,2273
8
8
  qulab/executor/load.py,sha256=jZHkEzFF8ufFAIajkRDKmHYYJxbxI3RcEbAFIbl9VQ0,6208
9
- qulab/executor/schedule.py,sha256=u3S8b6AwfdXyM_kAfrWr9zCi15qS40nRRdFEVyzJMmI,8503
10
- qulab/executor/storage.py,sha256=uYT2GtNEVX-lwICvDFBRH4hanBnPGue1lu2srvqYI_A,4518
11
- qulab/executor/transform.py,sha256=Sy1ZmzkaP4RhUMempYxcIRjuzTxbC9UikUMBKuoVleE,2148
9
+ qulab/executor/schedule.py,sha256=-jd8cr-C6gv2WbJr8OUTQceqaqeV6fgGrSZ74xLN-Fo,8999
10
+ qulab/executor/storage.py,sha256=M66Q5_Uc5MMfc_QAuuaaexwAz7wxBPMkeleB5nRpQmI,4621
11
+ qulab/executor/transform.py,sha256=inaOn6eqCs22ZZ0xAQl8s8YCoEACaXSwFNNu7jqdwAk,2148
12
12
  qulab/executor/utils.py,sha256=vrwk2fAfSp3YLVZfrYPvxsVPpeuE2n-4G2Ae0eqdT4s,3080
13
13
  qulab/monitor/__init__.py,sha256=nTHelnDpxRS_fl_B38TsN0njgq8eVTEz9IAnN3NbDlM,42
14
14
  qulab/monitor/__main__.py,sha256=w3yUcqq195LzSnXTkQcuC1RSFRhy4oQ_PEBmucXguME,97
@@ -89,9 +89,9 @@ qulab/visualization/plot_seq.py,sha256=UWTS6p9nfX_7B8ehcYo6UnSTUCjkBsNU9jiOeW2ca
89
89
  qulab/visualization/qdat.py,sha256=ZeevBYWkzbww4xZnsjHhw7wRorJCBzbG0iEu-XQB4EA,5735
90
90
  qulab/visualization/rot3d.py,sha256=lMrEJlRLwYe6NMBlGkKYpp_V9CTipOAuDy6QW_cQK00,734
91
91
  qulab/visualization/widgets.py,sha256=6KkiTyQ8J-ei70LbPQZAK35wjktY47w2IveOa682ftA,3180
92
- QuLab-2.4.2.dist-info/LICENSE,sha256=PRzIKxZtpQcH7whTG6Egvzl1A0BvnSf30tmR2X2KrpA,1065
93
- QuLab-2.4.2.dist-info/METADATA,sha256=oeR6hPeYbUZz3ezTtCU2Mk-K8UymuWiufLMHC5Ytgww,3698
94
- QuLab-2.4.2.dist-info/WHEEL,sha256=Yd3eJSBM2hj8W-ouaiMfFUwQYAS-D6P73Ob9yN5MZd0,114
95
- QuLab-2.4.2.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
96
- QuLab-2.4.2.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
97
- QuLab-2.4.2.dist-info/RECORD,,
92
+ QuLab-2.4.4.dist-info/LICENSE,sha256=PRzIKxZtpQcH7whTG6Egvzl1A0BvnSf30tmR2X2KrpA,1065
93
+ QuLab-2.4.4.dist-info/METADATA,sha256=sVpPm8F4UlDlp6SxrbM-h_IU5EFIc_QB2__DgWrJlD4,3698
94
+ QuLab-2.4.4.dist-info/WHEEL,sha256=Yd3eJSBM2hj8W-ouaiMfFUwQYAS-D6P73Ob9yN5MZd0,114
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,,
@@ -7,8 +7,8 @@ from loguru import logger
7
7
 
8
8
  from . import transform
9
9
  from .load import load_workflow
10
- from .storage import (Result, find_result, renew_result, revoke_result,
11
- save_result)
10
+ from .storage import (Result, find_result, get_head, renew_result,
11
+ revoke_result, save_result)
12
12
 
13
13
 
14
14
  class CalibrationFailedError(Exception):
@@ -59,6 +59,20 @@ 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):
63
+ if check:
64
+ result = transform.params_to_result(
65
+ node.check_analyze(*data,
66
+ history=transform.result_to_params(history)))
67
+ result.fully_calibrated = False
68
+ else:
69
+ result = transform.params_to_result(
70
+ node.analyze(*data, history=transform.result_to_params(history)))
71
+ result.fully_calibrated = True
72
+ result.data = data
73
+ return result
74
+
75
+
62
76
  @functools.lru_cache(maxsize=128)
63
77
  def check_data(workflow: str, code_path: str | Path, state_path: str | Path,
64
78
  session_id: str) -> Result:
@@ -90,11 +104,12 @@ def check_data(workflow: str, code_path: str | Path, state_path: str | Path,
90
104
  node, 'check_analyze') and callable(node.check_analyze):
91
105
  logger.debug(f'Checking "{workflow}" with "check" method ...')
92
106
  data = node.check()
93
- logger.debug(f'Checked "{workflow}" !')
94
- result = transform.params_to_result(
95
- node.check_analyze(*data,
96
- history=transform.result_to_params(history)))
107
+ result = Result()
97
108
  result.data = data
109
+ save_result(workflow, result, state_path)
110
+
111
+ logger.debug(f'Checked "{workflow}" !')
112
+ result = call_analyzer(node, data, history, check=True)
98
113
  if result.in_spec:
99
114
  logger.debug(f'"{workflow}": checked in spec, renewing result')
100
115
  renew_result(workflow, state_path)
@@ -104,31 +119,32 @@ def check_data(workflow: str, code_path: str | Path, state_path: str | Path,
104
119
  else:
105
120
  logger.debug(f'Checking "{workflow}" with "calibrate" method ...')
106
121
  data = node.calibrate()
107
- logger.debug(f'Calibrated "{workflow}" !')
108
- result = transform.params_to_result(
109
- node.analyze(*data, history=transform.result_to_params(history)))
122
+ result = Result()
110
123
  result.data = data
111
- result.fully_calibrated = True
112
124
  save_result(workflow, result, state_path)
113
125
 
126
+ logger.debug(f'Calibrated "{workflow}" !')
127
+ result = call_analyzer(node, data, history, check=False)
128
+ save_result(workflow, result, state_path,
129
+ get_head(workflow, state_path))
130
+
114
131
  return result
115
132
 
116
133
 
117
134
  @functools.lru_cache(maxsize=128)
118
135
  def calibrate(workflow, code_path: str | Path, state_path: str | Path,
119
136
  session_id: str) -> Result:
120
- result = Result()
121
137
  node = load_workflow(workflow, code_path)
122
138
  history = find_result(workflow, state_path)
123
139
 
124
140
  logger.debug(f'Calibrating "{workflow}" ...')
125
141
  data = node.calibrate()
126
- logger.debug(f'Calibrated "{workflow}" !')
127
- result = transform.params_to_result(
128
- node.analyze(*data, history=transform.result_to_params(history)))
142
+ result = Result()
129
143
  result.data = data
130
- result.fully_calibrated = True
131
144
  save_result(workflow, result, state_path)
145
+ logger.debug(f'Calibrated "{workflow}" !')
146
+ result = call_analyzer(node, data, history, check=False)
147
+ save_result(workflow, result, state_path, get_head(workflow, state_path))
132
148
  return result
133
149
 
134
150
 
@@ -212,8 +228,7 @@ def maintain(node,
212
228
  return
213
229
 
214
230
 
215
- def run(node, code_path: str | Path,
216
- state_path: str | Path):
231
+ def run(node, code_path: str | Path, state_path: str | Path):
217
232
  logger.debug(f'run "{node}" without dependences.')
218
233
  result = calibrate(node, code_path, state_path)
219
234
  if result.bad_data or not result.in_spec:
qulab/executor/storage.py CHANGED
@@ -47,12 +47,16 @@ def random_path(base: Path) -> Path:
47
47
  return path
48
48
 
49
49
 
50
- def save_result(workflow: str, result: Result, base_path: str | Path):
50
+ def save_result(workflow: str,
51
+ result: Result,
52
+ base_path: str | Path,
53
+ path: Path | None = None):
51
54
  logger.debug(
52
55
  f'Saving result for "{workflow}", {result.in_spec=}, {result.bad_data=}, {result.fully_calibrated=}'
53
56
  )
54
57
  base_path = Path(base_path)
55
- path = random_path(base_path)
58
+ if path is None:
59
+ path = random_path(base_path)
56
60
  (base_path / 'objects' / path).parent.mkdir(parents=True, exist_ok=True)
57
61
  result.previous = get_head(workflow, base_path)
58
62
  with open(base_path / 'objects' / path, "wb") as f:
@@ -57,7 +57,7 @@ def params_to_result(params: tuple) -> Result:
57
57
  if state in ['In spec', 'OK']:
58
58
  result.in_spec = True
59
59
  result.bad_data = False
60
- elif state == ['Bad data', 'Bad']:
60
+ elif state in ['Bad data', 'Bad']:
61
61
  result.bad_data = True
62
62
  result.in_spec = False
63
63
  else:
Binary file
qulab/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.4.2"
1
+ __version__ = "2.4.4"
File without changes
File without changes