simcats 1.1.0__py3-none-any.whl → 1.2.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.
- simcats/__init__.py +1 -1
- simcats/support_functions/__init__.py +3 -3
- simcats/support_functions/_parameter_sampling.py +94 -3
- {simcats-1.1.0.dist-info → simcats-1.2.0.dist-info}/METADATA +36 -2
- {simcats-1.1.0.dist-info → simcats-1.2.0.dist-info}/RECORD +8 -8
- {simcats-1.1.0.dist-info → simcats-1.2.0.dist-info}/WHEEL +1 -1
- {simcats-1.1.0.dist-info → simcats-1.2.0.dist-info}/LICENSE +0 -0
- {simcats-1.1.0.dist-info → simcats-1.2.0.dist-info}/top_level.txt +0 -0
simcats/__init__.py
CHANGED
|
@@ -3,7 +3,7 @@ SimCATS subpackage with support functions that are not assigned to any specific
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
from simcats.support_functions._parameter_sampling import ParameterSamplingInterface, NormalSamplingRange, \
|
|
6
|
-
LogNormalSamplingRange, UniformSamplingRange
|
|
6
|
+
LogNormalSamplingRange, UniformSamplingRange, ExponentialSamplingRange
|
|
7
7
|
from simcats.support_functions._fermi_filter1d import fermi_filter1d, fermi_dirac_derivative
|
|
8
8
|
from simcats.support_functions._cumulative_distribution_functions import cauchy_cdf, multi_cauchy_cdf, sigmoid_cdf, \
|
|
9
9
|
multi_sigmoid_cdf
|
|
@@ -12,5 +12,5 @@ from simcats.support_functions._rotate_points import rotate_points
|
|
|
12
12
|
from simcats.support_functions._plotting import plot_csd
|
|
13
13
|
|
|
14
14
|
__all__ = ["ParameterSamplingInterface", "NormalSamplingRange", "LogNormalSamplingRange", "UniformSamplingRange",
|
|
15
|
-
"fermi_filter1d", "fermi_dirac_derivative", "cauchy_cdf", "multi_cauchy_cdf",
|
|
16
|
-
"multi_sigmoid_cdf", "signed_dist_points_line", "rotate_points", "plot_csd"]
|
|
15
|
+
"ExponentialSamplingRange", "fermi_filter1d", "fermi_dirac_derivative", "cauchy_cdf", "multi_cauchy_cdf",
|
|
16
|
+
"sigmoid_cdf", "multi_sigmoid_cdf", "signed_dist_points_line", "rotate_points", "plot_csd"]
|
|
@@ -47,6 +47,7 @@ class NormalSamplingRange(ParameterSamplingInterface):
|
|
|
47
47
|
self,
|
|
48
48
|
total_range: Tuple,
|
|
49
49
|
std: float,
|
|
50
|
+
mean: Union[float, None] = None,
|
|
50
51
|
sampling_range: Union[float, None] = None,
|
|
51
52
|
rng: Union[np.random.Generator, None] = None,
|
|
52
53
|
) -> None:
|
|
@@ -60,6 +61,8 @@ class NormalSamplingRange(ParameterSamplingInterface):
|
|
|
60
61
|
range, a new sample is drawn until a sample inside the sampling_range/total_range was generated,
|
|
61
62
|
leading to a truncated normal distribution.
|
|
62
63
|
std (float): The standard deviation of the sampled elements, which is used in the normal distribution.
|
|
64
|
+
mean (Union[float, None]): The mean to be used for the normal distribution. If None, the center of the
|
|
65
|
+
total range will be used. Defaults to None.
|
|
63
66
|
sampling_range (Union[float, None]): The maximum range in which the parameter is allowed to change during
|
|
64
67
|
the simulation. The explicit range is set up during the initialization, narrowing down the
|
|
65
68
|
supplied total_range. Default is None, which leads to no narrowing of the given total_range.
|
|
@@ -86,13 +89,17 @@ class NormalSamplingRange(ParameterSamplingInterface):
|
|
|
86
89
|
)
|
|
87
90
|
self.__range = (sampled - 0.5 * sampling_range, sampled + 0.5 * sampling_range)
|
|
88
91
|
self.__std = std
|
|
92
|
+
if mean is not None:
|
|
93
|
+
self.__mean = mean
|
|
94
|
+
else:
|
|
95
|
+
self.__mean = np.mean(self.__range)
|
|
89
96
|
self.__last_sample = None
|
|
90
97
|
|
|
91
98
|
def sample_parameter(self):
|
|
92
|
-
sampled = self.__rng.normal(loc=
|
|
99
|
+
sampled = self.__rng.normal(loc=self.__mean, scale=self.__std)
|
|
93
100
|
# repeat sampling until the sampled value is in self.__range
|
|
94
101
|
while sampled < self.__range[0] or sampled > self.__range[1]:
|
|
95
|
-
sampled = self.__rng.normal(loc=
|
|
102
|
+
sampled = self.__rng.normal(loc=self.__mean, scale=self.__std)
|
|
96
103
|
self.__last_sample = sampled
|
|
97
104
|
return sampled
|
|
98
105
|
|
|
@@ -102,7 +109,7 @@ class NormalSamplingRange(ParameterSamplingInterface):
|
|
|
102
109
|
def __repr__(self) -> str:
|
|
103
110
|
return (
|
|
104
111
|
self.__class__.__name__
|
|
105
|
-
+ f"(last_sample={self.last_sample()}, range={self.__range}, std={self.__std}, rng={self.__rng})"
|
|
112
|
+
+ f"(last_sample={self.last_sample()}, range={self.__range}, mean={self.__mean}, std={self.__std}, rng={self.__rng})"
|
|
106
113
|
)
|
|
107
114
|
|
|
108
115
|
|
|
@@ -231,3 +238,87 @@ class LogNormalSamplingRange(ParameterSamplingInterface):
|
|
|
231
238
|
+ f"(last_sample={self.last_sample()}, range={self.__range}, mean={self.__mean}, sigma={self.__sigma}"
|
|
232
239
|
+ f", rng={self.__rng})"
|
|
233
240
|
)
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
class ExponentialSamplingRange(ParameterSamplingInterface):
|
|
244
|
+
"""Exponential distribution sampling range implementation of ParameterSamplingInterface."""
|
|
245
|
+
|
|
246
|
+
def __init__(
|
|
247
|
+
self,
|
|
248
|
+
total_range: Tuple,
|
|
249
|
+
scale: float,
|
|
250
|
+
sampling_range: Union[float, None] = None,
|
|
251
|
+
rng: Union[np.random.Generator, None] = None,
|
|
252
|
+
) -> None:
|
|
253
|
+
"""This class can be used to generate randomly sampled parameters from an exponential distribution within a given range.
|
|
254
|
+
|
|
255
|
+
The samples are calculated as follows:\n
|
|
256
|
+
min(sampling_range) + exponential_distribution_sample * (max(sampling_range) - min(Sampling_range))
|
|
257
|
+
|
|
258
|
+
To select the correct scale factor (1 / λ), take the following into consideration:\n
|
|
259
|
+
To have the p percent quantile at position q, the following must be valid:\n
|
|
260
|
+
q = ln( 1 / (1-p) ) / λ \n
|
|
261
|
+
with 1 / λ = scale \n
|
|
262
|
+
So in general the scale is calculated as: \n
|
|
263
|
+
scale = q / ln( 1 / (1-p) ) \n
|
|
264
|
+
For example: If it is desired to have 90% of the values in 50% of the sampling range, we get:\n
|
|
265
|
+
scale = 0.5 / ln( 1 / (1-0.9) ) = 0.21715
|
|
266
|
+
|
|
267
|
+
Further reading: https://en.wikipedia.org/wiki/Exponential_distribution#properties
|
|
268
|
+
|
|
269
|
+
Used for example for the distortions during the simulation of CSDs.
|
|
270
|
+
|
|
271
|
+
Args:
|
|
272
|
+
total_range (Tuple): The total range in which the parameters can be sampled. This can be narrowed down
|
|
273
|
+
randomly with the help of the parameter sampling_range. If the exponential distribution generates a
|
|
274
|
+
sample outside this range, a new sample is drawn until a sample inside the sampling_range/total_range
|
|
275
|
+
was generated, leading to a truncated exponential distribution.
|
|
276
|
+
scale (float): The scale of the exponential distribution. See __init__ docstring for more detailed
|
|
277
|
+
information.
|
|
278
|
+
sampling_range (Union[float, None]): The maximum range in which the parameter is allowed to change during
|
|
279
|
+
the simulation. The explicit range is set up during the initialization, narrowing down the
|
|
280
|
+
supplied total_range. Default is None, which leads to no narrowing of the given total_range.
|
|
281
|
+
rng (np.random.Generator): random number generator used for the sampling of random numbers. If None, the
|
|
282
|
+
default generator of numpy (np.random.default_rng()) is used. Default is None.
|
|
283
|
+
"""
|
|
284
|
+
if rng:
|
|
285
|
+
self.__rng = rng
|
|
286
|
+
else:
|
|
287
|
+
self.__rng = np.random.default_rng()
|
|
288
|
+
if sampling_range is None:
|
|
289
|
+
self.__range = total_range
|
|
290
|
+
else:
|
|
291
|
+
if np.greater_equal(sampling_range, np.max(total_range) - np.min(total_range)):
|
|
292
|
+
warnings.warn(
|
|
293
|
+
"The given reduced sampling range is equal or larger than the given total range. As "
|
|
294
|
+
"default the given total sampling range is taken.",
|
|
295
|
+
stacklevel=2,
|
|
296
|
+
)
|
|
297
|
+
self.__range = total_range
|
|
298
|
+
else:
|
|
299
|
+
sampled = self.__rng.uniform(
|
|
300
|
+
np.min(total_range) + 0.5 * sampling_range, np.max(total_range) - 0.5 * sampling_range
|
|
301
|
+
)
|
|
302
|
+
if total_range[0] < total_range[1]:
|
|
303
|
+
self.__range = (sampled - 0.5 * sampling_range, sampled + 0.5 * sampling_range)
|
|
304
|
+
else:
|
|
305
|
+
self.__range = (sampled + 0.5 * sampling_range, sampled - 0.5 * sampling_range)
|
|
306
|
+
self.__scale = scale
|
|
307
|
+
self.__last_sample = None
|
|
308
|
+
|
|
309
|
+
def sample_parameter(self):
|
|
310
|
+
sampled = self.__range[0] + self.__rng.exponential(scale=self.__scale) * (self.__range[1] - self.__range[0])
|
|
311
|
+
# repeat sampling until the sampled value is in self.__range
|
|
312
|
+
while sampled < np.min(self.__range) or sampled > np.max(self.__range):
|
|
313
|
+
sampled = self.__range[0] + self.__rng.exponential(scale=self.__scale) * (self.__range[1] - self.__range[0])
|
|
314
|
+
self.__last_sample = sampled
|
|
315
|
+
return sampled
|
|
316
|
+
|
|
317
|
+
def last_sample(self):
|
|
318
|
+
return self.__last_sample
|
|
319
|
+
|
|
320
|
+
def __repr__(self) -> str:
|
|
321
|
+
return (
|
|
322
|
+
self.__class__.__name__
|
|
323
|
+
+ f"(last_sample={self.last_sample()}, range={self.__range}, scale={self.__scale}, rng={self.__rng})"
|
|
324
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: simcats
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: SimCATS is a python framework for simulating charge stability diagrams (CSDs) typically measured during the tuning process of qubits.
|
|
5
5
|
Author-email: Fabian Hader <f.hader@fz-juelich.de>, Sarah Fleitmann <s.fleitmann@fz-juelich.de>, Fabian Fuchs <f.fuchs@fz-juelich.de>
|
|
6
6
|
License: CC BY-NC-SA 4.0
|
|
@@ -31,6 +31,26 @@ Requires-Dist: opencv-python
|
|
|
31
31
|
Requires-Dist: scipy
|
|
32
32
|
Requires-Dist: sympy
|
|
33
33
|
|
|
34
|
+
<h1 align="center">
|
|
35
|
+
<img src="https://raw.githubusercontent.com/f-hader/SimCATS/main/SimCATS_symbol.svg" alt="SimCATS logo">
|
|
36
|
+
<br>
|
|
37
|
+
</h1>
|
|
38
|
+
|
|
39
|
+
<div align="center">
|
|
40
|
+
<a href="https://github.com/f-hader/SimCATS/blob/main/LICENSE">
|
|
41
|
+
<img src="https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-lightgrey.svg" alt="License: CC BY-NC-SA 4.0"/>
|
|
42
|
+
</a>
|
|
43
|
+
<a href="https://pypi.org/project/simcats/">
|
|
44
|
+
<img src="https://img.shields.io/pypi/v/simcats.svg" alt="PyPi Latest Release"/>
|
|
45
|
+
</a>
|
|
46
|
+
<a href="https://simcats.readthedocs.io/en/latest/">
|
|
47
|
+
<img src="https://img.shields.io/readthedocs/simcats" alt="Read the Docs"/>
|
|
48
|
+
</a>
|
|
49
|
+
<a href="https://doi.org/10.1109/TQE.2024.3445967">
|
|
50
|
+
<img src="https://img.shields.io/badge/DOI-10.1109/TQE.2024.3445967-007ec6.svg" alt="DOI Publication"/>
|
|
51
|
+
</a>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
34
54
|
# SimCATS
|
|
35
55
|
|
|
36
56
|
Simulation of CSDs for Automated Tuning Solutions (`SimCATS`) is a Python framework for simulating charge stability
|
|
@@ -166,6 +186,20 @@ This subpackage contains support functions, which are used by the end user and b
|
|
|
166
186
|
- `ParameterSamplingInterface` defines an interface for randomly sampled (fluctuated) strengths of distortions.
|
|
167
187
|
- `NormalSamplingRange` and `UniformSamplingRange` are implementations of the `ParameterSamplingInterface`.
|
|
168
188
|
|
|
189
|
+
## Citations
|
|
190
|
+
|
|
191
|
+
```bibtex
|
|
192
|
+
@article{hader2024simcats,
|
|
193
|
+
author={Hader, Fabian and Fleitmann, Sarah and Vogelbruch, Jan and Geck, Lotte and Waasen, Stefan van},
|
|
194
|
+
journal={IEEE Transactions on Quantum Engineering},
|
|
195
|
+
title={Simulation of Charge Stability Diagrams for Automated Tuning Solutions (SimCATS)},
|
|
196
|
+
year={2024},
|
|
197
|
+
volume={5},
|
|
198
|
+
pages={1-14},
|
|
199
|
+
doi={10.1109/TQE.2024.3445967}
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
169
203
|
## License, CLA, and Copyright
|
|
170
204
|
|
|
171
205
|
[![CC BY-NC-SA 4.0][cc-by-nc-sa-shield]][cc-by-nc-sa]
|
|
@@ -181,4 +215,4 @@ This work is licensed under a
|
|
|
181
215
|
|
|
182
216
|
Contributions must follow the Contributor License Agreement. For more information, see the CONTRIBUTING.md file at the top of the GitHub repository.
|
|
183
217
|
|
|
184
|
-
Copyright ©
|
|
218
|
+
Copyright © 2024 Forschungszentrum Jülich GmbH - Central Institute of Engineering, Electronics and Analytics (ZEA) - Electronic Systems (ZEA-2)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
simcats/__init__.py,sha256=
|
|
1
|
+
simcats/__init__.py,sha256=pnTS1t8IQKm2SpadtblS8VKUFKm0OfBkiT7rQGzj8Ws,300
|
|
2
2
|
simcats/_default_configs.py,sha256=wHWa4wyTVtZf9J37WdcMlvM7XeI_OZhl8NB7lrBi-yI,6980
|
|
3
3
|
simcats/_simulation.py,sha256=xvKLnOzwc8uGGLfXvBZPaLYYPHBaXcwwtlYmJ3zTkUU,24795
|
|
4
4
|
simcats/distortions/__init__.py,sha256=3oXqKm1rkznDKhWeitZxYJyb1wFMdan6CBfBw673J7A,1368
|
|
@@ -23,15 +23,15 @@ simcats/sensor/_gaussian_sensor_peak.py,sha256=7xrSfl505MygBJ7Nu3V3RJpNq8q-mjukV
|
|
|
23
23
|
simcats/sensor/_generic_sensor.py,sha256=88E6xP3r5GZCBKaR7TKtqrWovR4XW-mm6YUwL96L_AQ,10441
|
|
24
24
|
simcats/sensor/_lorentzian_sensor_peak.py,sha256=Rj3Tpk6dksZGfOAHhdSGQR-wJo3ehdmXnumXyGuaNC4,3952
|
|
25
25
|
simcats/sensor/_sensor_interface.py,sha256=mn5L9WbAIMun_ou0AHgOV6XiBeykYPugndLAeufadTo,5064
|
|
26
|
-
simcats/support_functions/__init__.py,sha256=
|
|
26
|
+
simcats/support_functions/__init__.py,sha256=6aXPXtvcaL4bcOADy1yWhhyehT6BDs3Yt_3uOFbBE50,1086
|
|
27
27
|
simcats/support_functions/_cumulative_distribution_functions.py,sha256=pE01RoSL2VwtkBP7xYivd-vcd6krSJrb4xb8MCfyRBA,3366
|
|
28
28
|
simcats/support_functions/_fermi_filter1d.py,sha256=F4GrdLt0bOXidRdg0P-163Op-bxKvgHte3ENI39qYAk,3706
|
|
29
|
-
simcats/support_functions/_parameter_sampling.py,sha256=
|
|
29
|
+
simcats/support_functions/_parameter_sampling.py,sha256=xEd4V0bUqpkE5DpZA0i1YNe8G86IZP1LB2dmkFTg3l0,15331
|
|
30
30
|
simcats/support_functions/_plotting.py,sha256=xc050m4W6RZm8XdOdqruc-6IYyhzW9UFvNlJEgkJRi8,9070
|
|
31
31
|
simcats/support_functions/_rotate_points.py,sha256=4tgzE4a4uykBVw2pSK55DzGe-5n9N38nsBYhfA38Qgs,778
|
|
32
32
|
simcats/support_functions/_signed_dist_points_line.py,sha256=dMnDoBARY7C48xCHFp8mNFNCkPk7YUiaWaRqAsindsE,908
|
|
33
|
-
simcats-1.
|
|
34
|
-
simcats-1.
|
|
35
|
-
simcats-1.
|
|
36
|
-
simcats-1.
|
|
37
|
-
simcats-1.
|
|
33
|
+
simcats-1.2.0.dist-info/LICENSE,sha256=aZs_e2FTt6geKaC1hd9FpoxERpb5YHhxJ608urp4nig,21294
|
|
34
|
+
simcats-1.2.0.dist-info/METADATA,sha256=QFMyj-AF9-K0_0u5mnPbCO1AXlB7l0gJqTDuIdT3ixg,11918
|
|
35
|
+
simcats-1.2.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
36
|
+
simcats-1.2.0.dist-info/top_level.txt,sha256=M-ExkkJ_NLsuuJiDo3iM2qPPPsEX29E2MQUmegBZ8Wk,8
|
|
37
|
+
simcats-1.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|