kuramoto-benchmark-suite 2.0.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.
- kuramoto_benchmark_suite-2.0.0/LICENSE +21 -0
- kuramoto_benchmark_suite-2.0.0/PKG-INFO +263 -0
- kuramoto_benchmark_suite-2.0.0/README.md +217 -0
- kuramoto_benchmark_suite-2.0.0/pyproject.toml +113 -0
- kuramoto_benchmark_suite-2.0.0/setup.cfg +4 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/__init__.py +14 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/analysis/__init__.py +0 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/analysis/graphs.py +5 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/analysis/spectral.py +292 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/analysis/viz.py +1804 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/api.py +182 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/cli/__init__.py +65 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/cli/commands.py +960 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/cli/main.py +110 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/cli/style.py +194 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/cli/utils.py +107 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/config.py +105 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/dataset.py +146 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/graphs.py +58 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/metrics/__init__.py +11 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/metrics/analytics_engine.py +178 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/model.py +555 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/order_parameter.py +437 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/quantum/__init__.py +9 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/quantum/circuit_gen.py +132 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/solver_types.py +198 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/solvers/__init__.py +20 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/solvers/quantum_rotor.py +396 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/solvers/rk45.py +309 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/solvers/rotor.py +1996 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/topologies/__init__.py +4 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/topologies/analysis.py +127 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/topologies/loader.py +130 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/topologies/tree_of_life.py +153 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/utils/__init__.py +42 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/utils/phase.py +71 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/utils/seeding.py +262 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto/validation.py +52 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto_benchmark_suite.egg-info/PKG-INFO +263 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto_benchmark_suite.egg-info/SOURCES.txt +46 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto_benchmark_suite.egg-info/dependency_links.txt +1 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto_benchmark_suite.egg-info/entry_points.txt +2 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto_benchmark_suite.egg-info/requires.txt +15 -0
- kuramoto_benchmark_suite-2.0.0/src/kuramoto_benchmark_suite.egg-info/top_level.txt +1 -0
- kuramoto_benchmark_suite-2.0.0/tests/test_analytics_engine.py +51 -0
- kuramoto_benchmark_suite-2.0.0/tests/test_ga_rotor_invariants.py +224 -0
- kuramoto_benchmark_suite-2.0.0/tests/test_generate_kuramoto_dataset.py +52 -0
- kuramoto_benchmark_suite-2.0.0/tests/test_quantum_rotor_solver.py +222 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 eigenscribe
|
|
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.
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kuramoto-benchmark-suite
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Benchmark-grade synthetic dataset generator for Kuramoto oscillator systems
|
|
5
|
+
Author: eigenscribe
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 eigenscribe
|
|
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
|
+
Requires-Python: >=3.10
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: numpy>=1.23
|
|
32
|
+
Requires-Dist: scipy>=1.10
|
|
33
|
+
Requires-Dist: networkx>=3.0
|
|
34
|
+
Requires-Dist: seaborn>=0.12
|
|
35
|
+
Requires-Dist: matplotlib>=3.5
|
|
36
|
+
Requires-Dist: tabulate>=0.9
|
|
37
|
+
Requires-Dist: click>=8.0
|
|
38
|
+
Requires-Dist: sympy>=1.12
|
|
39
|
+
Requires-Dist: clifford>=1.5.1
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
42
|
+
Requires-Dist: black>=23.0; extra == "dev"
|
|
43
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
44
|
+
Requires-Dist: ipykernel>=6.0; extra == "dev"
|
|
45
|
+
Dynamic: license-file
|
|
46
|
+
|
|
47
|
+
# 💫 Kuramoto Benchmark Suite
|
|
48
|
+
|
|
49
|
+
A research-grade synthetic dataset generator, Clifford Geometric Algebra rotor integrator, hybrid Quantum SCF simulator, and diagnostic suite for coupled oscillator systems.
|
|
50
|
+
|
|
51
|
+
This repository provides a modular, CLI-driven framework for simulating Kuramoto dynamics and performing spectral, topological, Lie-algebraic, and quantum circuit analysis. Designed with a "What -> Who -> How -> Proof" narrative flow conforming to Scriber Core standards.
|
|
52
|
+
|
|
53
|
+
**✨ Key Features & Recent Additions (v0.4, Oct 2026)**
|
|
54
|
+
- 🌀 **Geometric Algebra Rotor Solvers:** $\operatorname{Cl}_{2,0}(\mathbb{R})$ even-subalgebra multivector representation with high-order Runge-Kutta-Munthe-Kaas (`rkmk4`), embedded adaptive Dormand-Prince (`dopri54`), geometric midpoint, predictor-corrector (`pc`), and fast vectorized Euler integrators.
|
|
55
|
+
- ⚛️ **Hybrid Quantum Rotor Solver (Quantum SCF):** Map oscillator phases to single-qubit Bloch equatorial states $|q_j(t)\rangle = R_Z(\theta_j)|+\rangle$ evolved via self-consistent field (SCF) unitary rotations $U(t) = \bigotimes_j R_Z(\phi_j^{(t)})$, supporting `statevector`, `expectation`, and tomography `shot_sampling` simulation schemes.
|
|
56
|
+
- 🔌 **OpenQASM 2.0 / 3.0 Circuit Export:** Generate and export production-ready quantum circuits directly from simulation trajectories or CLI commands.
|
|
57
|
+
- 🔗 **Lie Symmetry & Gauge Invariants:** Exact $U(1) \cong \operatorname{SO}(2)$ phase shift equivariance, rotor norm conservation ($\|R_j\|=1.0$), and Noether energy/Hamiltonian drift diagnostics.
|
|
58
|
+
- 📊 **Spectral Diagnostics & Visualization:** Synchronization transition detection ($K_c$), harmonic cascades, PSD variability, Fourier convergence, and degree-preserving color themes.
|
|
59
|
+
- 🛠️ **Unified CLI Suite:** Dedicated commands for simulation (`generate`), hybrid quantum execution (`quantum`), circuit export (`qasm`), runtime/accuracy benchmarks (`benchmark`), and diagnostic plots (`network`, `time`, `fouriervariability`, `psdvariability`, etc.).
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 🚀 Quickstart
|
|
64
|
+
|
|
65
|
+
### Installation
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/yourusername/kuramoto-benchmark-suite.git
|
|
68
|
+
cd kuramoto-benchmark-suite
|
|
69
|
+
pip install -e ".[dev]"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Or using `uv`:
|
|
73
|
+
```bash
|
|
74
|
+
uv sync --extra dev
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Core & Optional Dependencies
|
|
78
|
+
- **Core Simulation**: `numpy>=1.23`, `scipy>=1.10`, `networkx>=3.0`, `matplotlib>=3.5`, `seaborn>=0.12`, `tabulate>=0.9`, `click>=8.0`, `sympy>=1.12`
|
|
79
|
+
- **Geometric Algebra**: `clifford>=1.5.1` (required for $\operatorname{Cl}_{2,0}(\mathbb{R})$ bivector multivector rotor operations)
|
|
80
|
+
- **Quantum Integration**: Standard numerical backends built-in; OpenQASM export ready for Qiskit, Cirq, AWS Braket, and PennyLane.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 🔰 CLI Usage & Examples
|
|
85
|
+
|
|
86
|
+
The `kuramoto` command line interface provides complete access to simulation, quantum execution, benchmarking, and visualization tools.
|
|
87
|
+
|
|
88
|
+
### Diagnostic & Simulation Commands
|
|
89
|
+
|
|
90
|
+
| **Command** | **Description** |
|
|
91
|
+
|:------------|:----------------|
|
|
92
|
+
| `generate` | Generate Kuramoto datasets across ODE, GA rotor, or Quantum solvers *(JSON or CLI flags)* |
|
|
93
|
+
| `quantum` | Run hybrid Quantum Self-Consistent Field (SCF) rotor simulation |
|
|
94
|
+
| `qasm` | Export single-step or multi-step Quantum SCF circuits to OpenQASM 2.0/3.0 |
|
|
95
|
+
| `benchmark` | Run comparative runtime and order parameter performance benchmarks across solvers |
|
|
96
|
+
| `datasetforbeginners` | Copy or generate a starter demo dataset to quickly explore the suite |
|
|
97
|
+
| `network` | Visualize graph topology with degree-based palette coloring |
|
|
98
|
+
| `distributions` | Plot natural frequency and initial phase distributions |
|
|
99
|
+
| `time` | Plot phase trajectories and global order parameter $r(t)$ |
|
|
100
|
+
| `fouriervariability` | Inspect Fourier coefficients at a target frequency |
|
|
101
|
+
| `fourierconvergence` | Plot Fourier amplitude convergence over increasing window lengths |
|
|
102
|
+
| `psdvariability` | Analyze Power Spectral Density (PSD) and energy distribution |
|
|
103
|
+
| `psdconvergence` | Compare PSD estimates across multiple time segments |
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
### CLI Command Highlights
|
|
108
|
+
|
|
109
|
+
#### 1. Dataset Generation (`kuramoto generate`)
|
|
110
|
+
```bash
|
|
111
|
+
# Standard adaptive Runge-Kutta (Classical RK45)
|
|
112
|
+
kuramoto generate -n 25 -K 1.5 -t 1000 --dt 0.05 --solver rk45 -o data/rk45.npz
|
|
113
|
+
|
|
114
|
+
# 4th-Order Lie-group Geometric Algebra Rotor (RKMK4)
|
|
115
|
+
kuramoto generate -n 50 -K 2.0 -t 500 --dt 0.01 --solver rkmk4 --track-symmetries -o data/rotor_rkmk4.npz
|
|
116
|
+
|
|
117
|
+
# Embedded Adaptive Geometric Algebra Rotor (DOPRI54) with custom error tolerances
|
|
118
|
+
kuramoto generate -n 30 -K 1.8 -t 1000 --solver dopri54 --adaptive-rtol 1e-6 --adaptive-atol 1e-8 -o data/rotor_adaptive.npz
|
|
119
|
+
|
|
120
|
+
# Quantum SCF solver (Statevector scheme) with QASM export
|
|
121
|
+
kuramoto generate -n 12 -K 1.5 -t 200 --dt 0.02 --solver quantum --scheme statevector --qasm-out data/circuit.qasm -o data/quantum.npz
|
|
122
|
+
|
|
123
|
+
# Stochastic shot-sampling quantum solver (Tomography shot noise)
|
|
124
|
+
kuramoto generate -n 16 -K 1.2 -t 300 --dt 0.02 --solver shot_sampling --shots 2048 -o data/quantum_shots.npz
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### 2. Direct Quantum Simulation (`kuramoto quantum`)
|
|
128
|
+
```bash
|
|
129
|
+
# Run 10-qubit Quantum SCF simulation in expectation mode
|
|
130
|
+
kuramoto quantum -n 10 -K 1.5 -t 200 --dt 0.02 --scheme expectation
|
|
131
|
+
|
|
132
|
+
# Run shot-sampling tomography simulation on a Ring topology
|
|
133
|
+
kuramoto quantum -n 8 -K 2.0 -t 150 --topology ring --scheme shot_sampling --shots 4096 -o data/quantum_ring.npz
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### 3. OpenQASM Export (`kuramoto qasm`)
|
|
137
|
+
```bash
|
|
138
|
+
# Generate OpenQASM 2.0 circuit for 8 oscillators
|
|
139
|
+
kuramoto qasm -n 8 -K 1.5 --dt 0.05 -o circuits/scf_step.qasm
|
|
140
|
+
|
|
141
|
+
# Generate OpenQASM 3.0 circuit with explicit shot measurements
|
|
142
|
+
kuramoto qasm -n 16 -K 2.0 --dt 0.02 --version 3.0 --include-measurements -o circuits/scf_qasm3.qasm
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
#### 4. Solver Benchmarks (`kuramoto benchmark`)
|
|
146
|
+
```bash
|
|
147
|
+
# Compare runtime, steps/sec, and final synchronization strength across all solvers
|
|
148
|
+
kuramoto benchmark -n 20 -K 1.5 -t 500 --dt 0.01
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## 🐍 Python API Usage
|
|
154
|
+
|
|
155
|
+
### 1. Unified Dataset Generation (`kuramoto.api`)
|
|
156
|
+
```python
|
|
157
|
+
import numpy as np
|
|
158
|
+
from kuramoto.api import generate_kuramoto_dataset
|
|
159
|
+
|
|
160
|
+
# Simulate 20 oscillators using High-Order GA Lie-Group Rotor Integration
|
|
161
|
+
dataset = generate_kuramoto_dataset(
|
|
162
|
+
n_oscillators=20,
|
|
163
|
+
coupling=1.5,
|
|
164
|
+
timesteps=1000,
|
|
165
|
+
dt=0.01,
|
|
166
|
+
solver="rkmk4", # Options: 'rk45', 'rkmk4', 'dopri54', 'midpoint', 'euler_fast', 'quantum'
|
|
167
|
+
topology="small_world",
|
|
168
|
+
symmetry_metrics=True,
|
|
169
|
+
seed=42,
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
theta = dataset["theta"] # Shape: (1000, 20)
|
|
173
|
+
r = dataset["order_parameter"] # Global synchronization r(t)
|
|
174
|
+
print(f"Final order parameter: {r[-1]:.4f}")
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### 2. Geometric Algebra Rotor Solver (`kuramoto.solvers.RotorSolver`)
|
|
178
|
+
```python
|
|
179
|
+
from kuramoto.solvers import RotorSolver
|
|
180
|
+
import numpy as np
|
|
181
|
+
|
|
182
|
+
# Instantiate Clifford Cl(2,0) multivector solver
|
|
183
|
+
solver = RotorSolver(n_oscillators=50, dim=2, seed=42)
|
|
184
|
+
t_eval = np.linspace(0.0, 10.0, 500)
|
|
185
|
+
|
|
186
|
+
# Simulate using 4th-order Runge-Kutta-Munthe-Kaas (RKMK4) on Spin(2)
|
|
187
|
+
times, phases = solver.simulate(K=1.8, t_eval=t_eval, method="rkmk4")
|
|
188
|
+
|
|
189
|
+
# Check invariants
|
|
190
|
+
invariants = solver.compute_lie_invariants(K=1.8)
|
|
191
|
+
print(f"Phase shift invariance deviation: {invariants['global_phase_drift']:.2e}")
|
|
192
|
+
print(f"Rotor norm deviation: {invariants['max_rotor_norm_error']:.2e}")
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### 3. Hybrid Quantum SCF Solver (`kuramoto.solvers.QuantumRotorSolver`)
|
|
196
|
+
```python
|
|
197
|
+
from kuramoto.solvers import QuantumRotorSolver
|
|
198
|
+
|
|
199
|
+
# Initialize 10-qubit Quantum Self-Consistent Field solver
|
|
200
|
+
q_solver = QuantumRotorSolver(
|
|
201
|
+
n_oscillators=10,
|
|
202
|
+
coupling=1.5,
|
|
203
|
+
dt=0.02,
|
|
204
|
+
scheme="expectation", # 'statevector', 'expectation', or 'shot_sampling'
|
|
205
|
+
seed=42,
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
# Step forward in time
|
|
209
|
+
for step in range(100):
|
|
210
|
+
phases, current_r = q_solver.step()
|
|
211
|
+
|
|
212
|
+
# Export QASM circuit corresponding to current state
|
|
213
|
+
qasm_str = q_solver.to_qasm(qasm_version="2.0")
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## 🔬 Mathematical Formulations
|
|
219
|
+
|
|
220
|
+
### 1. Classical Kuramoto Model
|
|
221
|
+
$$\frac{d\theta_i}{dt} = \omega_i + \frac{K}{N} \sum_{j=1}^{N} A_{ij}\sin{(\theta_j - \theta_i)}$$
|
|
222
|
+
|
|
223
|
+
### 2. Clifford Geometric Algebra $\operatorname{Cl}_{2,0}(\mathbb{R})$ Rotor Evolution
|
|
224
|
+
Oscillators are represented as even-grade multivector rotors in the rotor group $\operatorname{Spin}(2)$:
|
|
225
|
+
$$R_i(t) = \cos\left(\frac{\theta_i(t)}{2}\right) - \mathbf{e}_{12}\sin\left(\frac{\theta_i(t)}{2}\right) = \exp\left(-\frac{\mathbf{e}_{12}\theta_i(t)}{2}\right)$$
|
|
226
|
+
where $\mathbf{e}_{12} = \mathbf{e}_1 \wedge \mathbf{e}_2$ ($\mathbf{e}_{12}^2 = -1$). Rotor dynamics follow the Lie-algebra kinematic equation:
|
|
227
|
+
$$\frac{dR_i}{dt} = -\frac{1}{2} \Omega_i(t) R_i(t) \quad \text{where} \quad \Omega_i(t) = \left(\omega_i + \frac{K}{N}\sum_j A_{ij}\sin(\theta_j - \theta_i)\right)\mathbf{e}_{12}$$
|
|
228
|
+
|
|
229
|
+
### 3. Hybrid Quantum Self-Consistent Field (SCF) Formulation
|
|
230
|
+
Each oscillator phase $\theta_j(t)$ is encoded on the equatorial plane of the Bloch sphere:
|
|
231
|
+
$$|q_j(t)\rangle = R_Z(\theta_j(t))|+\rangle = \frac{1}{\sqrt{2}}\left(|0\rangle + e^{i\theta_j(t)}|1\rangle\right)$$
|
|
232
|
+
Expectation values yield phase coordinates:
|
|
233
|
+
$$\langle X_j \rangle = \cos\theta_j, \quad \langle Y_j \rangle = \sin\theta_j \implies \theta_j = \operatorname{atan2}(\langle Y_j \rangle, \langle X_j \rangle)$$
|
|
234
|
+
Time evolution applies parallel single-qubit self-consistent field rotations $R_Z(\phi_j^{(t)})$:
|
|
235
|
+
$$\phi_j^{(t)} = \left(\omega_j + K \operatorname{Im}\left[e^{-i\theta_j} Z_{\text{local}, j}\right]\right)\Delta t$$
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## 🎓 Research & Educational Resources
|
|
240
|
+
|
|
241
|
+
Detailed theoretical derivations, benchmark reports, and interactive Jupyter notebooks are provided in `research/` and `examples/notebooks/`:
|
|
242
|
+
|
|
243
|
+
- [research/RESEARCH_PREPRINT.md](research/RESEARCH_PREPRINT.md): Formal derivation of GA rotor dynamics and Lie symmetry conservation.
|
|
244
|
+
- [research/BENCHMARK_RUNDOWN.md](research/BENCHMARK_RUNDOWN.md): Rigorous numerical comparisons across Classical RK45, GA Rotors (RKMK4, DOPRI54), and Quantum SCF.
|
|
245
|
+
- [research/LEARNING_GUIDE.md](research/LEARNING_GUIDE.md): Intuitive guide covering Bivector Torque, Hydrodynamic analogies, and the Quantum Rotor Bridge.
|
|
246
|
+
- [research/PRACTICE_PROBLEMS.md](research/PRACTICE_PROBLEMS.md): 10 analytical and computational exercises for geometric synchronization.
|
|
247
|
+
- [research/MANUAL_ANALYSIS.md](research/MANUAL_ANALYSIS.md): Code architecture walkthrough and invariant verification notes.
|
|
248
|
+
- [examples/notebooks/quantum_sanity_checks.ipynb](examples/notebooks/quantum_sanity_checks.ipynb): Numerical verification of global truncation error, unitary time-reversibility, Bloch equatorial purity, and Central Limit Theorem shot-noise scaling.
|
|
249
|
+
- [examples/notebooks/qiskit_hybrid_kuramoto_pipeline.ipynb](examples/notebooks/qiskit_hybrid_kuramoto_pipeline.ipynb): End-to-end Qiskit backend simulation pipeline with OpenQASM export.
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## 🎨 Visual Identity & Style
|
|
254
|
+
|
|
255
|
+
The benchmark suite implements the Scriber Core visual identity:
|
|
256
|
+
- **Palette Tokens:** High-contrast 4-layer semantic palettes (`SCRIBER_PALETTE`, `PROJECT_COLORS`, `SOLVER_COLORS`).
|
|
257
|
+
- **Degree-Preserving Coloring:** Oscillator color identities assigned by graph centrality/degree are strictly preserved across time-series, Fourier, and PSD spectral plots.
|
|
258
|
+
- **Publication Ready:** Automatic styling via `kuramoto.analysis.viz.set_style()` with dark-mode card themes and consistent grid lines.
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## 📄 License
|
|
263
|
+
MIT License. See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# 💫 Kuramoto Benchmark Suite
|
|
2
|
+
|
|
3
|
+
A research-grade synthetic dataset generator, Clifford Geometric Algebra rotor integrator, hybrid Quantum SCF simulator, and diagnostic suite for coupled oscillator systems.
|
|
4
|
+
|
|
5
|
+
This repository provides a modular, CLI-driven framework for simulating Kuramoto dynamics and performing spectral, topological, Lie-algebraic, and quantum circuit analysis. Designed with a "What -> Who -> How -> Proof" narrative flow conforming to Scriber Core standards.
|
|
6
|
+
|
|
7
|
+
**✨ Key Features & Recent Additions (v0.4, Oct 2026)**
|
|
8
|
+
- 🌀 **Geometric Algebra Rotor Solvers:** $\operatorname{Cl}_{2,0}(\mathbb{R})$ even-subalgebra multivector representation with high-order Runge-Kutta-Munthe-Kaas (`rkmk4`), embedded adaptive Dormand-Prince (`dopri54`), geometric midpoint, predictor-corrector (`pc`), and fast vectorized Euler integrators.
|
|
9
|
+
- ⚛️ **Hybrid Quantum Rotor Solver (Quantum SCF):** Map oscillator phases to single-qubit Bloch equatorial states $|q_j(t)\rangle = R_Z(\theta_j)|+\rangle$ evolved via self-consistent field (SCF) unitary rotations $U(t) = \bigotimes_j R_Z(\phi_j^{(t)})$, supporting `statevector`, `expectation`, and tomography `shot_sampling` simulation schemes.
|
|
10
|
+
- 🔌 **OpenQASM 2.0 / 3.0 Circuit Export:** Generate and export production-ready quantum circuits directly from simulation trajectories or CLI commands.
|
|
11
|
+
- 🔗 **Lie Symmetry & Gauge Invariants:** Exact $U(1) \cong \operatorname{SO}(2)$ phase shift equivariance, rotor norm conservation ($\|R_j\|=1.0$), and Noether energy/Hamiltonian drift diagnostics.
|
|
12
|
+
- 📊 **Spectral Diagnostics & Visualization:** Synchronization transition detection ($K_c$), harmonic cascades, PSD variability, Fourier convergence, and degree-preserving color themes.
|
|
13
|
+
- 🛠️ **Unified CLI Suite:** Dedicated commands for simulation (`generate`), hybrid quantum execution (`quantum`), circuit export (`qasm`), runtime/accuracy benchmarks (`benchmark`), and diagnostic plots (`network`, `time`, `fouriervariability`, `psdvariability`, etc.).
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 🚀 Quickstart
|
|
18
|
+
|
|
19
|
+
### Installation
|
|
20
|
+
```bash
|
|
21
|
+
git clone https://github.com/yourusername/kuramoto-benchmark-suite.git
|
|
22
|
+
cd kuramoto-benchmark-suite
|
|
23
|
+
pip install -e ".[dev]"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or using `uv`:
|
|
27
|
+
```bash
|
|
28
|
+
uv sync --extra dev
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Core & Optional Dependencies
|
|
32
|
+
- **Core Simulation**: `numpy>=1.23`, `scipy>=1.10`, `networkx>=3.0`, `matplotlib>=3.5`, `seaborn>=0.12`, `tabulate>=0.9`, `click>=8.0`, `sympy>=1.12`
|
|
33
|
+
- **Geometric Algebra**: `clifford>=1.5.1` (required for $\operatorname{Cl}_{2,0}(\mathbb{R})$ bivector multivector rotor operations)
|
|
34
|
+
- **Quantum Integration**: Standard numerical backends built-in; OpenQASM export ready for Qiskit, Cirq, AWS Braket, and PennyLane.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 🔰 CLI Usage & Examples
|
|
39
|
+
|
|
40
|
+
The `kuramoto` command line interface provides complete access to simulation, quantum execution, benchmarking, and visualization tools.
|
|
41
|
+
|
|
42
|
+
### Diagnostic & Simulation Commands
|
|
43
|
+
|
|
44
|
+
| **Command** | **Description** |
|
|
45
|
+
|:------------|:----------------|
|
|
46
|
+
| `generate` | Generate Kuramoto datasets across ODE, GA rotor, or Quantum solvers *(JSON or CLI flags)* |
|
|
47
|
+
| `quantum` | Run hybrid Quantum Self-Consistent Field (SCF) rotor simulation |
|
|
48
|
+
| `qasm` | Export single-step or multi-step Quantum SCF circuits to OpenQASM 2.0/3.0 |
|
|
49
|
+
| `benchmark` | Run comparative runtime and order parameter performance benchmarks across solvers |
|
|
50
|
+
| `datasetforbeginners` | Copy or generate a starter demo dataset to quickly explore the suite |
|
|
51
|
+
| `network` | Visualize graph topology with degree-based palette coloring |
|
|
52
|
+
| `distributions` | Plot natural frequency and initial phase distributions |
|
|
53
|
+
| `time` | Plot phase trajectories and global order parameter $r(t)$ |
|
|
54
|
+
| `fouriervariability` | Inspect Fourier coefficients at a target frequency |
|
|
55
|
+
| `fourierconvergence` | Plot Fourier amplitude convergence over increasing window lengths |
|
|
56
|
+
| `psdvariability` | Analyze Power Spectral Density (PSD) and energy distribution |
|
|
57
|
+
| `psdconvergence` | Compare PSD estimates across multiple time segments |
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### CLI Command Highlights
|
|
62
|
+
|
|
63
|
+
#### 1. Dataset Generation (`kuramoto generate`)
|
|
64
|
+
```bash
|
|
65
|
+
# Standard adaptive Runge-Kutta (Classical RK45)
|
|
66
|
+
kuramoto generate -n 25 -K 1.5 -t 1000 --dt 0.05 --solver rk45 -o data/rk45.npz
|
|
67
|
+
|
|
68
|
+
# 4th-Order Lie-group Geometric Algebra Rotor (RKMK4)
|
|
69
|
+
kuramoto generate -n 50 -K 2.0 -t 500 --dt 0.01 --solver rkmk4 --track-symmetries -o data/rotor_rkmk4.npz
|
|
70
|
+
|
|
71
|
+
# Embedded Adaptive Geometric Algebra Rotor (DOPRI54) with custom error tolerances
|
|
72
|
+
kuramoto generate -n 30 -K 1.8 -t 1000 --solver dopri54 --adaptive-rtol 1e-6 --adaptive-atol 1e-8 -o data/rotor_adaptive.npz
|
|
73
|
+
|
|
74
|
+
# Quantum SCF solver (Statevector scheme) with QASM export
|
|
75
|
+
kuramoto generate -n 12 -K 1.5 -t 200 --dt 0.02 --solver quantum --scheme statevector --qasm-out data/circuit.qasm -o data/quantum.npz
|
|
76
|
+
|
|
77
|
+
# Stochastic shot-sampling quantum solver (Tomography shot noise)
|
|
78
|
+
kuramoto generate -n 16 -K 1.2 -t 300 --dt 0.02 --solver shot_sampling --shots 2048 -o data/quantum_shots.npz
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
#### 2. Direct Quantum Simulation (`kuramoto quantum`)
|
|
82
|
+
```bash
|
|
83
|
+
# Run 10-qubit Quantum SCF simulation in expectation mode
|
|
84
|
+
kuramoto quantum -n 10 -K 1.5 -t 200 --dt 0.02 --scheme expectation
|
|
85
|
+
|
|
86
|
+
# Run shot-sampling tomography simulation on a Ring topology
|
|
87
|
+
kuramoto quantum -n 8 -K 2.0 -t 150 --topology ring --scheme shot_sampling --shots 4096 -o data/quantum_ring.npz
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### 3. OpenQASM Export (`kuramoto qasm`)
|
|
91
|
+
```bash
|
|
92
|
+
# Generate OpenQASM 2.0 circuit for 8 oscillators
|
|
93
|
+
kuramoto qasm -n 8 -K 1.5 --dt 0.05 -o circuits/scf_step.qasm
|
|
94
|
+
|
|
95
|
+
# Generate OpenQASM 3.0 circuit with explicit shot measurements
|
|
96
|
+
kuramoto qasm -n 16 -K 2.0 --dt 0.02 --version 3.0 --include-measurements -o circuits/scf_qasm3.qasm
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
#### 4. Solver Benchmarks (`kuramoto benchmark`)
|
|
100
|
+
```bash
|
|
101
|
+
# Compare runtime, steps/sec, and final synchronization strength across all solvers
|
|
102
|
+
kuramoto benchmark -n 20 -K 1.5 -t 500 --dt 0.01
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 🐍 Python API Usage
|
|
108
|
+
|
|
109
|
+
### 1. Unified Dataset Generation (`kuramoto.api`)
|
|
110
|
+
```python
|
|
111
|
+
import numpy as np
|
|
112
|
+
from kuramoto.api import generate_kuramoto_dataset
|
|
113
|
+
|
|
114
|
+
# Simulate 20 oscillators using High-Order GA Lie-Group Rotor Integration
|
|
115
|
+
dataset = generate_kuramoto_dataset(
|
|
116
|
+
n_oscillators=20,
|
|
117
|
+
coupling=1.5,
|
|
118
|
+
timesteps=1000,
|
|
119
|
+
dt=0.01,
|
|
120
|
+
solver="rkmk4", # Options: 'rk45', 'rkmk4', 'dopri54', 'midpoint', 'euler_fast', 'quantum'
|
|
121
|
+
topology="small_world",
|
|
122
|
+
symmetry_metrics=True,
|
|
123
|
+
seed=42,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
theta = dataset["theta"] # Shape: (1000, 20)
|
|
127
|
+
r = dataset["order_parameter"] # Global synchronization r(t)
|
|
128
|
+
print(f"Final order parameter: {r[-1]:.4f}")
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 2. Geometric Algebra Rotor Solver (`kuramoto.solvers.RotorSolver`)
|
|
132
|
+
```python
|
|
133
|
+
from kuramoto.solvers import RotorSolver
|
|
134
|
+
import numpy as np
|
|
135
|
+
|
|
136
|
+
# Instantiate Clifford Cl(2,0) multivector solver
|
|
137
|
+
solver = RotorSolver(n_oscillators=50, dim=2, seed=42)
|
|
138
|
+
t_eval = np.linspace(0.0, 10.0, 500)
|
|
139
|
+
|
|
140
|
+
# Simulate using 4th-order Runge-Kutta-Munthe-Kaas (RKMK4) on Spin(2)
|
|
141
|
+
times, phases = solver.simulate(K=1.8, t_eval=t_eval, method="rkmk4")
|
|
142
|
+
|
|
143
|
+
# Check invariants
|
|
144
|
+
invariants = solver.compute_lie_invariants(K=1.8)
|
|
145
|
+
print(f"Phase shift invariance deviation: {invariants['global_phase_drift']:.2e}")
|
|
146
|
+
print(f"Rotor norm deviation: {invariants['max_rotor_norm_error']:.2e}")
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### 3. Hybrid Quantum SCF Solver (`kuramoto.solvers.QuantumRotorSolver`)
|
|
150
|
+
```python
|
|
151
|
+
from kuramoto.solvers import QuantumRotorSolver
|
|
152
|
+
|
|
153
|
+
# Initialize 10-qubit Quantum Self-Consistent Field solver
|
|
154
|
+
q_solver = QuantumRotorSolver(
|
|
155
|
+
n_oscillators=10,
|
|
156
|
+
coupling=1.5,
|
|
157
|
+
dt=0.02,
|
|
158
|
+
scheme="expectation", # 'statevector', 'expectation', or 'shot_sampling'
|
|
159
|
+
seed=42,
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
# Step forward in time
|
|
163
|
+
for step in range(100):
|
|
164
|
+
phases, current_r = q_solver.step()
|
|
165
|
+
|
|
166
|
+
# Export QASM circuit corresponding to current state
|
|
167
|
+
qasm_str = q_solver.to_qasm(qasm_version="2.0")
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## 🔬 Mathematical Formulations
|
|
173
|
+
|
|
174
|
+
### 1. Classical Kuramoto Model
|
|
175
|
+
$$\frac{d\theta_i}{dt} = \omega_i + \frac{K}{N} \sum_{j=1}^{N} A_{ij}\sin{(\theta_j - \theta_i)}$$
|
|
176
|
+
|
|
177
|
+
### 2. Clifford Geometric Algebra $\operatorname{Cl}_{2,0}(\mathbb{R})$ Rotor Evolution
|
|
178
|
+
Oscillators are represented as even-grade multivector rotors in the rotor group $\operatorname{Spin}(2)$:
|
|
179
|
+
$$R_i(t) = \cos\left(\frac{\theta_i(t)}{2}\right) - \mathbf{e}_{12}\sin\left(\frac{\theta_i(t)}{2}\right) = \exp\left(-\frac{\mathbf{e}_{12}\theta_i(t)}{2}\right)$$
|
|
180
|
+
where $\mathbf{e}_{12} = \mathbf{e}_1 \wedge \mathbf{e}_2$ ($\mathbf{e}_{12}^2 = -1$). Rotor dynamics follow the Lie-algebra kinematic equation:
|
|
181
|
+
$$\frac{dR_i}{dt} = -\frac{1}{2} \Omega_i(t) R_i(t) \quad \text{where} \quad \Omega_i(t) = \left(\omega_i + \frac{K}{N}\sum_j A_{ij}\sin(\theta_j - \theta_i)\right)\mathbf{e}_{12}$$
|
|
182
|
+
|
|
183
|
+
### 3. Hybrid Quantum Self-Consistent Field (SCF) Formulation
|
|
184
|
+
Each oscillator phase $\theta_j(t)$ is encoded on the equatorial plane of the Bloch sphere:
|
|
185
|
+
$$|q_j(t)\rangle = R_Z(\theta_j(t))|+\rangle = \frac{1}{\sqrt{2}}\left(|0\rangle + e^{i\theta_j(t)}|1\rangle\right)$$
|
|
186
|
+
Expectation values yield phase coordinates:
|
|
187
|
+
$$\langle X_j \rangle = \cos\theta_j, \quad \langle Y_j \rangle = \sin\theta_j \implies \theta_j = \operatorname{atan2}(\langle Y_j \rangle, \langle X_j \rangle)$$
|
|
188
|
+
Time evolution applies parallel single-qubit self-consistent field rotations $R_Z(\phi_j^{(t)})$:
|
|
189
|
+
$$\phi_j^{(t)} = \left(\omega_j + K \operatorname{Im}\left[e^{-i\theta_j} Z_{\text{local}, j}\right]\right)\Delta t$$
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## 🎓 Research & Educational Resources
|
|
194
|
+
|
|
195
|
+
Detailed theoretical derivations, benchmark reports, and interactive Jupyter notebooks are provided in `research/` and `examples/notebooks/`:
|
|
196
|
+
|
|
197
|
+
- [research/RESEARCH_PREPRINT.md](research/RESEARCH_PREPRINT.md): Formal derivation of GA rotor dynamics and Lie symmetry conservation.
|
|
198
|
+
- [research/BENCHMARK_RUNDOWN.md](research/BENCHMARK_RUNDOWN.md): Rigorous numerical comparisons across Classical RK45, GA Rotors (RKMK4, DOPRI54), and Quantum SCF.
|
|
199
|
+
- [research/LEARNING_GUIDE.md](research/LEARNING_GUIDE.md): Intuitive guide covering Bivector Torque, Hydrodynamic analogies, and the Quantum Rotor Bridge.
|
|
200
|
+
- [research/PRACTICE_PROBLEMS.md](research/PRACTICE_PROBLEMS.md): 10 analytical and computational exercises for geometric synchronization.
|
|
201
|
+
- [research/MANUAL_ANALYSIS.md](research/MANUAL_ANALYSIS.md): Code architecture walkthrough and invariant verification notes.
|
|
202
|
+
- [examples/notebooks/quantum_sanity_checks.ipynb](examples/notebooks/quantum_sanity_checks.ipynb): Numerical verification of global truncation error, unitary time-reversibility, Bloch equatorial purity, and Central Limit Theorem shot-noise scaling.
|
|
203
|
+
- [examples/notebooks/qiskit_hybrid_kuramoto_pipeline.ipynb](examples/notebooks/qiskit_hybrid_kuramoto_pipeline.ipynb): End-to-end Qiskit backend simulation pipeline with OpenQASM export.
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## 🎨 Visual Identity & Style
|
|
208
|
+
|
|
209
|
+
The benchmark suite implements the Scriber Core visual identity:
|
|
210
|
+
- **Palette Tokens:** High-contrast 4-layer semantic palettes (`SCRIBER_PALETTE`, `PROJECT_COLORS`, `SOLVER_COLORS`).
|
|
211
|
+
- **Degree-Preserving Coloring:** Oscillator color identities assigned by graph centrality/degree are strictly preserved across time-series, Fourier, and PSD spectral plots.
|
|
212
|
+
- **Publication Ready:** Automatic styling via `kuramoto.analysis.viz.set_style()` with dark-mode card themes and consistent grid lines.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## 📄 License
|
|
217
|
+
MIT License. See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "kuramoto-benchmark-suite"
|
|
7
|
+
version = "2.0.0"
|
|
8
|
+
description = "Benchmark-grade synthetic dataset generator for Kuramoto oscillator systems"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "eigenscribe" }
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"numpy>=1.23",
|
|
17
|
+
"scipy>=1.10",
|
|
18
|
+
"networkx>=3.0",
|
|
19
|
+
"seaborn>=0.12",
|
|
20
|
+
"matplotlib>=3.5",
|
|
21
|
+
"tabulate>=0.9",
|
|
22
|
+
"click>=8.0",
|
|
23
|
+
"sympy>=1.12",
|
|
24
|
+
"clifford>=1.5.1",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.scripts]
|
|
28
|
+
kuramoto = "kuramoto.cli.main:main"
|
|
29
|
+
|
|
30
|
+
# ----------------------------------------------------------------------
|
|
31
|
+
# Explicitly define the package structure (src layout)
|
|
32
|
+
# ----------------------------------------------------------------------
|
|
33
|
+
[tool.setuptools.packages.find]
|
|
34
|
+
where = ["src"]
|
|
35
|
+
include = ["kuramoto*"] # Only match kuramoto packages
|
|
36
|
+
exclude = [
|
|
37
|
+
"tests*",
|
|
38
|
+
"docs*",
|
|
39
|
+
"*.pyc",
|
|
40
|
+
"__pycache__",
|
|
41
|
+
"*.egg-info",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
# ----------------------------------------------------------------------
|
|
45
|
+
# Development extras (testing, linting, notebooks)
|
|
46
|
+
# ----------------------------------------------------------------------
|
|
47
|
+
[project.optional-dependencies]
|
|
48
|
+
dev = [
|
|
49
|
+
"pytest>=7.0",
|
|
50
|
+
"black>=23.0",
|
|
51
|
+
"ruff>=0.1.0",
|
|
52
|
+
"ipykernel>=6.0", # for Jupyter notebooks
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
# ----------------------------------------------------------------------
|
|
56
|
+
# Make `src/` the default import location for notebooks
|
|
57
|
+
# ----------------------------------------------------------------------
|
|
58
|
+
[tool.ipython]
|
|
59
|
+
# When you start a notebook from the repository root, IPython will add the
|
|
60
|
+
# project's root to sys.path automatically. If you use VS Code's Jupyter
|
|
61
|
+
# extension, the same behavior applies.
|
|
62
|
+
|
|
63
|
+
# ----------------------------------------------------------------------
|
|
64
|
+
# Testing configuration
|
|
65
|
+
# ----------------------------------------------------------------------
|
|
66
|
+
[tool.pytest.ini_options]
|
|
67
|
+
testpaths = ["tests"]
|
|
68
|
+
addopts = "-q"
|
|
69
|
+
pythonpath = ["src"] # Ensure tests import from src/
|
|
70
|
+
|
|
71
|
+
# ----------------------------------------------------------------------
|
|
72
|
+
# Code formatting (Black)
|
|
73
|
+
# ----------------------------------------------------------------------
|
|
74
|
+
[tool.black]
|
|
75
|
+
line-length = 88
|
|
76
|
+
target-version = ['py310']
|
|
77
|
+
include = '\.pyi?$'
|
|
78
|
+
extend-exclude = '''
|
|
79
|
+
/(
|
|
80
|
+
\.git
|
|
81
|
+
| \.venv
|
|
82
|
+
| build
|
|
83
|
+
| dist
|
|
84
|
+
)/
|
|
85
|
+
'''
|
|
86
|
+
|
|
87
|
+
# ----------------------------------------------------------------------
|
|
88
|
+
# Linting (Ruff)
|
|
89
|
+
# ----------------------------------------------------------------------
|
|
90
|
+
[tool.ruff]
|
|
91
|
+
line-length = 88
|
|
92
|
+
target-version = "py310"
|
|
93
|
+
select = [
|
|
94
|
+
"E", # pycodestyle errors
|
|
95
|
+
"W", # pycodestyle warnings
|
|
96
|
+
"F", # pyflakes
|
|
97
|
+
"I", # isort
|
|
98
|
+
"B", # flake8-bugbear
|
|
99
|
+
"C4", # flake8-comprehensions
|
|
100
|
+
]
|
|
101
|
+
ignore = [
|
|
102
|
+
"E501", # line too long (handled by black)
|
|
103
|
+
"B008", # do not perform function calls in argument defaults
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
[tool.ruff.per-file-ignores]
|
|
107
|
+
"__init__.py" = ["F401"] # Allow unused imports in init files
|
|
108
|
+
|
|
109
|
+
# ----------------------------------------------------------------------
|
|
110
|
+
# Package data (if you have non-Python files in packages)
|
|
111
|
+
# ----------------------------------------------------------------------
|
|
112
|
+
[tool.setuptools.package-data]
|
|
113
|
+
kuramoto = ["*.py", "*.txt", "*.md"]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from .model import KuramotoModel
|
|
2
|
+
from .api import generate_kuramoto_dataset
|
|
3
|
+
from .dataset import KuramotoDataset
|
|
4
|
+
from .utils import set_global_seed
|
|
5
|
+
|
|
6
|
+
__version__ = "2.0.0"
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"__version__",
|
|
10
|
+
"KuramotoModel",
|
|
11
|
+
"generate_kuramoto_dataset",
|
|
12
|
+
"KuramotoDataset",
|
|
13
|
+
"set_global_seed",
|
|
14
|
+
]
|
|
File without changes
|