#!/usr/bin/env python3 """Job 4239 (route 109 step check): arithmetic on published numbers only. Input: #1322 rcond2550.json (sha256 c60737f22a0c...), review 243's R_drift column (cited). Sizes the fitted-amplitude (projection) effect the step asks to calibrate, per cell.""" import json, hashlib, sys p = sys.argv[1] if len(sys.argv) > 1 else "rec/rcond2550.json" raw = open(p, "rb").read() assert hashlib.sha256(raw).hexdigest().startswith("c60737f22a0c"), "input hash" d = json.loads(raw) R_DRIFT = {("19","2310"):0.81642,("19","30030"):0.77622,("23","2310"):0.85771, ("23","30030"):0.78095,("29","2310"):0.89153,("29","30030"):0.84338} # review 243 rows = [] for x in ("19","23","29"): for H in ("2310","30030"): c = d["levels"][x]["windows"][H] K, W = len(c["lambda_k"]), c["windows_per_period"] sd, pred, Rc = c["boot_sd"], c["predicted_R_cond"], c["R_cond"] fit = K / (K * W) * Rc # one fitted amplitude per period: ~1 window of df per period rows.append(dict(x=int(x), H=int(H), periods=K, windows_per_period=W, per_window_arrays_in_file=any(isinstance(v, list) and len(v) > K for v in c.values()), z_author=round((Rc - pred) / sd, 2), z_drift=round((R_DRIFT[(x,H)] - pred) / sd, 2), fit_effect_sigma=float(f"{fit / sd:.2g}"))) for r in rows: print(json.dumps(r))