gph-qgp 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
gph_qgp/__init__.py ADDED
@@ -0,0 +1,42 @@
1
+ """gph_qgp — the GPH Quantum Gravity Phenomenology lab (v0.3.0).
2
+
3
+ Toy phenomenological models for teaching and exploration, built around
4
+ the Graduation Protocol Hypothesis (GPH) paper, v3.2
5
+ (Zenodo DOI 10.5281/zenodo.24237333).
6
+
7
+ Modules
8
+ -------
9
+ dispersion : modified dispersion relations (n=1 and n=2) and GRB photon
10
+ time-of-flight
11
+ foam : spacetime-foam distance fluctuations and interferometer phase noise
12
+ collapse : GRW / Diosi-Penrose collapse toy models, CSL phenomenology,
13
+ with an explicit non-computable oracle boundary (collapse
14
+ itself is NOT simulated)
15
+ superluminal : superluminal LIV branch — photon decay, photon splitting,
16
+ vacuum Cherenkov
17
+ birefringence : helicity-dependent photon speed, GRB polarisation rotation
18
+ gup : generalised uncertainty principle — minimal length, oscillator
19
+ levels, black-hole temperature
20
+ neutrinos : energy-dependent neutrino speed, SN1987A / TXS 0506+056 /
21
+ IceCube time-of-flight
22
+ constraints: real published observational limits and checks of the toy
23
+ models against them
24
+ pilot : the GPH sober blinded-pilot analysis pipeline (speckle synthesis,
25
+ rater agreement, invariance checks)
26
+ cli : command-line runner (``python -m gph_qgp run --experiment ...``,
27
+ ``python -m gph_qgp compare --out ...``)
28
+
29
+ Honesty note (read this first): everything here is a toy model running on
30
+ simulated data. Nothing in this package is a real experiment, and nothing it
31
+ produces is evidence for or against GPH, simulation, or a curriculum.
32
+ A "positive" result inside these simulations only demonstrates that the
33
+ analysis pipeline works as designed.
34
+ """
35
+
36
+ from . import (birefringence, collapse, constraints, dispersion, foam,
37
+ gup, neutrinos, pilot, superluminal)
38
+
39
+ __version__ = "0.3.0"
40
+ __all__ = ["birefringence", "collapse", "constraints", "dispersion",
41
+ "foam", "gup", "neutrinos", "pilot", "superluminal",
42
+ "__version__"]
gph_qgp/__main__.py ADDED
@@ -0,0 +1,6 @@
1
+ """Allow ``python -m gph_qgp`` to run the CLI."""
2
+
3
+ from .cli import main
4
+
5
+ if __name__ == "__main__":
6
+ main()
@@ -0,0 +1,122 @@
1
+ """Vacuum birefringence: helicity-dependent photon speed (v0.3).
2
+
3
+ If Lorentz violation is helicity-dependent, left- and right-circularly
4
+ polarised photons travel at different speeds, and the plane of linear
5
+ polarisation rotates as the photon propagates. The rotation grows with
6
+ the square of the energy and with the distance, so a distant gamma-ray
7
+ burst (GRB) observed in polarised light is a sensitive probe: if the
8
+ rotation varied strongly across the observed energy band, the net
9
+ polarisation would wash out — and it does not.
10
+
11
+ Model (Toma et al. 2012; Wei et al. 2025 convention)
12
+ -----------------------------------------------------
13
+ Delta_phi(E) = eta * E^2 * D / (hbar * E_Pl * c)
14
+
15
+ where eta is the dimensionless birefringence parameter, E the photon
16
+ energy, D the source distance, and E_Pl the Planck energy. The two
17
+ helicities travel at v/c = 1 +/- eta * E / E_Pl, so the phase difference
18
+ between them accumulates as the square of the energy. (O(1) convention
19
+ factors differ between authors — some write xi instead of eta, or
20
+ absorb a factor of 2 — so the parameter below is the Wei et al. 2025
21
+ definition, and the bound quoted is in that definition.)
22
+
23
+ Verified limit (see constraints.py for the full citation)
24
+ --------------------------------------------------------
25
+ * |eta| < O(1e-15 - 1e-16), 95% CL, from energy-resolved polarimetry
26
+ of five GRBs (Wei et al., Astrophys. J. 983, 164 (2025),
27
+ arXiv:2503.18277). The module uses the conservative end,
28
+ |eta| < 1e-15, as the bound value.
29
+
30
+ Honesty note: the GRBs in the simulator are synthetic. The check
31
+ against the real bound is constraints.check_birefringence; a simulated
32
+ polarisation measurement that survives is a pipeline demonstration,
33
+ not a measurement of eta.
34
+ """
35
+
36
+ from __future__ import annotations
37
+
38
+ import numpy as np
39
+
40
+ # ---------------------------------------------------------------- constants
41
+ E_PLANCK_GEV = 1.22e19 # Planck energy, GeV
42
+ HBAR_GEV_S = 6.582119569e-25 # reduced Planck constant, GeV s
43
+ C_M_PER_S = 299_792_458.0 # speed of light, m/s
44
+ MPC_IN_M = 3.085677581491367e22 # one megaparsec, m
45
+
46
+ # Conservative end of the Wei et al. (2025) bound, |eta| < O(1e-15-1e-16).
47
+ ETA_LIMIT = 1.0e-15 # dimensionless, 95% CL
48
+
49
+
50
+ def rotation_angle(energy_gev, distance_mpc, eta):
51
+ """Polarisation rotation angle (radians) for a photon.
52
+
53
+ Delta_phi = eta * E^2 * D / (hbar * E_Pl * c). Sign follows eta;
54
+ the magnitude is what observations constrain. Works on scalars
55
+ and arrays.
56
+ """
57
+ energy_gev = np.asarray(energy_gev, dtype=float)
58
+ distance_m = float(distance_mpc) * MPC_IN_M
59
+ return float(eta) * energy_gev**2 * distance_m / (
60
+ HBAR_GEV_S * E_PLANCK_GEV * C_M_PER_S)
61
+
62
+
63
+ def rotation_difference(energy_low_gev, energy_high_gev, distance_mpc,
64
+ eta):
65
+ """Rotation difference (radians) across an energy band.
66
+
67
+ Delta_phi(E_high) - Delta_phi(E_low). A difference of order pi/2
68
+ or more across the band washes out the net polarisation; that is
69
+ what the GRB polarimetry limits are really measuring.
70
+ """
71
+ return float(rotation_angle(energy_high_gev, distance_mpc, eta)
72
+ - rotation_angle(energy_low_gev, distance_mpc, eta))
73
+
74
+
75
+ def band_polarization(energies_gev, distance_mpc, eta, p0=1.0):
76
+ """Observed polarisation fraction after rotation across a band.
77
+
78
+ Each energy in the band rotates by a different angle, so the
79
+ polarisation vectors partially cancel. The surviving fraction is
80
+ p0 * |mean(exp(2i * Delta_phi))| over the band — 1 if nothing
81
+ rotates, ~0 if the band is fully scrambled. p0 is the intrinsic
82
+ (source) polarisation fraction.
83
+ """
84
+ energies_gev = np.asarray(energies_gev, dtype=float)
85
+ angles = rotation_angle(energies_gev, distance_mpc, eta)
86
+ phasors = np.exp(2j * angles)
87
+ return float(p0 * abs(np.mean(phasors)))
88
+
89
+
90
+ def eta_limit(rotation_max_rad, energy_gev, distance_mpc):
91
+ """Invert the rotation formula: the eta that would produce a given
92
+ rotation at a given energy and distance. Used to translate an
93
+ observed "no rotation larger than X" into a bound on eta."""
94
+ energy_gev = float(energy_gev)
95
+ distance_m = float(distance_mpc) * MPC_IN_M
96
+ if energy_gev <= 0 or distance_m <= 0:
97
+ raise ValueError("energy and distance must be > 0")
98
+ return float(rotation_max_rad) * HBAR_GEV_S * E_PLANCK_GEV * C_M_PER_S \
99
+ / (energy_gev**2 * distance_m)
100
+
101
+
102
+ def simulate_grb_polarimetry(energies_gev, distance_mpc, eta, p0=1.0):
103
+ """Simulate a GRB polarisation measurement under birefringence.
104
+
105
+ ``energies_gev``: the observed energy band. Returns the rotation
106
+ per energy, the rotation spread across the band, and the surviving
107
+ polarisation fraction. A real GRB that is observed polarised with
108
+ p ~ 0.3-0.8 in a band like this rules out any eta that would
109
+ scramble it.
110
+ """
111
+ energies_gev = np.asarray(energies_gev, dtype=float)
112
+ rotations = rotation_angle(energies_gev, distance_mpc, eta)
113
+ return {
114
+ "energies_gev": energies_gev,
115
+ "distance_mpc": float(distance_mpc),
116
+ "eta": float(eta),
117
+ "rotation_rad": rotations,
118
+ "rotation_spread_rad": float(rotations.max() - rotations.min()),
119
+ "polarization_fraction": band_polarization(
120
+ energies_gev, distance_mpc, eta, p0=p0),
121
+ "intrinsic_polarization": float(p0),
122
+ }