sqil-core 0.1.0__py3-none-any.whl → 1.1.0__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.
- sqil_core/__init__.py +1 -0
- sqil_core/config_log.py +42 -0
- sqil_core/experiment/__init__.py +11 -0
- sqil_core/experiment/_analysis.py +125 -0
- sqil_core/experiment/_events.py +25 -0
- sqil_core/experiment/_experiment.py +553 -0
- sqil_core/experiment/data/plottr.py +778 -0
- sqil_core/experiment/helpers/_function_override_handler.py +111 -0
- sqil_core/experiment/helpers/_labone_wrappers.py +12 -0
- sqil_core/experiment/instruments/__init__.py +2 -0
- sqil_core/experiment/instruments/_instrument.py +190 -0
- sqil_core/experiment/instruments/drivers/SignalCore_SC5511A.py +515 -0
- sqil_core/experiment/instruments/local_oscillator.py +205 -0
- sqil_core/experiment/instruments/server.py +175 -0
- sqil_core/experiment/instruments/setup.yaml +21 -0
- sqil_core/experiment/instruments/zurich_instruments.py +55 -0
- sqil_core/fit/__init__.py +23 -0
- sqil_core/fit/_core.py +179 -31
- sqil_core/fit/_fit.py +544 -94
- sqil_core/fit/_guess.py +304 -0
- sqil_core/fit/_models.py +50 -1
- sqil_core/fit/_quality.py +266 -0
- sqil_core/resonator/__init__.py +2 -0
- sqil_core/resonator/_resonator.py +256 -74
- sqil_core/utils/__init__.py +40 -13
- sqil_core/utils/_analysis.py +226 -0
- sqil_core/utils/_const.py +83 -18
- sqil_core/utils/_formatter.py +127 -55
- sqil_core/utils/_plot.py +272 -6
- sqil_core/utils/_read.py +178 -95
- sqil_core/utils/_utils.py +147 -0
- {sqil_core-0.1.0.dist-info → sqil_core-1.1.0.dist-info}/METADATA +9 -1
- sqil_core-1.1.0.dist-info/RECORD +36 -0
- {sqil_core-0.1.0.dist-info → sqil_core-1.1.0.dist-info}/WHEEL +1 -1
- sqil_core-0.1.0.dist-info/RECORD +0 -19
- {sqil_core-0.1.0.dist-info → sqil_core-1.1.0.dist-info}/entry_points.txt +0 -0
sqil_core/utils/_utils.py
CHANGED
@@ -1,4 +1,117 @@
|
|
1
|
+
import hashlib
|
2
|
+
import importlib.util
|
1
3
|
import inspect
|
4
|
+
import sys
|
5
|
+
from collections.abc import Iterable
|
6
|
+
|
7
|
+
from sqil_core.config_log import logger
|
8
|
+
|
9
|
+
|
10
|
+
def fill_gaps(primary_list: list, fallback_list: list) -> list:
|
11
|
+
"""
|
12
|
+
Fills gaps in the primary list using values from the fallback list.
|
13
|
+
|
14
|
+
This function iterates through two lists, and for each pair of elements,
|
15
|
+
it fills in the gaps where the element in the primary list is `None`
|
16
|
+
with the corresponding element from the fallback list. If the element
|
17
|
+
in the primary list is not `None`, it is kept as-is.
|
18
|
+
|
19
|
+
Parameters
|
20
|
+
----------
|
21
|
+
primary_list : list
|
22
|
+
A list of values where some elements may be `None`, which will be replaced by values from `fallback_list`.
|
23
|
+
fallback_list : list
|
24
|
+
A list of values used to fill gaps in `primary_list`.
|
25
|
+
|
26
|
+
Returns
|
27
|
+
-------
|
28
|
+
result : list
|
29
|
+
A new list where `None` values in `primary_list` are replaced by corresponding values from `fallback_list`.
|
30
|
+
|
31
|
+
Examples
|
32
|
+
--------
|
33
|
+
>>> primary_list = [1, None, 3, None, 5]
|
34
|
+
>>> fallback_list = [10, 20, 30, 40, 50]
|
35
|
+
>>> fill_gaps(primary_list, fallback_list)
|
36
|
+
[1, 20, 3, 40, 5]
|
37
|
+
"""
|
38
|
+
if (fallback_list is None) or (len(fallback_list) == 0):
|
39
|
+
return primary_list
|
40
|
+
|
41
|
+
if primary_list is None:
|
42
|
+
return fallback_list
|
43
|
+
|
44
|
+
if len(primary_list) == 0:
|
45
|
+
primary_list = []
|
46
|
+
|
47
|
+
result = primary_list
|
48
|
+
fallback_list = fallback_list[0 : len(primary_list)]
|
49
|
+
for i in range(len(fallback_list)):
|
50
|
+
if result[i] == None:
|
51
|
+
result[i] = fallback_list[i]
|
52
|
+
|
53
|
+
return result
|
54
|
+
|
55
|
+
|
56
|
+
def make_iterable(obj) -> Iterable:
|
57
|
+
"""
|
58
|
+
Ensures that the given object is an iterable.
|
59
|
+
|
60
|
+
If the input object is already an iterable (excluding strings), it is returned as-is.
|
61
|
+
Otherwise, it is wrapped in a list to make it iterable.
|
62
|
+
|
63
|
+
Parameters
|
64
|
+
----------
|
65
|
+
obj : Any
|
66
|
+
The object to be converted into an iterable.
|
67
|
+
|
68
|
+
Returns
|
69
|
+
-------
|
70
|
+
iterable : Iterable
|
71
|
+
An iterable version of the input object. If the input is not already an iterable,
|
72
|
+
it is returned as a single-element list.
|
73
|
+
|
74
|
+
Examples
|
75
|
+
--------
|
76
|
+
>>> make_iterable(42)
|
77
|
+
[42]
|
78
|
+
|
79
|
+
>>> make_iterable([1, 2, 3])
|
80
|
+
[1, 2, 3]
|
81
|
+
|
82
|
+
>>> make_iterable("hello")
|
83
|
+
["hello"] # Strings are not treated as iterables in this function
|
84
|
+
"""
|
85
|
+
if isinstance(obj, str):
|
86
|
+
return [obj]
|
87
|
+
return obj if isinstance(obj, Iterable) else [obj]
|
88
|
+
|
89
|
+
|
90
|
+
def has_at_least_one(lst: list, value) -> bool:
|
91
|
+
"""
|
92
|
+
Checks whether a given value appears at least once in a list.
|
93
|
+
If the object passed is not iterable, it is converted to an interable,
|
94
|
+
e.g. if lst = 5, the function transform lst = [lst].
|
95
|
+
|
96
|
+
Parameters
|
97
|
+
----------
|
98
|
+
lst : list
|
99
|
+
The list to search.
|
100
|
+
value : Any
|
101
|
+
The value to look for in the list. If `None`, the function checks for the presence
|
102
|
+
of `None` using identity comparison.
|
103
|
+
|
104
|
+
Returns
|
105
|
+
-------
|
106
|
+
bool
|
107
|
+
True if the value appears at least once in the list; False otherwise.
|
108
|
+
"""
|
109
|
+
lst = make_iterable(lst)
|
110
|
+
|
111
|
+
if value is None:
|
112
|
+
return any(x is None for x in lst)
|
113
|
+
else:
|
114
|
+
return any(x == value for x in lst)
|
2
115
|
|
3
116
|
|
4
117
|
def _count_function_parameters(func):
|
@@ -15,3 +128,37 @@ def _count_function_parameters(func):
|
|
15
128
|
)
|
16
129
|
]
|
17
130
|
)
|
131
|
+
|
132
|
+
|
133
|
+
def _extract_variables_from_module(module_name, path):
|
134
|
+
try:
|
135
|
+
spec = importlib.util.spec_from_file_location(module_name, path)
|
136
|
+
module = importlib.util.module_from_spec(spec)
|
137
|
+
sys.modules[module_name] = module
|
138
|
+
spec.loader.exec_module(module)
|
139
|
+
|
140
|
+
# Get all variables and their values
|
141
|
+
variables = {
|
142
|
+
name: value
|
143
|
+
for name, value in vars(module).items()
|
144
|
+
if not name.startswith("__")
|
145
|
+
}
|
146
|
+
return variables
|
147
|
+
|
148
|
+
except Exception as e:
|
149
|
+
logger.error(f"Error while extracting variables from {path}: {str(e)}")
|
150
|
+
|
151
|
+
return {}
|
152
|
+
|
153
|
+
|
154
|
+
def _hash_file(path):
|
155
|
+
"""Generate a hash for the file using SHA256."""
|
156
|
+
sha256_hash = hashlib.sha256()
|
157
|
+
try:
|
158
|
+
with open(path, "rb") as file:
|
159
|
+
for byte_block in iter(lambda: file.read(4096), b""):
|
160
|
+
sha256_hash.update(byte_block)
|
161
|
+
except Exception as e:
|
162
|
+
logger.error(f"Unable to hash file '{path}': {str(e)}")
|
163
|
+
return None
|
164
|
+
return sha256_hash.hexdigest()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: sqil-core
|
3
|
-
Version:
|
3
|
+
Version: 1.1.0
|
4
4
|
Summary: The codebase of the SQIL group in EPFL
|
5
5
|
Author: Andrea Duina
|
6
6
|
Requires-Python: >=3.10,<4.0
|
@@ -9,11 +9,19 @@ Classifier: Programming Language :: Python :: 3.10
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.11
|
10
10
|
Classifier: Programming Language :: Python :: 3.12
|
11
11
|
Classifier: Programming Language :: Python :: 3.13
|
12
|
+
Requires-Dist: blinker (>=1.9.0,<2.0.0)
|
12
13
|
Requires-Dist: h5py (>=3.12.1,<4.0.0)
|
13
14
|
Requires-Dist: isort (==5.9.3)
|
15
|
+
Requires-Dist: laboneq (>=2.54.0,<3.0.0)
|
16
|
+
Requires-Dist: laboneq-applications (>=2.4.0,<3.0.0)
|
14
17
|
Requires-Dist: lmfit (>=1.3.2,<2.0.0)
|
15
18
|
Requires-Dist: matplotlib (>=3.9.3,<4.0.0)
|
19
|
+
Requires-Dist: mpld3 (>=0.5.10,<0.6.0)
|
16
20
|
Requires-Dist: numpy (>=2.2.3,<3.0.0)
|
21
|
+
Requires-Dist: plottr (>=0.14.0,<0.15.0)
|
22
|
+
Requires-Dist: pyro5 (>=5.15,<6.0)
|
23
|
+
Requires-Dist: qcodes (>=0.51.0,<0.52.0)
|
24
|
+
Requires-Dist: qcodes-contrib-drivers (>=0.23.0,<0.24.0)
|
17
25
|
Requires-Dist: scipy (>=1.14.1,<2.0.0)
|
18
26
|
Requires-Dist: tabulate (>=0.9.0,<0.10.0)
|
19
27
|
Description-Content-Type: text/markdown
|
@@ -0,0 +1,36 @@
|
|
1
|
+
sqil_core/__init__.py,sha256=Bm5X6xWur6bzw9PGyrHBkBUYSkmrA32ufnrQIbuMDxE,236
|
2
|
+
sqil_core/config.py,sha256=x7nNdIGJh_2jU6_WuyZ_VjjwkcvibAK-Rc-k0yePUFA,166
|
3
|
+
sqil_core/config_log.py,sha256=sSj1HBembBYsos6ilf0V5ll_FBZCNNr9K8CYOS8xxWg,1221
|
4
|
+
sqil_core/experiment/__init__.py,sha256=kIkwb1Yr-UYIM0XfD6IsQTI72nPD33JDHHSekXzlF68,389
|
5
|
+
sqil_core/experiment/_analysis.py,sha256=BDu-iynpFrmIl_dJXSEfsuwZW0qn9S6Da3IWFGJGxZM,4246
|
6
|
+
sqil_core/experiment/_events.py,sha256=inPcGJu0iGqJKIeDRqDkSmwpgLb9ABzGF8U_ExqfoeY,693
|
7
|
+
sqil_core/experiment/_experiment.py,sha256=FtFGvN5eAHQhfQm5X3dATXpUvCb6hVgsLObBUPVVtyQ,19823
|
8
|
+
sqil_core/experiment/data/plottr.py,sha256=-hNvzM6u8hm6-5AjcQZMN85fZVP2E1SkrZEevJHoPi0,26481
|
9
|
+
sqil_core/experiment/helpers/_function_override_handler.py,sha256=ldynTPQKifeCbx9OiCqs_KdH9MPYcy0aoToA16NFcCY,3463
|
10
|
+
sqil_core/experiment/helpers/_labone_wrappers.py,sha256=YmmEoNFeQ53xsdvDM7KUluVqpoIimv-PS0QoZ85m6Cs,357
|
11
|
+
sqil_core/experiment/instruments/__init__.py,sha256=V88fgDuu4J6swreuAKeGrc6_P0XZehlKnOVhw71weBk,82
|
12
|
+
sqil_core/experiment/instruments/_instrument.py,sha256=WRYeqgVqfvcanpBBzrY8gx2XrGfntstMAiZidKAvvFE,6025
|
13
|
+
sqil_core/experiment/instruments/drivers/SignalCore_SC5511A.py,sha256=dTH2mbFrTGKPnFL8Z2Kt-V7SOkHgYuOqqY1nyqftRlI,18257
|
14
|
+
sqil_core/experiment/instruments/local_oscillator.py,sha256=07E7UVo4ZEV0ZyjCkmrbGJicV43TMtxsdvi4l-w4Dzg,6214
|
15
|
+
sqil_core/experiment/instruments/server.py,sha256=veNRc0iRQav4EayHefBnwo9UYJj8lhIFD0L_PI1dwtM,6098
|
16
|
+
sqil_core/experiment/instruments/setup.yaml,sha256=B1x3nzUuJZOKRcGY7RHOIoZeVxz2wnMOZY6mNGDAuV8,399
|
17
|
+
sqil_core/experiment/instruments/zurich_instruments.py,sha256=g3QLZVBW2XP_GFFWlmgXmiSzelvoT8GKe4FzH7xW1zY,1880
|
18
|
+
sqil_core/fit/__init__.py,sha256=oEAJlHIZV-GXuTBP4YaEHqF98gHsDm71hRE7KtgWCcM,853
|
19
|
+
sqil_core/fit/_core.py,sha256=wL1XnM2LoYGlnlz1zRrtMKoVZC6aKE1Xbv6y8kBq1BY,41076
|
20
|
+
sqil_core/fit/_fit.py,sha256=Uy0gbm1KAe1KTaczN3ygm0FmUNH49HfFWsbQohsNEaw,40478
|
21
|
+
sqil_core/fit/_guess.py,sha256=Au0_SlEE8ZLkHYpICPuvIX-57CnnykiZQsOfDvQoBME,9069
|
22
|
+
sqil_core/fit/_models.py,sha256=1fHbY8XD7vsK0vXpqikhqb0r9xZ42HEFWUiFI2MrM_0,4750
|
23
|
+
sqil_core/fit/_quality.py,sha256=e4IZvVk2hOvIaPuFaUobvgyT2zA5eji9KiHyoQetpc8,8772
|
24
|
+
sqil_core/resonator/__init__.py,sha256=d8MYTwjEUetlw1d4MRcHwHQPYmiwxhn40fFhctWSNaY,254
|
25
|
+
sqil_core/resonator/_resonator.py,sha256=qClDQFDHzg38oModL7ZxpsEUDpijxeDHyr_hv4b0t2g,35558
|
26
|
+
sqil_core/utils/__init__.py,sha256=5L5C0Nw52d4Cf17H9pUzCEGXr5sJrzAEDTVMJ-rVDqY,2022
|
27
|
+
sqil_core/utils/_analysis.py,sha256=HTKtrU7vCGZbTbMHxuTgbzHi6F8IZ9LQcct-9bYhLyE,16751
|
28
|
+
sqil_core/utils/_const.py,sha256=HYzZrqf9ovbiaOZvJmlelcbX1LeDv0q_nCfEe4Y6w2I,2773
|
29
|
+
sqil_core/utils/_formatter.py,sha256=8ldE9KCeybwPgF1yhCFx1mSzJHbhLTHdab0VK7otQFo,7996
|
30
|
+
sqil_core/utils/_plot.py,sha256=u9OE9I3-xx3KsfMba3hZiIhneECiRBFxpe9HCi-1mU0,12813
|
31
|
+
sqil_core/utils/_read.py,sha256=9TTYQDz0nm81PkvCQBjETFHwpJGBtK5HprjhzxVY2ps,8432
|
32
|
+
sqil_core/utils/_utils.py,sha256=GU0eLO73Lil8yFj9aBWv_Q_dCZZHepSW4emhFOcP0Yc,4652
|
33
|
+
sqil_core-1.1.0.dist-info/METADATA,sha256=_C8dUoFeAx6_3UeWCsN0DVgsuqhZukNnbjEKRQnmzKc,3347
|
34
|
+
sqil_core-1.1.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
35
|
+
sqil_core-1.1.0.dist-info/entry_points.txt,sha256=mnYKe0NKDcT5Py_8cL44TgcbLVOUS-CxmGBMEcsbGAQ,95
|
36
|
+
sqil_core-1.1.0.dist-info/RECORD,,
|
sqil_core-0.1.0.dist-info/RECORD
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
sqil_core/__init__.py,sha256=6CsaaYqp3DKoQLNiOzVix_VeHqUo0Bl3ugpnyBVs19E,193
|
2
|
-
sqil_core/config.py,sha256=x7nNdIGJh_2jU6_WuyZ_VjjwkcvibAK-Rc-k0yePUFA,166
|
3
|
-
sqil_core/fit/__init__.py,sha256=q_dqH77DsYrpJUWm9sm7T4d2k2uQsLbVLgrQaE25-Fw,320
|
4
|
-
sqil_core/fit/_core.py,sha256=izbn9Lh_5Gk3ywc9GXKbRbGEQrBniIkaatfuPMI-HmM,36003
|
5
|
-
sqil_core/fit/_fit.py,sha256=dy4Vshoy8jcuof0ROxxG4h5oiwTFy2593eEHDRRobqE,25183
|
6
|
-
sqil_core/fit/_models.py,sha256=eoIbAvtmusoUn_LN9tIe4PemRV4HXhPDkl75AxVbFRw,3034
|
7
|
-
sqil_core/resonator/__init__.py,sha256=LFq30-1r6cVNRnNYfiqlzIhLJa0yHNeZ_tHPcSJej_Q,210
|
8
|
-
sqil_core/resonator/_resonator.py,sha256=rjcUqDvglKK00M5zIqVXukNrZFMscOZZIG2YBn13BjE,29198
|
9
|
-
sqil_core/utils/__init__.py,sha256=xdefhf8GUpGPKuGEhuP3He3067nPcD3CRP-5CJrH6Gk,1363
|
10
|
-
sqil_core/utils/_analysis.py,sha256=qhipdYvxWR3P886us_gF8dBQZGzGJme8-5AT1YxBaKo,9982
|
11
|
-
sqil_core/utils/_const.py,sha256=H58XFwq7_pX6M7kapBPbeky8Ck-GGE66fzkNe2e3GW0,1217
|
12
|
-
sqil_core/utils/_formatter.py,sha256=F7JRPyU_pYymRD7G1iNVYiZS3D1ccuD9AYZWYg3SiW4,5750
|
13
|
-
sqil_core/utils/_plot.py,sha256=ABmt-e7wfqynnU2P9584EqMkmwhGqJItlgFctZQzOp4,3442
|
14
|
-
sqil_core/utils/_read.py,sha256=K0IjnUhkbCuf_wbKn_0fRP86bNGYj3dEbFXzQi9lOoU,5421
|
15
|
-
sqil_core/utils/_utils.py,sha256=BMelbGLbjBh0Mu-Cb86bkoKXcGAABVZ7UkBZs68JzUA,420
|
16
|
-
sqil_core-0.1.0.dist-info/METADATA,sha256=U0gtbLDys5_rSBQ5Y0ifCtBYMMgNd7IATqGcpjL49xM,3000
|
17
|
-
sqil_core-0.1.0.dist-info/WHEEL,sha256=7dDg4QLnNKTvwIDR9Ac8jJaAmBC_owJrckbC0jjThyA,88
|
18
|
-
sqil_core-0.1.0.dist-info/entry_points.txt,sha256=mnYKe0NKDcT5Py_8cL44TgcbLVOUS-CxmGBMEcsbGAQ,95
|
19
|
-
sqil_core-0.1.0.dist-info/RECORD,,
|
File without changes
|