"""ADDED AFTER THE FIRST RUN (descriptive check, not pre-registered). Figure 3 of arXiv 2610.41750v1 (page 6, vector): mean colorimetric vs mean triangulation altitude per twilight, 2020-2026. Extract the 21 markers and their error bars and compute the colorimetric-minus-triangulation shift (unweighted mean, median, and inverse-variance weighted mean using half the plotted bar lengths). The paper quotes -0.18 km "taking errors into account". Corrected after the fresh review of 2026-11-06. The first version gave each marker every bar within 0.7 pt of it in one direction and 3 pt in the other, so for 5 of the 21 points a neighbour's bar was merged in and the weighted shift came out as -0.309 km. Each marker's own bars are centred on it, so a bar now belongs to a marker only if its centre lies within 0.4 pt of the marker's centre in both directions; the closest such bar of each kind is taken, and every marker has exactly one of each. Usage: python3 -I fig3_shift.py """ import json, sys, math s = json.load(open(sys.argv[1], encoding="utf-8")) X0, X1, Y0, Y1 = 225.93, 414.12, 298.08, 486.18 # 78..85 km on both axes (ticks) kx = (X1 - X0) / 7.0 ky = (Y1 - Y0) / 7.0 def hx(x): return 78.0 + (x - X0) / kx def hy(y): return 78.0 + (y - Y0) / ky marks, vbars, hbars = [], [], [] for q in s: b = q["bbox"]; w = b[2] - b[0]; h = b[3] - b[1] if not (X0 + 1 < q["cx"] < X1 - 1 and Y0 + 1 < q["cy"] < Y1 - 1): continue if q["paint"] == "f" and q["nseg"] == 47 and q["fill"] and q["fill"][1] == 0.0: marks.append(q) elif q["nseg"] == 1 and w < 0.9 and h > 0.9: vbars.append(b) elif q["nseg"] == 1 and h < 0.9 and w > 0.9: hbars.append(b) def centre(b): return ((b[0] + b[2]) / 2, (b[1] + b[3]) / 2) def own(bars, cx, cy): c = [b for b in bars if abs(centre(b)[0] - cx) < 0.4 and abs(centre(b)[1] - cy) < 0.4] c.sort(key=lambda b: abs(centre(b)[0] - cx) + abs(centre(b)[1] - cy)) return c[0] if c else None pts = [] for m in marks: cx, cy = m["cx"], m["cy"] v, hb = own(vbars, cx, cy), own(hbars, cx, cy) sc = (v[3] - v[1]) / 2 / ky if v else None st = (hb[2] - hb[0]) / 2 / kx if hb else None pts.append({"tri": hx(cx), "col": hy(cy), "sig_col": sc, "sig_tri": st}) d = [p["col"] - p["tri"] for p in pts] out = {"n": len(pts), "mean_shift": sum(d) / len(d), "median_shift": sorted(d)[len(d) // 2], "sd_shift": math.sqrt(sum((a - sum(d) / len(d)) ** 2 for a in d) / (len(d) - 1))} wp = [p for p in pts if p["sig_col"] and p["sig_tri"]] if wp: w = [1 / (p["sig_col"] ** 2 + p["sig_tri"] ** 2) for p in wp] out["weighted_shift"] = sum(a * (p["col"] - p["tri"]) for a, p in zip(w, wp)) / sum(w) out["weighted_se"] = 1 / math.sqrt(sum(w)) out["n_with_both_bars"] = len(wp) out["points"] = pts json.dump(out, open(sys.argv[2], "w", encoding="utf-8", newline="\n"), indent=1) print({k: (round(v, 3) if isinstance(v, float) else v) for k, v in out.items() if k != "points"})