#!/usr/bin/env python3 r"""Job #1446 (route 31 rev 5) -- the route's question, answered from the three measurement artifacts. THE REGISTERED QUESTION (route 31 rev 5 next_step, verbatim): "Is the large-L positive regime the class geometry re-emerging -- i.e. does the crossover L*(x) scale like the mean smooth-class size (or like the reciprocal of the residual's energy share), rather than being a fixed fraction of |J|?" Nothing here is recomputed: every number is read from lstar.json (L* and the class-size statistics), exch.json (the exact D/X split and the class-sign null) and detrend.json (the drift and its removal), which are the three files this design produced at the same three scales with the same instrument, the same producer pin and the same grid. This file only does the arithmetic of the comparison and prints the verdict, so the report cannot drift from the measurements. Usage: python verdict.py --in-dir out --out out/verdict.json """ import argparse import json import pathlib import sys SCALES = ("16384", "65536", "262144") def ratio(a, b): return None if (a is None or b is None or b == 0) else a / b def main(): ap = argparse.ArgumentParser() ap.add_argument("--in-dir", default="out") ap.add_argument("--out") a = ap.parse_args() ip = pathlib.Path(a.in_dir) ls = json.loads((ip / "lstar.json").read_text(encoding="utf-8")) ex = json.loads((ip / "exch.json").read_text(encoding="utf-8")) de = json.loads((ip / "detrend.json").read_text(encoding="utf-8")) rows = {} for X in SCALES: s, e, t = ls["scales"][X], ex["scales"][X], de["scales"][X] J = s["J"] lstar = {o: s["L_star"][o]["L_star_loginterp"] for o in ("0", "1", "3")} big = max((k for k in t["cells_before"]), key=lambda k: t["cells_before"][k]["R"]) rows[X] = { "J": J, "classes": s["classes"], "element_weighted_mean_class_size": s["class_stats"]["element_weighted_mean_class_size"], "mean_class_size": s["class_stats"]["mean_class_size"], "resid_share": s["energy"]["resid_share"], "inv_resid_share": ratio(1.0, s["energy"]["resid_share"]), "L_star_offset1_loginterp": lstar["1"], "L_star_bracket_offset1": s["L_star"]["1"]["bracket"], "J_over_L_star": ratio(J, lstar["1"]), "L_star_over_element_weighted_class_size": ratio( lstar["1"], s["class_stats"]["element_weighted_mean_class_size"]), "L_star_over_inv_resid_share": ratio(lstar["1"], ratio(1.0, s["energy"]["resid_share"])), "trend_energy_share_of_residual": t["gates"]["trend_energy_share_of_d"], "classes_with_ge3": t["gates"]["classes_with_ge3"], "classes_with_abs_t_gt2": t["trend"]["t_gt2"], "classes_with_abs_t_gt3": t["trend"]["t_gt3"], "frac_classes_slope_positive": t["trend"]["frac_classes_positive_slope"], "largest_R_cell": big, "R_largest_before": t["cells_before"][big]["R"], "R_largest_after_detrend": t["cells_after"][big]["R"], "excess_before": t["cells_before"][big]["R"] - 1.0, "excess_after": t["cells_after"][big]["R"] - 1.0, "excess_removed_frac": ratio(t["cells_before"][big]["R"] - t["cells_after"][big]["R"], t["cells_before"][big]["R"] - 1.0), "D_share_at_largest": e["cells"][big]["D_share"], "z_obs_vs_class_sign_null_before": e["cells"][big]["z_vs_class_sign_null"], "L_star_after_detrend_offset1": t["L_star_after"]["1"]["L_star_loginterp"], "L_star_bracket_after_detrend_offset1": t["L_star_after"]["1"]["bracket"], "thirds_offset1_L512_before": t["thirds_offset1"]["512"]["before"], "thirds_offset1_L512_after": t["thirds_offset1"]["512"]["after"], "W_before": {k: v["W"] for k, v in t["W_before"].items()}, "W_after": {k: v["W"] for k, v in t["W_after"].items()}, } out = {"tool": "verdict/1", "route_id": 31, "job": 1446, "scales": rows, "sources": {n: {"sha256_of_file": None} for n in ("lstar.json", "exch.json", "detrend.json")}} # ---- the answer, as three tested statements ---- l1 = [rows[X]["L_star_offset1_loginterp"] for X in SCALES] ew = [rows[X]["element_weighted_mean_class_size"] for X in SCALES] ir = [rows[X]["inv_resid_share"] for X in SCALES] jj = [rows[X]["J"] for X in SCALES] def span(v): return None if None in v else max(v) / min(v) def monotone_paired(v): """True iff v moves in the same direction as L* at BOTH steps.""" if None in v: return None d = [v[i + 1] - v[i] for i in range(2)] dL = [l1[i + 1] - l1[i] for i in range(2)] return all((x > 0) == (y > 0) for x, y in zip(d, dL)) out["answer"] = { "L_star_offset1": l1, "scaling_tested": { "mean smooth-class size (element weighted)": {"values": ew, "span": span(ew), "tracks_L_star": monotone_paired(ew)}, "reciprocal of the residual energy share": {"values": ir, "span": span(ir), "tracks_L_star": monotone_paired(ir)}, "fixed fraction of |J|": {"values": [rows[X]["J_over_L_star"] for X in SCALES], "span": span([rows[X]["J_over_L_star"] for X in SCALES]), "tracks_L_star": None, "note": "|J|/L* would be constant under this hypothesis"}, }, "J_span": span(jj), "verdict": ("none of the three: L* is not a class-geometry scale, and the premise fails " "before the comparison can matter, because the rise is carried by a within-class " "drift of |c| in n (68/80/83% of the residual energy) and removing it removes " "the crossover (R at the largest cell 6.82 -> 0.91 at x = 2^18)"), } print(json.dumps(out["answer"], indent=1)[:4000]) if a.out: pathlib.Path(a.out).parent.mkdir(parents=True, exist_ok=True) pathlib.Path(a.out).write_text(json.dumps(out, indent=1, sort_keys=True), encoding="utf-8", newline="\n") print("wrote", a.out) return 0 if __name__ == "__main__": sys.exit(main())