fwdd 0.1.0__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.
fwdd-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 nonohuff
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
fwdd-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,132 @@
1
+ Metadata-Version: 2.4
2
+ Name: fwdd
3
+ Version: 0.1.0
4
+ Summary: Finite Width Dynamical Decoupling (FWDD) implements Dynamical Decoupling considering the effects of Finite Pulse Widths.
5
+ Author-email: Noah Huffman <nonohuff@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 nonohuff
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/nonohuff/FWDD/tree/main
29
+ Project-URL: Repository, https://github.com/nonohuff/FWDD/tree/main
30
+ Classifier: Programming Language :: Python :: 3
31
+ Classifier: License :: OSI Approved :: MIT License
32
+ Classifier: Operating System :: OS Independent
33
+ Classifier: Intended Audience :: Science/Research
34
+ Classifier: Topic :: Scientific/Engineering :: Physics
35
+ Requires-Python: >=3.9
36
+ Description-Content-Type: text/markdown
37
+ License-File: LICENSE
38
+ Requires-Dist: numpy>=1.22.0
39
+ Requires-Dist: scipy>=1.8.0
40
+ Requires-Dist: pandas>=1.4.0
41
+ Requires-Dist: matplotlib>=3.5.0
42
+ Requires-Dist: seaborn>=0.11.0
43
+ Requires-Dist: numba>=0.55.0
44
+ Requires-Dist: scikit-learn>=1.0.0
45
+ Requires-Dist: scikit-optimize>=0.9.0
46
+ Requires-Dist: tqdm>=4.60.0
47
+ Requires-Dist: joblib>=1.1.0
48
+ Requires-Dist: psutil>=5.8.0
49
+ Dynamic: license-file
50
+
51
+ # FWDD
52
+ FWDD (Finite Width Dynamical Decoupling) implements Dynamical Decoupling considering the effects of FInite Pulse Widths. All times in the tutorials use microseconds $(\mu s)$.
53
+
54
+ The code presented here is used in the paper [Quantum sensing with a spin ensemble in a two-dimensional material](http://arxiv.org/abs/2509.08984) to predict noise spectra.
55
+
56
+ # Installation
57
+
58
+ You can install `fwdd` via `pip` or `conda` (from Conda-forge).
59
+
60
+ ## Via pip
61
+ ```bash
62
+ pip install fwdd
63
+ ```
64
+
65
+ ## Via conda (Conda-forge)
66
+ ```bash
67
+ conda install -c conda-forge fwdd
68
+ ```
69
+
70
+ ## Local Development & Tutorials
71
+ If you are running the tutorial notebooks locally and want to make live changes, run an editable installation:
72
+ ```bash
73
+ git clone https://github.com/nonohuff/FWDD.git
74
+ cd FWDD
75
+ pip install -e .
76
+ ```
77
+
78
+ # Quick Start
79
+ Here is how you can import the core modules of `fwdd` in your python code:
80
+ ```python
81
+ from fwdd import filter_function as ff
82
+ from fwdd import noise_spectra as ns
83
+ from fwdd import coherence_profile as cp
84
+ from fwdd import noise_learning_fitting as nlf
85
+ from fwdd import fitting_utils as fu
86
+ ```
87
+
88
+ # Coherence-Noise Relationship
89
+
90
+ A given dynamical decoupling pulse sequence of $N$ pulses (e.g. CPMG, XY8) yields a corresponding filter function, $F_N(\omega, t)$, which is related to the coherence decay as follows:
91
+
92
+ $$
93
+ \begin{align}
94
+ C_N(t) = e^{-\chi_N(t)}, \quad \chi(t) = (t/T_{2})^\beta, \\
95
+ \chi_N(t) = \frac{1}{\pi} \int _{0}^{\infty} d\omega S(\omega) \frac{F_N(\omega,t)}{\omega^2}
96
+ \end{align}
97
+ $$
98
+
99
+ Here, $C_N(t)$ is the coherence decay as a function of time characterized by two important parameters: $T_2$ - coherence time and $\beta$ - stretch factor. $F_N(\omega,t)$ is a filer function defined by the dynamical decoupling pulse sequence, and $S(\omega)$ is the power spectral density of the underlying noise (standard units $\frac{Hz^2}{Hz}$).
100
+
101
+ ## Delta Function Approximation
102
+
103
+ If $F_N(\omega,t)$ is approximated as a $\delta$ function peaked at $\omega_0 =\pi N/T$, where the total experiment time, $T=2N\tau+Nt_{\pi}$, $2\tau$ being the wait time between the pulses and $t_{\pi}$ is the pulse width. Then, the integral above is trival to invert and we have:
104
+
105
+ $$
106
+ \begin{equation}
107
+ S(\omega) = -\pi \frac{ln(C_N(T))}{T}.
108
+ \end{equation}
109
+ $$
110
+
111
+ This approximation holds true when the $\pi$-pulses are themselves much shorter compared to the delay between them and as a consequence the coherence time, $T_2$.
112
+
113
+ ## Finite-width Pulses
114
+
115
+ When the length of the $\pi$-pulse becomes a sizable fraction of the delay (or $T_2$), such a $\delta$ approximation cannot be made. In that case, the filter function needs to be modified to accommodate for the finite pulse duration and can be expressed as:
116
+
117
+ $$
118
+ F_{N}(\omega,T)=\left|1+(-1)^{N+1}e^{i\omega T} +2\sum_{k=1}^N(-1)^ke^{i\omega t_{k}}\cos\left(\frac{\omega t_{\pi}}{2}\right)\right|^{2}
119
+ $$
120
+
121
+ Where $t_k$ is the time corresponding to the center of the $k^{th}$ pulse, and $t_{\pi}$ is the pulse width.
122
+
123
+ # Tutorial Notebooks
124
+
125
+ We have included several tutorial notebooks to make adapting this code to your purposes easier. They cover how we implement noise spectral densities, $S(\omega)$, the finite-width filter function, coherence profile, $C_N(t)$, and finally, how we go about fitting noise profiles to observed $C_N(t)$ data (and how to do it for you own data/noise models!). The reccomended viewwing of these notebooks are.
126
+
127
+ `noise_tutorial.ipynb` -> `filter_function_tutorial.ipynb` -> `coherence_profile_tutorial.ipynb` -> `noise_learning_fitting.ipynb`
128
+
129
+ # Conventions
130
+ * $\omega = 2 \pi f$
131
+ * $t = \frac{1}{f}$
132
+ * Time varibles assume microseconds, so `tau_p = 0.024` means $0.024 \mu s$ or $24 ns$
fwdd-0.1.0/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # FWDD
2
+ FWDD (Finite Width Dynamical Decoupling) implements Dynamical Decoupling considering the effects of FInite Pulse Widths. All times in the tutorials use microseconds $(\mu s)$.
3
+
4
+ The code presented here is used in the paper [Quantum sensing with a spin ensemble in a two-dimensional material](http://arxiv.org/abs/2509.08984) to predict noise spectra.
5
+
6
+ # Installation
7
+
8
+ You can install `fwdd` via `pip` or `conda` (from Conda-forge).
9
+
10
+ ## Via pip
11
+ ```bash
12
+ pip install fwdd
13
+ ```
14
+
15
+ ## Via conda (Conda-forge)
16
+ ```bash
17
+ conda install -c conda-forge fwdd
18
+ ```
19
+
20
+ ## Local Development & Tutorials
21
+ If you are running the tutorial notebooks locally and want to make live changes, run an editable installation:
22
+ ```bash
23
+ git clone https://github.com/nonohuff/FWDD.git
24
+ cd FWDD
25
+ pip install -e .
26
+ ```
27
+
28
+ # Quick Start
29
+ Here is how you can import the core modules of `fwdd` in your python code:
30
+ ```python
31
+ from fwdd import filter_function as ff
32
+ from fwdd import noise_spectra as ns
33
+ from fwdd import coherence_profile as cp
34
+ from fwdd import noise_learning_fitting as nlf
35
+ from fwdd import fitting_utils as fu
36
+ ```
37
+
38
+ # Coherence-Noise Relationship
39
+
40
+ A given dynamical decoupling pulse sequence of $N$ pulses (e.g. CPMG, XY8) yields a corresponding filter function, $F_N(\omega, t)$, which is related to the coherence decay as follows:
41
+
42
+ $$
43
+ \begin{align}
44
+ C_N(t) = e^{-\chi_N(t)}, \quad \chi(t) = (t/T_{2})^\beta, \\
45
+ \chi_N(t) = \frac{1}{\pi} \int _{0}^{\infty} d\omega S(\omega) \frac{F_N(\omega,t)}{\omega^2}
46
+ \end{align}
47
+ $$
48
+
49
+ Here, $C_N(t)$ is the coherence decay as a function of time characterized by two important parameters: $T_2$ - coherence time and $\beta$ - stretch factor. $F_N(\omega,t)$ is a filer function defined by the dynamical decoupling pulse sequence, and $S(\omega)$ is the power spectral density of the underlying noise (standard units $\frac{Hz^2}{Hz}$).
50
+
51
+ ## Delta Function Approximation
52
+
53
+ If $F_N(\omega,t)$ is approximated as a $\delta$ function peaked at $\omega_0 =\pi N/T$, where the total experiment time, $T=2N\tau+Nt_{\pi}$, $2\tau$ being the wait time between the pulses and $t_{\pi}$ is the pulse width. Then, the integral above is trival to invert and we have:
54
+
55
+ $$
56
+ \begin{equation}
57
+ S(\omega) = -\pi \frac{ln(C_N(T))}{T}.
58
+ \end{equation}
59
+ $$
60
+
61
+ This approximation holds true when the $\pi$-pulses are themselves much shorter compared to the delay between them and as a consequence the coherence time, $T_2$.
62
+
63
+ ## Finite-width Pulses
64
+
65
+ When the length of the $\pi$-pulse becomes a sizable fraction of the delay (or $T_2$), such a $\delta$ approximation cannot be made. In that case, the filter function needs to be modified to accommodate for the finite pulse duration and can be expressed as:
66
+
67
+ $$
68
+ F_{N}(\omega,T)=\left|1+(-1)^{N+1}e^{i\omega T} +2\sum_{k=1}^N(-1)^ke^{i\omega t_{k}}\cos\left(\frac{\omega t_{\pi}}{2}\right)\right|^{2}
69
+ $$
70
+
71
+ Where $t_k$ is the time corresponding to the center of the $k^{th}$ pulse, and $t_{\pi}$ is the pulse width.
72
+
73
+ # Tutorial Notebooks
74
+
75
+ We have included several tutorial notebooks to make adapting this code to your purposes easier. They cover how we implement noise spectral densities, $S(\omega)$, the finite-width filter function, coherence profile, $C_N(t)$, and finally, how we go about fitting noise profiles to observed $C_N(t)$ data (and how to do it for you own data/noise models!). The reccomended viewwing of these notebooks are.
76
+
77
+ `noise_tutorial.ipynb` -> `filter_function_tutorial.ipynb` -> `coherence_profile_tutorial.ipynb` -> `noise_learning_fitting.ipynb`
78
+
79
+ # Conventions
80
+ * $\omega = 2 \pi f$
81
+ * $t = \frac{1}{f}$
82
+ * Time varibles assume microseconds, so `tau_p = 0.024` means $0.024 \mu s$ or $24 ns$
@@ -0,0 +1,38 @@
1
+ from .filter_function import (
2
+ filter_function_approx,
3
+ numba_complex_sum,
4
+ filter_function_finite,
5
+ )
6
+ from .noise_spectra import (
7
+ noise_spectrum_1f,
8
+ noise_spectrum_lor,
9
+ noise_spectrum_white,
10
+ noise_spectrum_double_power_law,
11
+ noise_spectrum_combination,
12
+ )
13
+ from .coherence_profile import (
14
+ coherence_decay_profile_delta,
15
+ noise_inversion_delta,
16
+ coherence_decay_profile_finite_peaks_with_widths,
17
+ parallel_coherence_decay,
18
+ ParallelExecutionError,
19
+ MemoryThresholdError,
20
+ )
21
+ from .noise_learning_fitting import (
22
+ func_to_fit,
23
+ fit_coherence_decay,
24
+ fit_noise_spectrum,
25
+ fit_coherence_decay_combined,
26
+ create_parameter_constraints,
27
+ create_coherence_parameter_constraints,
28
+ )
29
+ from .fitting_utils import (
30
+ find_widest_contiguous_stretch,
31
+ find_time_range_for_C_t_bounds,
32
+ add_gaussian_noise,
33
+ format_parameters,
34
+ create_combined_analysis_plot,
35
+ calculate_total_combinations,
36
+ bootstrap_multiple_samples,
37
+ analyze_intervals,
38
+ )