"""Summary table of the warm campaign: python3 scripts/warm_summary.py [dir]""" import json, glob, sys, re, numpy as np sys.path.insert(0, '.') from pbhgr.ltb import LTBGaussian d = sys.argv[1] if len(sys.argv) > 1 else 'runs/v1/warm' tH = 100 * np.sqrt(6) cold = {0.10: (25.6, 28.2), 0.07: (41.5, 45.2), 0.05: (68.1, 73.7), 0.04: (88.1, 92.8), 0.03: (134.3, 140.3), 0.025: (173.5, 179.6), 0.02: (241.4, 248.4), 0.017: (306.7, 313.9)} # re-stretched cold baseline (0.07, 0.05 still fixed-grid values) print("mu sigma n | cold horizon proper/coord (t_H) | warm: earliest tau_trap | first AH coord t (t/tC0) | tau_core | M_AH (M_H) | R_AH | arriving |2E| | max|P| | wall") rows = [] for f in sorted(glob.glob(f'{d}/ltb_mu*_sig*.json')): m = re.search(r'mu([\d.]+)_K\d+_n(\d+)(?:i\d+)?_s\d+_sig([\de+-]+)(?:_dR[\d.]+)?\.json', f) if not m or '_rel' in f: continue mu, n, sig = float(m.group(1)), int(m.group(2)), float(m.group(3)) L = LTBGaussian(mu); tC0 = L.tC(1e-6); rm = L.r_m dd = json.load(open(f)); diag = dd['diag'] ah = next((r for r in diag if r['AH']), None) sh = np.load(f.replace('.json', '_shells.npz')) tt = sh['tau_trap']; earliest = np.nanmin(tt) / tH if np.any(np.isfinite(tt)) else np.nan pmax = np.nanmax(np.abs(sh['P_end'])) log = open(f.replace('.json', '.log')).read(); w = re.search(r'wall=([\d.]+)s', log); wall = float(w.group(1)) if w else np.nan c = cold.get(mu, (np.nan, np.nan)) if ah: r_a = np.sqrt(max(np.log(ah['t'] / tC0), 0) / (0.25 - mu / 4)) rows.append((mu, sig, n, f"{mu:5.3f} {sig:7.0e} {n:2d} | {c[0]:6.1f} / {c[1]:6.1f} | {earliest:7.1f} | {ah['t']/tH:7.1f} ({ah['t']/tC0:.3f}) | {ah['tau_core_median']/tH:6.1f} | {ah['AH']['M_AH']/(0.75*tH):.4f} | {ah['AH']['R_AH']:5.2f} | {-2*L.E(r_a):.4f} | {pmax:6.1f} | {wall:6.0f}s")) else: rows.append((mu, sig, n, f"{mu:5.3f} {sig:7.0e} {n:2d} | {c[0]:6.1f} / {c[1]:6.1f} | {earliest:7.1f} | no AH by {diag[-1]['t']/tH:.0f} t_H (max 2m/R {max(r['max_2m_over_R_collapsing'] for r in diag if r['max_2m_over_R_collapsing']==r['max_2m_over_R_collapsing']):.2f}) | | | | | {pmax:6.1f} | {wall:6.0f}s")) for r in sorted(rows, key=lambda r: (-r[0], r[1], r[2])): print(r[3])