labmate 0.8.3__py3-none-any.whl → 0.8.4__py3-none-any.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.
- labmate/__config__.py +1 -1
- labmate/acquisition/acquisition_data.py +47 -8
- labmate/acquisition/acquisition_loop.py +1 -3
- labmate/acquisition/acquisition_manager.py +3 -0
- labmate/acquisition_notebook/acquisition_analysis_manager.py +15 -2
- {labmate-0.8.3.dist-info → labmate-0.8.4.dist-info}/METADATA +1 -1
- {labmate-0.8.3.dist-info → labmate-0.8.4.dist-info}/RECORD +10 -10
- {labmate-0.8.3.dist-info → labmate-0.8.4.dist-info}/LICENCE +0 -0
- {labmate-0.8.3.dist-info → labmate-0.8.4.dist-info}/WHEEL +0 -0
- {labmate-0.8.3.dist-info → labmate-0.8.4.dist-info}/top_level.txt +0 -0
labmate/__config__.py
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"""Module that contains NotebookAcquisitionData class."""
|
|
2
|
+
|
|
2
3
|
from typing import Dict, List, Optional, Union
|
|
3
4
|
|
|
4
5
|
from dh5 import DH5
|
|
5
|
-
from ..utils.file_read import read_files
|
|
6
6
|
|
|
7
|
+
from ..utils.file_read import read_files
|
|
7
8
|
from .logger_setup import logger
|
|
8
9
|
|
|
9
10
|
|
|
@@ -14,6 +15,9 @@ class NotebookAcquisitionData(DH5):
|
|
|
14
15
|
`cell` is a str. It saves using `save_cell` function that will save it to `..._CELL.py` file
|
|
15
16
|
"""
|
|
16
17
|
|
|
18
|
+
_current_step: int
|
|
19
|
+
_cells: Dict[int, Optional[str]]
|
|
20
|
+
|
|
17
21
|
def __init__(
|
|
18
22
|
self,
|
|
19
23
|
filepath: str,
|
|
@@ -58,10 +62,11 @@ class NotebookAcquisitionData(DH5):
|
|
|
58
62
|
self._config = configs
|
|
59
63
|
self.save_configs()
|
|
60
64
|
|
|
61
|
-
self.
|
|
62
|
-
self.save_cell(cell=cell)
|
|
65
|
+
self._cells = {1: cell}
|
|
66
|
+
self.save_cell(cell=cell, suffix="1")
|
|
63
67
|
|
|
64
68
|
self.experiment_name = experiment_name
|
|
69
|
+
self.current_step = 1
|
|
65
70
|
|
|
66
71
|
self["useful"] = False
|
|
67
72
|
|
|
@@ -95,7 +100,12 @@ class NotebookAcquisitionData(DH5):
|
|
|
95
100
|
with open(filepath + "_" + name, "w", encoding="utf-8") as file:
|
|
96
101
|
file.write(value)
|
|
97
102
|
|
|
98
|
-
def save_cell(
|
|
103
|
+
def save_cell(
|
|
104
|
+
self,
|
|
105
|
+
cell: Optional[str] = None,
|
|
106
|
+
filepath: Optional[str] = None,
|
|
107
|
+
suffix: Optional[str] = None,
|
|
108
|
+
):
|
|
99
109
|
"""Save the cell code to the h5 file and possibly to a file.
|
|
100
110
|
|
|
101
111
|
If `save_files` during init was set to True, then it will create a '.py' file near
|
|
@@ -108,14 +118,15 @@ class NotebookAcquisitionData(DH5):
|
|
|
108
118
|
the desired location, i.e. it should end with the file prefix to which the suffix and
|
|
109
119
|
'py' extension will be added. Defaults to save filepath as h5 file.
|
|
110
120
|
"""
|
|
111
|
-
cell = cell or self._cell
|
|
112
121
|
if cell == "none":
|
|
113
122
|
return
|
|
114
123
|
if cell is None or cell == "":
|
|
115
124
|
logger.warning("Acquisition cell is not set. Nothing to save")
|
|
116
125
|
return
|
|
117
|
-
|
|
118
|
-
|
|
126
|
+
if suffix is not None:
|
|
127
|
+
self[f"acquisition_cell/{suffix}"] = cell
|
|
128
|
+
else:
|
|
129
|
+
self["acquisition_cell/0"] = cell
|
|
119
130
|
|
|
120
131
|
if not self._save_files:
|
|
121
132
|
return
|
|
@@ -124,13 +135,26 @@ class NotebookAcquisitionData(DH5):
|
|
|
124
135
|
with open(filepath + "_CELL.py", "w", encoding="utf-8") as file:
|
|
125
136
|
file.write(cell)
|
|
126
137
|
|
|
138
|
+
def save_cells(
|
|
139
|
+
self,
|
|
140
|
+
cells: Optional[Dict[int, Optional[str]]] = None,
|
|
141
|
+
filepath: Optional[str] = None,
|
|
142
|
+
):
|
|
143
|
+
"""Save all sells that are provided or pushed into self._cells array."""
|
|
144
|
+
cells = cells or self._cells
|
|
145
|
+
# if len(cells) == 1:
|
|
146
|
+
# self.save_cell(cells.popitem()[1], filepath)
|
|
147
|
+
# return
|
|
148
|
+
for i, cell in cells.items():
|
|
149
|
+
self.save_cell(cell, filepath, suffix=str(i))
|
|
150
|
+
|
|
127
151
|
def save_additional_info(self):
|
|
128
152
|
"""Save all additional information, i.e. cell code, configs. Put useful key to True."""
|
|
129
153
|
self["useful"] = True
|
|
130
154
|
|
|
131
155
|
if not self._save_files:
|
|
132
156
|
return
|
|
133
|
-
self.
|
|
157
|
+
self.save_cells()
|
|
134
158
|
self.save_configs()
|
|
135
159
|
|
|
136
160
|
def save_acquisition(self, **kwds) -> "NotebookAcquisitionData":
|
|
@@ -140,3 +164,18 @@ class NotebookAcquisitionData(DH5):
|
|
|
140
164
|
if self.save_on_edit is False:
|
|
141
165
|
self.save()
|
|
142
166
|
return self
|
|
167
|
+
|
|
168
|
+
@property
|
|
169
|
+
def current_step(self):
|
|
170
|
+
"""Return the current step of the acquisition."""
|
|
171
|
+
return self._current_step
|
|
172
|
+
|
|
173
|
+
@current_step.setter
|
|
174
|
+
def current_step(self, value: int):
|
|
175
|
+
self._current_step = value
|
|
176
|
+
|
|
177
|
+
def set_cell(self, cell: Optional[str], step: Optional[int] = None):
|
|
178
|
+
"""Set the cell code."""
|
|
179
|
+
if step is None:
|
|
180
|
+
step = self.current_step
|
|
181
|
+
self._cells[step] = cell
|
|
@@ -185,9 +185,7 @@ class AcquisitionLoop(DH5):
|
|
|
185
185
|
)
|
|
186
186
|
self[key][iteration] = value
|
|
187
187
|
else:
|
|
188
|
-
if
|
|
189
|
-
isinstance(value, (np.ndarray,)) and value.dtype == np.complex_
|
|
190
|
-
):
|
|
188
|
+
if np.iscomplexobj(value):
|
|
191
189
|
self[key] = SyncNp(np.zeros(key_shape, dtype=np.complex128))
|
|
192
190
|
else:
|
|
193
191
|
self[key] = SyncNp(np.zeros(key_shape))
|
|
@@ -132,6 +132,9 @@ class AcquisitionManager:
|
|
|
132
132
|
filename = [str(filename)]
|
|
133
133
|
|
|
134
134
|
self.config_files = list(filename)
|
|
135
|
+
self._config_files_names_to_path = {
|
|
136
|
+
os.path.basename(file): file for file in self.config_files
|
|
137
|
+
}
|
|
135
138
|
|
|
136
139
|
for config_file in self.config_files:
|
|
137
140
|
if not os.path.exists(config_file):
|
|
@@ -290,6 +290,7 @@ class AcquisitionAnalysisManager(AcquisitionManager):
|
|
|
290
290
|
cell: Optional[str] = None,
|
|
291
291
|
prerun: Optional[Union[_CallableWithNoArgs, List[_CallableWithNoArgs]]] = None,
|
|
292
292
|
save_on_edit: Optional[bool] = None,
|
|
293
|
+
step: int = 1,
|
|
293
294
|
) -> "AcquisitionAnalysisManager":
|
|
294
295
|
self._analysis_cell_str = None
|
|
295
296
|
self._analysis_data = None
|
|
@@ -297,8 +298,19 @@ class AcquisitionAnalysisManager(AcquisitionManager):
|
|
|
297
298
|
self._acquisition_started = time.time()
|
|
298
299
|
|
|
299
300
|
cell = cell or get_current_cell(self.shell)
|
|
300
|
-
|
|
301
|
-
|
|
301
|
+
if step != 1 and self._current_acquisition is not None:
|
|
302
|
+
if self._current_acquisition.experiment_name != name:
|
|
303
|
+
raise ValueError(
|
|
304
|
+
f"Current acquisition ('{self.current_experiment_name}') "
|
|
305
|
+
f"isn't the one expected ('{name}') for this acquisition. "
|
|
306
|
+
f"Possible solutions: run acquisition '{name}' with step 1; "
|
|
307
|
+
f"or change current acquisition name to '{self.current_experiment_name}'"
|
|
308
|
+
)
|
|
309
|
+
self._current_acquisition.current_step = step
|
|
310
|
+
self._current_acquisition.set_cell(cell, step=step)
|
|
311
|
+
self._current_acquisition.save_cell(cell, suffix=str(step))
|
|
312
|
+
else:
|
|
313
|
+
self.new_acquisition(name=name, cell=cell, save_on_edit=save_on_edit)
|
|
302
314
|
|
|
303
315
|
logger.info(self.current_filepath.basename)
|
|
304
316
|
|
|
@@ -528,6 +540,7 @@ class AcquisitionAnalysisManager(AcquisitionManager):
|
|
|
528
540
|
)
|
|
529
541
|
continue
|
|
530
542
|
file, line_no = res
|
|
543
|
+
file = self._config_files_names_to_path.get(file, file)
|
|
531
544
|
link = display.links.create_link(param_text, file, line_no, after_text)
|
|
532
545
|
links += link + "<br/>"
|
|
533
546
|
return display.display_html(links)
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
labmate/__config__.py,sha256=
|
|
1
|
+
labmate/__config__.py,sha256=vSn0Wg7zasd-lKnYyP7LRB_e4JcnIeULAsgcJKNrSgM,71
|
|
2
2
|
labmate/__init__.py,sha256=aHQiPLldCXIJqz6wwcfyFU9sGLofUR3W5sXBIRzK2n4,182
|
|
3
3
|
labmate/acquisition/__init__.py,sha256=8q3dy18lL32A9y_Du8GggpLgJqDMFcFKddHrySMavrM,269
|
|
4
|
-
labmate/acquisition/acquisition_data.py,sha256=
|
|
5
|
-
labmate/acquisition/acquisition_loop.py,sha256=
|
|
6
|
-
labmate/acquisition/acquisition_manager.py,sha256=
|
|
4
|
+
labmate/acquisition/acquisition_data.py,sha256=FUF0JTHl5_nmgPHUHFocTQEwPlxuCAVT5Xsf338jVhI,6686
|
|
5
|
+
labmate/acquisition/acquisition_loop.py,sha256=fiiseV21GB7pczHSEJrlLPiTSQ2u9y5VMDyCO7Hn0vY,11106
|
|
6
|
+
labmate/acquisition/acquisition_manager.py,sha256=uzGCWKCcOIwKTZsKp12OY1rvyWaFBlBsBDRR7mFZwj0,10496
|
|
7
7
|
labmate/acquisition/analysis_data.py,sha256=DF9NshXBWu74gK8b_ZOGIuveabkzbLIDXfyui1c4yK8,14695
|
|
8
8
|
labmate/acquisition/analysis_loop.py,sha256=1Y8lyPkTCNwskM8DkwrMXSOt0hNmBHcWJaQjdVZ81Hs,5075
|
|
9
9
|
labmate/acquisition/config_file.py,sha256=1WwqaKTM-R5xZQHqqqGUi2QCF0PC1ag2mFgPOJuEdWI,2212
|
|
10
10
|
labmate/acquisition/custom_lint.py,sha256=x4vNoOnbH3A4Odu2DQVtBsuSPo5JfvRpo8_EP0EOmgM,1005
|
|
11
11
|
labmate/acquisition/logger_setup.py,sha256=udTp-0S4cqhGdUGQlk3G3Eg51wePEGraNG-69P9fTOo,129
|
|
12
12
|
labmate/acquisition_notebook/__init__.py,sha256=ZtOGQtmPqEM1IRrL-_JYo4xYA87lFQ5JY5GmKcZz9z0,251
|
|
13
|
-
labmate/acquisition_notebook/acquisition_analysis_manager.py,sha256=
|
|
13
|
+
labmate/acquisition_notebook/acquisition_analysis_manager.py,sha256=PEP5gXnuB2EMazjM-aMcLt4Ws81AgqYZCgZmoD20Lo8,20105
|
|
14
14
|
labmate/acquisition_notebook/display_widget.py,sha256=VNSo7r5nY_8biq-PAJeLvU_nzJ71kS82gFuOy-762BQ,6918
|
|
15
15
|
labmate/attrdict/__init__.py,sha256=MvuZVe7j4a0HxGMxim_K2cv-dhqZOfzdeMiTX-SRgDg,58
|
|
16
16
|
labmate/attrdict/attrdict_class.py,sha256=4lKXe7oZo_lLHefmf5vAOKhibWgGDffJcxMhaWLvGs4,4047
|
|
@@ -33,8 +33,8 @@ labmate/utils/file_read.py,sha256=DAalvKehwEqVZjWSPhKZm8Myh6gfFA5gGT6WM0dPmyw,15
|
|
|
33
33
|
labmate/utils/lint.py,sha256=7llJbZUAM-ikEpmU_ZzraqOwGUuJPgk1wAf3aYMJdxg,9312
|
|
34
34
|
labmate/utils/random_utils.py,sha256=ZA3gK9P-eTcd_a3BTS_ZeJI5A0GM_GXL7X3yUqnPTO4,690
|
|
35
35
|
labmate/utils/title_parsing.py,sha256=RpbiZwuKnpIq-X5S5iS90oD8iOqocWcI27MGuB4kTLU,1988
|
|
36
|
-
labmate-0.8.
|
|
37
|
-
labmate-0.8.
|
|
38
|
-
labmate-0.8.
|
|
39
|
-
labmate-0.8.
|
|
40
|
-
labmate-0.8.
|
|
36
|
+
labmate-0.8.4.dist-info/LICENCE,sha256=J9XIxdJExlWYZuxhhKtk4oYILvUz8-JM0y_leRQCKUE,7488
|
|
37
|
+
labmate-0.8.4.dist-info/METADATA,sha256=_VWg55ngbUh7P6kxlZ38iK3i89oWgIDis0PJ3EoDN4A,3210
|
|
38
|
+
labmate-0.8.4.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
|
|
39
|
+
labmate-0.8.4.dist-info/top_level.txt,sha256=WWAn6t2zNWsp02gRq6f5cSsGebcs-4L6HBFk0XrcY0o,8
|
|
40
|
+
labmate-0.8.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|