labmate 0.8.3__tar.gz → 0.8.4__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 (79) hide show
  1. {labmate-0.8.3/labmate.egg-info → labmate-0.8.4}/PKG-INFO +1 -1
  2. {labmate-0.8.3 → labmate-0.8.4}/labmate/__config__.py +1 -1
  3. {labmate-0.8.3 → labmate-0.8.4}/labmate/acquisition/acquisition_data.py +47 -8
  4. {labmate-0.8.3 → labmate-0.8.4}/labmate/acquisition/acquisition_loop.py +1 -3
  5. {labmate-0.8.3 → labmate-0.8.4}/labmate/acquisition/acquisition_manager.py +3 -0
  6. {labmate-0.8.3 → labmate-0.8.4}/labmate/acquisition_notebook/acquisition_analysis_manager.py +15 -2
  7. {labmate-0.8.3 → labmate-0.8.4/labmate.egg-info}/PKG-INFO +1 -1
  8. {labmate-0.8.3 → labmate-0.8.4}/LICENCE +0 -0
  9. {labmate-0.8.3 → labmate-0.8.4}/MANIFEST.in +0 -0
  10. {labmate-0.8.3 → labmate-0.8.4}/README.md +0 -0
  11. {labmate-0.8.3 → labmate-0.8.4}/docs/about.md +0 -0
  12. {labmate-0.8.3 → labmate-0.8.4}/docs/acquisition_notebook.md +0 -0
  13. {labmate-0.8.3 → labmate-0.8.4}/docs/code/acquisition_loop.md +0 -0
  14. {labmate-0.8.3 → labmate-0.8.4}/docs/code/acquisition_manager.md +0 -0
  15. {labmate-0.8.3 → labmate-0.8.4}/docs/code/acquisition_notebook_manager.md +0 -0
  16. {labmate-0.8.3 → labmate-0.8.4}/docs/code/analysis_data.md +0 -0
  17. {labmate-0.8.3 → labmate-0.8.4}/docs/code/linting.md +0 -0
  18. {labmate-0.8.3 → labmate-0.8.4}/docs/code/parsing_config.md +0 -0
  19. {labmate-0.8.3 → labmate-0.8.4}/docs/examples/acquisition_and_analysis_notebook.ipynb +0 -0
  20. {labmate-0.8.3 → labmate-0.8.4}/docs/examples/aqm_simple_example.ipynb +0 -0
  21. {labmate-0.8.3 → labmate-0.8.4}/docs/examples/files/cfg.py +0 -0
  22. {labmate-0.8.3 → labmate-0.8.4}/docs/examples/files/dummy_config1.txt +0 -0
  23. {labmate-0.8.3 → labmate-0.8.4}/docs/examples/files/dummy_config2.txt +0 -0
  24. {labmate-0.8.3 → labmate-0.8.4}/docs/examples/files/dummy_config3.py +0 -0
  25. {labmate-0.8.3 → labmate-0.8.4}/docs/examples/files/init_analyse.py +0 -0
  26. {labmate-0.8.3 → labmate-0.8.4}/docs/examples/more/acquisition_and_analysis_notebook_with_magic.ipynb +0 -0
  27. {labmate-0.8.3 → labmate-0.8.4}/docs/examples/more/h5nparray.ipynb +0 -0
  28. {labmate-0.8.3 → labmate-0.8.4}/docs/examples/more/loop_example.ipynb +0 -0
  29. {labmate-0.8.3 → labmate-0.8.4}/docs/h5nparray.md +0 -0
  30. {labmate-0.8.3 → labmate-0.8.4}/docs/index.md +0 -0
  31. {labmate-0.8.3 → labmate-0.8.4}/docs/releases/0.4.0.md +0 -0
  32. {labmate-0.8.3 → labmate-0.8.4}/docs/releases/0.5.0.md +0 -0
  33. {labmate-0.8.3 → labmate-0.8.4}/docs/releases/0.6.0.md +0 -0
  34. {labmate-0.8.3 → labmate-0.8.4}/docs/releases/0.6.1.md +0 -0
  35. {labmate-0.8.3 → labmate-0.8.4}/docs/releases/0.7.0.md +0 -0
  36. {labmate-0.8.3 → labmate-0.8.4}/docs/releases/0.8.0.md +0 -0
  37. {labmate-0.8.3 → labmate-0.8.4}/docs/releases/index.md +0 -0
  38. {labmate-0.8.3 → labmate-0.8.4}/docs/starting_guide/advanced_examples.md +0 -0
  39. {labmate-0.8.3 → labmate-0.8.4}/docs/starting_guide/fine_tune.md +0 -0
  40. {labmate-0.8.3 → labmate-0.8.4}/docs/starting_guide/first_steps.md +0 -0
  41. {labmate-0.8.3 → labmate-0.8.4}/docs/starting_guide/install.md +0 -0
  42. {labmate-0.8.3 → labmate-0.8.4}/labmate/__init__.py +0 -0
  43. {labmate-0.8.3 → labmate-0.8.4}/labmate/acquisition/__init__.py +0 -0
  44. {labmate-0.8.3 → labmate-0.8.4}/labmate/acquisition/analysis_data.py +0 -0
  45. {labmate-0.8.3 → labmate-0.8.4}/labmate/acquisition/analysis_loop.py +0 -0
  46. {labmate-0.8.3 → labmate-0.8.4}/labmate/acquisition/config_file.py +0 -0
  47. {labmate-0.8.3 → labmate-0.8.4}/labmate/acquisition/custom_lint.py +0 -0
  48. {labmate-0.8.3 → labmate-0.8.4}/labmate/acquisition/logger_setup.py +0 -0
  49. {labmate-0.8.3 → labmate-0.8.4}/labmate/acquisition_notebook/__init__.py +0 -0
  50. {labmate-0.8.3 → labmate-0.8.4}/labmate/acquisition_notebook/display_widget.py +0 -0
  51. {labmate-0.8.3 → labmate-0.8.4}/labmate/attrdict/__init__.py +0 -0
  52. {labmate-0.8.3 → labmate-0.8.4}/labmate/attrdict/attrdict_class.py +0 -0
  53. {labmate-0.8.3 → labmate-0.8.4}/labmate/display/__init__.py +0 -0
  54. {labmate-0.8.3 → labmate-0.8.4}/labmate/display/buttons.py +0 -0
  55. {labmate-0.8.3 → labmate-0.8.4}/labmate/display/html_output.py +0 -0
  56. {labmate-0.8.3 → labmate-0.8.4}/labmate/display/links.py +0 -0
  57. {labmate-0.8.3 → labmate-0.8.4}/labmate/display/main.py +0 -0
  58. {labmate-0.8.3 → labmate-0.8.4}/labmate/display/platform_utils/__init__.py +0 -0
  59. {labmate-0.8.3 → labmate-0.8.4}/labmate/display/platform_utils/windows_utils.py +0 -0
  60. {labmate-0.8.3 → labmate-0.8.4}/labmate/parsing/__init__.py +0 -0
  61. {labmate-0.8.3 → labmate-0.8.4}/labmate/parsing/brackets_score.py +0 -0
  62. {labmate-0.8.3 → labmate-0.8.4}/labmate/parsing/parsed_value.py +0 -0
  63. {labmate-0.8.3 → labmate-0.8.4}/labmate/parsing/saving.py +0 -0
  64. {labmate-0.8.3 → labmate-0.8.4}/labmate/utils/__init__.py +0 -0
  65. {labmate-0.8.3 → labmate-0.8.4}/labmate/utils/async_utils.py +0 -0
  66. {labmate-0.8.3 → labmate-0.8.4}/labmate/utils/autoreload.py +0 -0
  67. {labmate-0.8.3 → labmate-0.8.4}/labmate/utils/errors.py +0 -0
  68. {labmate-0.8.3 → labmate-0.8.4}/labmate/utils/file_read.py +0 -0
  69. {labmate-0.8.3 → labmate-0.8.4}/labmate/utils/lint.py +0 -0
  70. {labmate-0.8.3 → labmate-0.8.4}/labmate/utils/random_utils.py +0 -0
  71. {labmate-0.8.3 → labmate-0.8.4}/labmate/utils/title_parsing.py +0 -0
  72. {labmate-0.8.3 → labmate-0.8.4}/labmate.egg-info/SOURCES.txt +0 -0
  73. {labmate-0.8.3 → labmate-0.8.4}/labmate.egg-info/dependency_links.txt +0 -0
  74. {labmate-0.8.3 → labmate-0.8.4}/labmate.egg-info/requires.txt +0 -0
  75. {labmate-0.8.3 → labmate-0.8.4}/labmate.egg-info/top_level.txt +0 -0
  76. {labmate-0.8.3 → labmate-0.8.4}/requirements-docs.txt +0 -0
  77. {labmate-0.8.3 → labmate-0.8.4}/requirements.txt +0 -0
  78. {labmate-0.8.3 → labmate-0.8.4}/setup.cfg +0 -0
  79. {labmate-0.8.3 → labmate-0.8.4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: labmate
3
- Version: 0.8.3
3
+ Version: 0.8.4
4
4
  Summary: Data management library to save data and plots to hdf5 files
5
5
  Home-page: https://github.com/kyrylo-gr/labmate
6
6
  Author: kyrylo.gr | LKB-OMQ
@@ -1,3 +1,3 @@
1
1
  """This file contains all package constants."""
2
2
 
3
- __version__ = "0.8.3"
3
+ __version__ = "0.8.4"
@@ -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._cell = cell
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(self, cell: Optional[str] = None, filepath: Optional[str] = None):
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
- self["acquisition_cell"] = cell
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.save_cell()
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 isinstance(value, (complex, np.complex_)) or ( # type: ignore
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
- self.new_acquisition(name=name, cell=cell, save_on_edit=save_on_edit)
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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: labmate
3
- Version: 0.8.3
3
+ Version: 0.8.4
4
4
  Summary: Data management library to save data and plots to hdf5 files
5
5
  Home-page: https://github.com/kyrylo-gr/labmate
6
6
  Author: kyrylo.gr | LKB-OMQ
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