Does light charge the quons? › Files cited on the page › the trials

slow_light_posthoc.py

In the investigation at sim/matter_light/slow_light_posthoc.py · last changed in commit 090c2be, 23 November 2026 · 4,456 bytes · runnable copies in the scripts zip


#!/usr/bin/env python3
"""Trial 24, POST HOC checks by the author seat, outside the trial. Nothing here changes a lock verdict."""
import importlib.util
import math
import os
import subprocess
import sys

import numpy as np
from scipy.stats import chi2, t as tdist

sys.dont_write_bytecode = True
HERE = os.path.dirname(os.path.abspath(__file__))
spec = importlib.util.spec_from_file_location("m", os.path.join(HERE, "slow_light_zero_pressure.py"))
m = importlib.util.module_from_spec(spec)
spec.loader.exec_module(m)
print("git HEAD:", subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True, cwd=HERE).stdout.strip())

K = np.array([e[4] for e in m.XM]); Y = np.array([e[3] for e in m.XM]); mk = np.array([e[5] for e in m.XM]) == 1
names = [e[0] for e in m.XM]
print("\nP1. Are the paper's errors 95% intervals? t-factor times the standard error")
for lab, sel, quoted in (("all 13", np.ones(13, bool), 1.4), ("their 8", mk, 0.20), ("long bursts (11)", np.array([n not in ("090510", "140619B") for n in names]), 1.5)):
    a, sa, b, sb, r = m.ols(K[sel], Y[sel])
    n = sel.sum(); f = tdist.ppf(0.975, n - 2)
    print(f"   {lab}: slope {a:.2f} +- {sa:.2f} (one sigma), x {f:.2f} = {f*sa:.2f}; the paper prints {quoted}; two-sided p = {2*tdist.sf(abs(a/sa), n-2):.4f}")

print("\nP2. Do the 8 lie closer to their line than the paper's own 10% errors on K allow?")
a8, sa8, b8, _, r8 = m.ols(K[mk], Y[mk])
sK = 0.1 * K[mk] * a8
x2 = float(((r8 / sK) ** 2).sum())
print(f"   residuals (s): {np.round(r8, 2)}; errors expected from K (s): {np.round(sK, 2)}")
print(f"   chi2 = {x2:.2f} for 6 degrees of freedom; chance of one this small: {chi2.cdf(x2, 6):.4f}")
rng = np.random.default_rng(24)
N = 4000
tol = float(np.max(np.abs(r8)))
got = []
for _ in range(N):
    Kt = K[mk]                                   # suppose the law is exactly true for these 8; the measured K has 10% error
    y = a8 * Kt + b8
    Km = Kt * (1 + 0.1 * rng.standard_normal(8))
    a_, _, b_, _, r_ = m.ols(Km, y)
    got.append(np.max(np.abs(r_)) <= tol)
print(f"   if the law were exactly true and K had its 10% errors, all 8 would lie within {tol:.2f} s in {np.mean(got):.4f} of {N} tries")

print("\nP3. One photon per burst (the highest K of each), so that one burst cannot make the trend")
best = {}
for n, k, y in zip(names, K, Y):
    g = n.split("(")[0].split("s ")[0].rstrip()
    g = "090902B" if g.startswith("090902B") else g
    if g not in best or k > best[g][0]:
        best[g] = (k, y)
kk = np.array([v[0] for v in best.values()]); yy = np.array([v[1] for v in best.values()])
a, sa, b, sb, r = m.ols(kk, yy)
print(f"   {len(kk)} bursts: slope {a:.2f} +- {sa:.2f}, {a/sa:.1f} sigma, p = {2*tdist.sf(abs(a/sa), len(kk)-2):.3f}")
for drop in sorted(best):
    s = np.array([not n.startswith(drop) for n in names])
    a, sa, *_ = m.ols(K[s], Y[s])
    print(f"   all photons but {drop}'s ({s.sum()} left): slope {a:+.2f} +- {sa:.2f}, {a/sa:+.1f} sigma")

print("\nP4. Look-elsewhere with the real data's own statistic (7, not 8): the lock's printed fraction for >= 7 is the matching one (0.0022).")

print("\nP5. Does the same 1/E_LV fit the bursts themselves? GRB 090510 and GRB 140619B need intrinsic lags of")
for n, k, y in zip(names, K, Y):
    if n in ("090510", "140619B", "080916C(2)"):
        print(f"   {n}: {y - a8*k:+.1f} s at the source (the photon would have left that long before the burst's first low-energy peak)")

print("\nP6. Helium: fits without the five hottest isotherms, and the sign")
for gas, forms in (("helium", ("quad", "full")),):
    T, p, r, iso = m.load(gas)
    for f in forms:
        row = []
        for t in (20, 30, 40, 60, 80, 100, 120, 140, 160):
            s = iso == t
            i0, e, eps, A, c2 = m.intercept(T[s], p[s], r[s], t + 273.15, f)
            row.append(f"{t}: {i0*1e10:+.1f}")
        print(f"   {gas} {f}, i0 in 1e-10: " + "; ".join(row))
print("   A negative i0 means the fit reaches zero pressure with light FASTER than in the reference vacuum: the opposite of a slowing.")

print("\nP7. The 1935 value and its error")
print("   11 km/s is the 'average deviation' of 2885.5 single readings; the standard error of their mean would be about 11*1.25/sqrt(2885) =", round(11 * 1.25 / math.sqrt(2885.5), 2), "km/s")
print("   so -18.5 km/s is 1.7 of the one and about", round(18.456 / (11 * 1.25 / math.sqrt(2885.5))), "of the other: the true error was a common one, not scatter.")