lockkernel 1.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.
- lockkernel-1.1.0/LICENSE +202 -0
- lockkernel-1.1.0/NOTICE +17 -0
- lockkernel-1.1.0/PKG-INFO +207 -0
- lockkernel-1.1.0/README.md +177 -0
- lockkernel-1.1.0/pyproject.toml +39 -0
- lockkernel-1.1.0/setup.cfg +4 -0
- lockkernel-1.1.0/src/lockkernel/__init__.py +15 -0
- lockkernel-1.1.0/src/lockkernel/cumulant.py +399 -0
- lockkernel-1.1.0/src/lockkernel/ensemble.py +105 -0
- lockkernel-1.1.0/src/lockkernel/exact.py +243 -0
- lockkernel-1.1.0/src/lockkernel/kernels.py +214 -0
- lockkernel-1.1.0/src/lockkernel/lineshapes.py +148 -0
- lockkernel-1.1.0/src/lockkernel/measured.py +271 -0
- lockkernel-1.1.0/src/lockkernel/parametric.py +266 -0
- lockkernel-1.1.0/src/lockkernel.egg-info/PKG-INFO +207 -0
- lockkernel-1.1.0/src/lockkernel.egg-info/SOURCES.txt +22 -0
- lockkernel-1.1.0/src/lockkernel.egg-info/dependency_links.txt +1 -0
- lockkernel-1.1.0/src/lockkernel.egg-info/requires.txt +6 -0
- lockkernel-1.1.0/src/lockkernel.egg-info/top_level.txt +1 -0
- lockkernel-1.1.0/tests/test_cumulant.py +120 -0
- lockkernel-1.1.0/tests/test_meanfield.py +63 -0
- lockkernel-1.1.0/tests/test_measured.py +132 -0
- lockkernel-1.1.0/tests/test_parametric.py +77 -0
- lockkernel-1.1.0/tests/test_universality.py +108 -0
lockkernel-1.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
lockkernel-1.1.0/NOTICE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
lockkernel: locking kernel universality in synchronization transitions
|
|
2
|
+
|
|
3
|
+
Copyright 2026 Tanvir M. Mahim, M. Mosaddequr Rahman and Abu S. M. Mohsin
|
|
4
|
+
Department of Electrical and Electronic Engineering, BRAC University,
|
|
5
|
+
Dhaka 1212, Bangladesh
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lockkernel
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Locking kernel universality: exact thresholds and exponents of synchronization transitions, and fits of measured branches with error bars and refusals
|
|
5
|
+
Author: Tanvir Mahmud Mahim
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/TaN-MM-Org/lockkernel
|
|
8
|
+
Project-URL: Issues, https://github.com/TaN-MM-Org/lockkernel/issues
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
License-File: NOTICE
|
|
24
|
+
Requires-Dist: numpy>=1.22
|
|
25
|
+
Requires-Dist: scipy>=1.8
|
|
26
|
+
Requires-Dist: mpmath>=1.2
|
|
27
|
+
Provides-Extra: test
|
|
28
|
+
Requires-Dist: pytest>=7; extra == "test"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# lockkernel
|
|
32
|
+
|
|
33
|
+
[](https://pypi.org/project/lockkernel/) [](https://github.com/TaN-MM-Org/lockkernel/actions)
|
|
34
|
+
[](LICENSE)
|
|
35
|
+
|
|
36
|
+
A population of oscillators with spread frequencies begins to
|
|
37
|
+
synchronize when the coupling passes a threshold, and the order
|
|
38
|
+
parameter then grows from zero as a power of the distance above it.
|
|
39
|
+
That exponent has been derived separately for each case in which it
|
|
40
|
+
has been asked. This package computes it from one statement: the
|
|
41
|
+
quantity deciding the onset is the **locking kernel** W(u) -- the
|
|
42
|
+
time-averaged projection a single oscillator keeps on the collective
|
|
43
|
+
field, as a function of its detuning in units of the locked region's
|
|
44
|
+
width -- and one substitution turns the self-consistency into an
|
|
45
|
+
**exact parametric solution**,
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
chiN(Omega) = Omega / H(Omega), R(Omega) = H(Omega),
|
|
49
|
+
H(Omega) = Omega * integral p(Omega u) W(u) du,
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
for ANY frequency distribution and ANY kernel: threshold
|
|
53
|
+
chiN_c = 1/(p(0) m) with m the kernel mass, exponent beta = 1/(s-1)
|
|
54
|
+
for a kernel tail W ~ |u|^-s with 1 < s < 3 and beta = 1/2 for
|
|
55
|
+
s >= 3, the amplitude in closed form, and the order of the transition
|
|
56
|
+
from the sign of one nonlocal integral. Sweeping Omega traces the
|
|
57
|
+
branch with no root finding and no cancellation near threshold, so
|
|
58
|
+
exponents come out at tens of digits, not two.
|
|
59
|
+
|
|
60
|
+
Version 1.1 adds the lab half, `lockkernel.measured`: given a
|
|
61
|
+
MEASURED synchronization branch -- from an experiment, or from a
|
|
62
|
+
simulation whose kernel is not known -- it fits threshold, exponent
|
|
63
|
+
and amplitude together with error bars, reads the kernel tail back
|
|
64
|
+
off the exponent through the same dictionary the theory half proves,
|
|
65
|
+
plans how many points a target error bar costs, and refuses, with an
|
|
66
|
+
explanation, whenever the data cannot support the number asked of
|
|
67
|
+
them.
|
|
68
|
+
|
|
69
|
+
## Install
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
pip install lockkernel # NumPy + SciPy + mpmath
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## The two halves in one example
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
import numpy as np
|
|
79
|
+
import mpmath as mp
|
|
80
|
+
from lockkernel import fit_branch, kernel_tail_from_beta, points_for_beta
|
|
81
|
+
from lockkernel.kernels import conservative, power_tail, predicted_beta
|
|
82
|
+
from lockkernel.lineshapes import lorentzian, gaussian
|
|
83
|
+
from lockkernel.parametric import threshold, sweep, extract_beta
|
|
84
|
+
|
|
85
|
+
mp.mp.dps = 25
|
|
86
|
+
|
|
87
|
+
# THEORY: exact threshold and exponent for any line and kernel.
|
|
88
|
+
line = lorentzian()
|
|
89
|
+
print(threshold(line, conservative())) # chiN_c = 1/(p(0) pi)
|
|
90
|
+
print(extract_beta(line, power_tail(2.5),
|
|
91
|
+
np.linspace(-6, -3, 7))[-1]) # -> 2/3 = 1/(s-1)
|
|
92
|
+
|
|
93
|
+
# LAB: fit a measured branch -- here, points generated by the exact
|
|
94
|
+
# solution stand in for your data; pass your own (chi, R) instead.
|
|
95
|
+
pts = sweep(line, conservative(), np.linspace(-4.3, -2.0, 12))
|
|
96
|
+
chi = np.array([float(p[0]) for p in pts])
|
|
97
|
+
r = np.array([float(p[1]) for p in pts])
|
|
98
|
+
fit = fit_branch(chi, r, reference="cavity ensemble run 17, 2026-09-18")
|
|
99
|
+
print(fit.chi_c, "+-", fit.sigma_chi_c) # the measured threshold
|
|
100
|
+
print(fit.beta, "+-", fit.sigma_beta) # the measured exponent
|
|
101
|
+
|
|
102
|
+
# ... and what the exponent says about the kernel the system has:
|
|
103
|
+
s, s_sigma = kernel_tail_from_beta(fit.beta, max(fit.sigma_beta, 0.01))
|
|
104
|
+
|
|
105
|
+
# Plan the next measurement: points needed for a 1 % exponent error
|
|
106
|
+
# bar over two decades of reduced coupling at 5 % scatter.
|
|
107
|
+
n, achieved = points_for_beta(0.01, decades=2.0, sigma_log=0.05)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## What is inside
|
|
111
|
+
|
|
112
|
+
- **`lineshapes` / `kernels`**: frequency distributions (Lorentzian,
|
|
113
|
+
Gaussian, Student-t, box, and your own) and locking kernels
|
|
114
|
+
(conservative 1/(1+u^2), Kuramoto, algebraic tails, Gaussian,
|
|
115
|
+
coupling-spread-averaged heterogeneous kernels) as small declared
|
|
116
|
+
objects with masses, tails and supports the quadrature can use.
|
|
117
|
+
- **`parametric`**: the exact parametric solution -- `threshold`,
|
|
118
|
+
`branch_point`, `sweep`, `extract_beta`, the closed-form amplitude
|
|
119
|
+
along the whole line of exponents, the order-of-transition
|
|
120
|
+
criterion `c_coefficient` and `fold_interval` for hysteretic
|
|
121
|
+
onsets -- in mpmath arbitrary precision.
|
|
122
|
+
- **`measured`** (new in 1.1): `fit_branch` for measured (chi, R)
|
|
123
|
+
points with mandatory provenance -- threshold, exponent and
|
|
124
|
+
amplitude with asymptotic error bars and residual diagnostics;
|
|
125
|
+
`kernel_tail_from_beta`, the exact dictionary inverted with error
|
|
126
|
+
propagation, refusing to name a single tail where beta is
|
|
127
|
+
consistent with 1/2 and only the class s >= 3 is identified;
|
|
128
|
+
`beta_relative_sigma` / `points_for_beta`, the closed-form error
|
|
129
|
+
bar of a log-log slope and its exact inversion into measurement
|
|
130
|
+
effort.
|
|
131
|
+
- **`cumulant` / `ensemble` / `exact`**: the class-resolved
|
|
132
|
+
second-cumulant dynamics of the underlying spin problem, principled
|
|
133
|
+
discretisation of a line into detuning classes (algebraic tails
|
|
134
|
+
kept, stiff far tail propagated exactly), and exact
|
|
135
|
+
small-ensemble references (full Hamiltonian, collective-spin and
|
|
136
|
+
class-symmetric diagonalisation) the solver is tested against.
|
|
137
|
+
|
|
138
|
+
## Refusals, not guesses
|
|
139
|
+
|
|
140
|
+
Uncited measured data, too few points, couplings out of order, less
|
|
141
|
+
than a decade of reduced coupling, a threshold the data do not
|
|
142
|
+
resolve, an exponent consistent with the unidentifiable beta = 1/2
|
|
143
|
+
class, an exponent below every kernel's reach: each is refused with
|
|
144
|
+
the reason and, where one exists, the remedy.
|
|
145
|
+
|
|
146
|
+
## How it is checked
|
|
147
|
+
|
|
148
|
+
64 tests (Python 3.9-3.14, run in CI on every push). The theory half
|
|
149
|
+
is held against closed forms at high precision: the parametric branch
|
|
150
|
+
against two independent closed forms to better than 1e-28 over six
|
|
151
|
+
decades of locking bandwidth; the exponent formula along a line of
|
|
152
|
+
kernel tails; closed amplitude values (1, pi/2, 4/3, pi^2/4) on four
|
|
153
|
+
line shapes; the coefficient c computed two independent ways to
|
|
154
|
+
1e-11; the class-resolved solver against exact diagonalisation of
|
|
155
|
+
the full Hamiltonian. The lab half is checked BY the theory half:
|
|
156
|
+
`fit_branch` must recover the threshold and the exponent of branches
|
|
157
|
+
generated by the exact parametric solution -- conservative kernel
|
|
158
|
+
(beta = 1) and algebraic tail s = 2.5 (beta = 2/3) -- noiselessly and
|
|
159
|
+
under seeded noise within its own reported error bars; the planning
|
|
160
|
+
closed form is held against seeded simulation and its inversion is
|
|
161
|
+
asserted on both sides.
|
|
162
|
+
|
|
163
|
+
## Honest limits
|
|
164
|
+
|
|
165
|
+
Recorded rather than hidden: the near-threshold power law is the
|
|
166
|
+
LEADING behavior, and data taken far above the onset bend away from
|
|
167
|
+
it -- the decade refusal and the residual diagnostics guard the fit,
|
|
168
|
+
not the user's range choice; the fit's error bars are the standard
|
|
169
|
+
asymptotic covariance, honest when the model holds and the noise
|
|
170
|
+
estimate is right, and stated as such. In the underlying undamped
|
|
171
|
+
spin problem the truncated cumulant hierarchy is secularly unstable
|
|
172
|
+
at long times (the module carries physicality diagnostics any
|
|
173
|
+
long-time use must be gated on), and the time-averaged kernel is an
|
|
174
|
+
assumption checked against the full dynamics, not a theorem.
|
|
175
|
+
|
|
176
|
+
## Provenance
|
|
177
|
+
|
|
178
|
+
This package is the maintained distribution of the reference
|
|
179
|
+
implementation for the locking-kernel universality study
|
|
180
|
+
([Tanvir-Mahmud-Mahim/locking-kernel-universality](https://github.com/Tanvir-Mahmud-Mahim/locking-kernel-universality),
|
|
181
|
+
concept DOI
|
|
182
|
+
[10.5281/zenodo.22696369](https://doi.org/10.5281/zenodo.22696369)),
|
|
183
|
+
whose scripts, archived run records and figures remain with the
|
|
184
|
+
study. The core modules are carried over unchanged in v1.1.0; the
|
|
185
|
+
`measured` module and the packaging are new here. Copyright as in
|
|
186
|
+
[NOTICE](NOTICE).
|
|
187
|
+
|
|
188
|
+
## Support and governance
|
|
189
|
+
|
|
190
|
+
Written and maintained by Tanvir Mahmud Mahim (Department of
|
|
191
|
+
Electrical and Electronic Engineering, BRAC University), who reviews
|
|
192
|
+
every change and takes the final decision on scope and releases.
|
|
193
|
+
Design questions are discussed in the open in issues and pull
|
|
194
|
+
requests, and the standing rule of
|
|
195
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) binds the maintainer exactly as it
|
|
196
|
+
binds contributors: a change that touches the physics arrives with a
|
|
197
|
+
test, and a claim arrives with its source.
|
|
198
|
+
|
|
199
|
+
Support runs through the
|
|
200
|
+
[issue tracker](https://github.com/TaN-MM-Org/lockkernel/issues).
|
|
201
|
+
Usage questions are welcome alongside bug reports; a docstring that
|
|
202
|
+
left a unit or a convention unclear is treated as a documentation
|
|
203
|
+
bug, not user error.
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# lockkernel
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/lockkernel/) [](https://github.com/TaN-MM-Org/lockkernel/actions)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
A population of oscillators with spread frequencies begins to
|
|
7
|
+
synchronize when the coupling passes a threshold, and the order
|
|
8
|
+
parameter then grows from zero as a power of the distance above it.
|
|
9
|
+
That exponent has been derived separately for each case in which it
|
|
10
|
+
has been asked. This package computes it from one statement: the
|
|
11
|
+
quantity deciding the onset is the **locking kernel** W(u) -- the
|
|
12
|
+
time-averaged projection a single oscillator keeps on the collective
|
|
13
|
+
field, as a function of its detuning in units of the locked region's
|
|
14
|
+
width -- and one substitution turns the self-consistency into an
|
|
15
|
+
**exact parametric solution**,
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
chiN(Omega) = Omega / H(Omega), R(Omega) = H(Omega),
|
|
19
|
+
H(Omega) = Omega * integral p(Omega u) W(u) du,
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
for ANY frequency distribution and ANY kernel: threshold
|
|
23
|
+
chiN_c = 1/(p(0) m) with m the kernel mass, exponent beta = 1/(s-1)
|
|
24
|
+
for a kernel tail W ~ |u|^-s with 1 < s < 3 and beta = 1/2 for
|
|
25
|
+
s >= 3, the amplitude in closed form, and the order of the transition
|
|
26
|
+
from the sign of one nonlocal integral. Sweeping Omega traces the
|
|
27
|
+
branch with no root finding and no cancellation near threshold, so
|
|
28
|
+
exponents come out at tens of digits, not two.
|
|
29
|
+
|
|
30
|
+
Version 1.1 adds the lab half, `lockkernel.measured`: given a
|
|
31
|
+
MEASURED synchronization branch -- from an experiment, or from a
|
|
32
|
+
simulation whose kernel is not known -- it fits threshold, exponent
|
|
33
|
+
and amplitude together with error bars, reads the kernel tail back
|
|
34
|
+
off the exponent through the same dictionary the theory half proves,
|
|
35
|
+
plans how many points a target error bar costs, and refuses, with an
|
|
36
|
+
explanation, whenever the data cannot support the number asked of
|
|
37
|
+
them.
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
pip install lockkernel # NumPy + SciPy + mpmath
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## The two halves in one example
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
import numpy as np
|
|
49
|
+
import mpmath as mp
|
|
50
|
+
from lockkernel import fit_branch, kernel_tail_from_beta, points_for_beta
|
|
51
|
+
from lockkernel.kernels import conservative, power_tail, predicted_beta
|
|
52
|
+
from lockkernel.lineshapes import lorentzian, gaussian
|
|
53
|
+
from lockkernel.parametric import threshold, sweep, extract_beta
|
|
54
|
+
|
|
55
|
+
mp.mp.dps = 25
|
|
56
|
+
|
|
57
|
+
# THEORY: exact threshold and exponent for any line and kernel.
|
|
58
|
+
line = lorentzian()
|
|
59
|
+
print(threshold(line, conservative())) # chiN_c = 1/(p(0) pi)
|
|
60
|
+
print(extract_beta(line, power_tail(2.5),
|
|
61
|
+
np.linspace(-6, -3, 7))[-1]) # -> 2/3 = 1/(s-1)
|
|
62
|
+
|
|
63
|
+
# LAB: fit a measured branch -- here, points generated by the exact
|
|
64
|
+
# solution stand in for your data; pass your own (chi, R) instead.
|
|
65
|
+
pts = sweep(line, conservative(), np.linspace(-4.3, -2.0, 12))
|
|
66
|
+
chi = np.array([float(p[0]) for p in pts])
|
|
67
|
+
r = np.array([float(p[1]) for p in pts])
|
|
68
|
+
fit = fit_branch(chi, r, reference="cavity ensemble run 17, 2026-09-18")
|
|
69
|
+
print(fit.chi_c, "+-", fit.sigma_chi_c) # the measured threshold
|
|
70
|
+
print(fit.beta, "+-", fit.sigma_beta) # the measured exponent
|
|
71
|
+
|
|
72
|
+
# ... and what the exponent says about the kernel the system has:
|
|
73
|
+
s, s_sigma = kernel_tail_from_beta(fit.beta, max(fit.sigma_beta, 0.01))
|
|
74
|
+
|
|
75
|
+
# Plan the next measurement: points needed for a 1 % exponent error
|
|
76
|
+
# bar over two decades of reduced coupling at 5 % scatter.
|
|
77
|
+
n, achieved = points_for_beta(0.01, decades=2.0, sigma_log=0.05)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## What is inside
|
|
81
|
+
|
|
82
|
+
- **`lineshapes` / `kernels`**: frequency distributions (Lorentzian,
|
|
83
|
+
Gaussian, Student-t, box, and your own) and locking kernels
|
|
84
|
+
(conservative 1/(1+u^2), Kuramoto, algebraic tails, Gaussian,
|
|
85
|
+
coupling-spread-averaged heterogeneous kernels) as small declared
|
|
86
|
+
objects with masses, tails and supports the quadrature can use.
|
|
87
|
+
- **`parametric`**: the exact parametric solution -- `threshold`,
|
|
88
|
+
`branch_point`, `sweep`, `extract_beta`, the closed-form amplitude
|
|
89
|
+
along the whole line of exponents, the order-of-transition
|
|
90
|
+
criterion `c_coefficient` and `fold_interval` for hysteretic
|
|
91
|
+
onsets -- in mpmath arbitrary precision.
|
|
92
|
+
- **`measured`** (new in 1.1): `fit_branch` for measured (chi, R)
|
|
93
|
+
points with mandatory provenance -- threshold, exponent and
|
|
94
|
+
amplitude with asymptotic error bars and residual diagnostics;
|
|
95
|
+
`kernel_tail_from_beta`, the exact dictionary inverted with error
|
|
96
|
+
propagation, refusing to name a single tail where beta is
|
|
97
|
+
consistent with 1/2 and only the class s >= 3 is identified;
|
|
98
|
+
`beta_relative_sigma` / `points_for_beta`, the closed-form error
|
|
99
|
+
bar of a log-log slope and its exact inversion into measurement
|
|
100
|
+
effort.
|
|
101
|
+
- **`cumulant` / `ensemble` / `exact`**: the class-resolved
|
|
102
|
+
second-cumulant dynamics of the underlying spin problem, principled
|
|
103
|
+
discretisation of a line into detuning classes (algebraic tails
|
|
104
|
+
kept, stiff far tail propagated exactly), and exact
|
|
105
|
+
small-ensemble references (full Hamiltonian, collective-spin and
|
|
106
|
+
class-symmetric diagonalisation) the solver is tested against.
|
|
107
|
+
|
|
108
|
+
## Refusals, not guesses
|
|
109
|
+
|
|
110
|
+
Uncited measured data, too few points, couplings out of order, less
|
|
111
|
+
than a decade of reduced coupling, a threshold the data do not
|
|
112
|
+
resolve, an exponent consistent with the unidentifiable beta = 1/2
|
|
113
|
+
class, an exponent below every kernel's reach: each is refused with
|
|
114
|
+
the reason and, where one exists, the remedy.
|
|
115
|
+
|
|
116
|
+
## How it is checked
|
|
117
|
+
|
|
118
|
+
64 tests (Python 3.9-3.14, run in CI on every push). The theory half
|
|
119
|
+
is held against closed forms at high precision: the parametric branch
|
|
120
|
+
against two independent closed forms to better than 1e-28 over six
|
|
121
|
+
decades of locking bandwidth; the exponent formula along a line of
|
|
122
|
+
kernel tails; closed amplitude values (1, pi/2, 4/3, pi^2/4) on four
|
|
123
|
+
line shapes; the coefficient c computed two independent ways to
|
|
124
|
+
1e-11; the class-resolved solver against exact diagonalisation of
|
|
125
|
+
the full Hamiltonian. The lab half is checked BY the theory half:
|
|
126
|
+
`fit_branch` must recover the threshold and the exponent of branches
|
|
127
|
+
generated by the exact parametric solution -- conservative kernel
|
|
128
|
+
(beta = 1) and algebraic tail s = 2.5 (beta = 2/3) -- noiselessly and
|
|
129
|
+
under seeded noise within its own reported error bars; the planning
|
|
130
|
+
closed form is held against seeded simulation and its inversion is
|
|
131
|
+
asserted on both sides.
|
|
132
|
+
|
|
133
|
+
## Honest limits
|
|
134
|
+
|
|
135
|
+
Recorded rather than hidden: the near-threshold power law is the
|
|
136
|
+
LEADING behavior, and data taken far above the onset bend away from
|
|
137
|
+
it -- the decade refusal and the residual diagnostics guard the fit,
|
|
138
|
+
not the user's range choice; the fit's error bars are the standard
|
|
139
|
+
asymptotic covariance, honest when the model holds and the noise
|
|
140
|
+
estimate is right, and stated as such. In the underlying undamped
|
|
141
|
+
spin problem the truncated cumulant hierarchy is secularly unstable
|
|
142
|
+
at long times (the module carries physicality diagnostics any
|
|
143
|
+
long-time use must be gated on), and the time-averaged kernel is an
|
|
144
|
+
assumption checked against the full dynamics, not a theorem.
|
|
145
|
+
|
|
146
|
+
## Provenance
|
|
147
|
+
|
|
148
|
+
This package is the maintained distribution of the reference
|
|
149
|
+
implementation for the locking-kernel universality study
|
|
150
|
+
([Tanvir-Mahmud-Mahim/locking-kernel-universality](https://github.com/Tanvir-Mahmud-Mahim/locking-kernel-universality),
|
|
151
|
+
concept DOI
|
|
152
|
+
[10.5281/zenodo.22696369](https://doi.org/10.5281/zenodo.22696369)),
|
|
153
|
+
whose scripts, archived run records and figures remain with the
|
|
154
|
+
study. The core modules are carried over unchanged in v1.1.0; the
|
|
155
|
+
`measured` module and the packaging are new here. Copyright as in
|
|
156
|
+
[NOTICE](NOTICE).
|
|
157
|
+
|
|
158
|
+
## Support and governance
|
|
159
|
+
|
|
160
|
+
Written and maintained by Tanvir Mahmud Mahim (Department of
|
|
161
|
+
Electrical and Electronic Engineering, BRAC University), who reviews
|
|
162
|
+
every change and takes the final decision on scope and releases.
|
|
163
|
+
Design questions are discussed in the open in issues and pull
|
|
164
|
+
requests, and the standing rule of
|
|
165
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) binds the maintainer exactly as it
|
|
166
|
+
binds contributors: a change that touches the physics arrives with a
|
|
167
|
+
test, and a claim arrives with its source.
|
|
168
|
+
|
|
169
|
+
Support runs through the
|
|
170
|
+
[issue tracker](https://github.com/TaN-MM-Org/lockkernel/issues).
|
|
171
|
+
Usage questions are welcome alongside bug reports; a docstring that
|
|
172
|
+
left a unit or a convention unclear is treated as a documentation
|
|
173
|
+
bug, not user error.
|
|
174
|
+
|
|
175
|
+
## License
|
|
176
|
+
|
|
177
|
+
Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "lockkernel"
|
|
7
|
+
version = "1.1.0"
|
|
8
|
+
description = "Locking kernel universality: exact thresholds and exponents of synchronization transitions, and fits of measured branches with error bars and refusals"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = {text = "Apache-2.0"}
|
|
12
|
+
authors = [{name = "Tanvir Mahmud Mahim"}]
|
|
13
|
+
dependencies = ["numpy>=1.22", "scipy>=1.8", "mpmath>=1.2"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 5 - Production/Stable",
|
|
16
|
+
"Intended Audience :: Science/Research",
|
|
17
|
+
"License :: OSI Approved :: Apache Software License",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.9",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Programming Language :: Python :: 3.14",
|
|
25
|
+
"Topic :: Scientific/Engineering :: Physics",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Homepage = "https://github.com/TaN-MM-Org/lockkernel"
|
|
30
|
+
Issues = "https://github.com/TaN-MM-Org/lockkernel/issues"
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
test = ["pytest>=7"]
|
|
34
|
+
|
|
35
|
+
[tool.setuptools.packages.find]
|
|
36
|
+
where = ["src"]
|
|
37
|
+
|
|
38
|
+
[tool.pytest.ini_options]
|
|
39
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Locking kernel universality: thresholds and exponents.
|
|
2
|
+
|
|
3
|
+
The package is organised around one object, the locking kernel W(u), and one
|
|
4
|
+
identity, the exact parametric solution of the locking self consistency in
|
|
5
|
+
`lockkernel.parametric`. The `lockkernel.measured` module is the lab half:
|
|
6
|
+
it fits a MEASURED synchronization branch for the threshold and the exponent,
|
|
7
|
+
with error bars and refusals, and reads the kernel tail back off the exponent
|
|
8
|
+
through the same dictionary the theory half proves.
|
|
9
|
+
"""
|
|
10
|
+
__version__ = "1.1.0"
|
|
11
|
+
|
|
12
|
+
from . import kernels, lineshapes, measured, parametric # noqa: F401
|
|
13
|
+
from .measured import (BranchFit, beta_relative_sigma, # noqa: F401
|
|
14
|
+
fit_branch, kernel_tail_from_beta,
|
|
15
|
+
points_for_beta)
|