P2r main grid: runner, summary, results; close the P2r decision
- scripts/11: check_rids guard; scripts 14/15 accept the protocol_p2r main grid (realizations 8-15) only when protocol_p2r and its inputs match the locked SHA-256 - scripts/run_p2r_main.sh: per-regime pipelines (posterior then training) on cuda:0/cuda:1 - scripts/18_summarize_p2r.py: H2a / H2b / H3 / sigma_a verdicts per the locked rules - docs/plan.md, report.html: H2a and H2b pass, sigma_a arm fails, no Pivot 1 - logs/index.csv: run records of the P2r grid Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -44,6 +44,31 @@ def load_protocol(check: bool) -> dict:
|
||||
return proto | {"sha256": actual}
|
||||
|
||||
|
||||
def check_rids(rids, P: dict) -> dict | None:
|
||||
"""Guard for the diagnostic scripts (14, 15): realizations of the protocol_p2 main grid are refused; realizations of
|
||||
the protocol_p2r main grid are allowed only if protocol_p2r and its inputs match their locked SHA-256 (returns that
|
||||
protocol, else None). Every other realization is dev."""
|
||||
bad = sorted(set(rids) & set(P["grid"]["realizations"]))
|
||||
if bad:
|
||||
raise SystemExit(f"realizations {bad} belong to the protocol_p2 main grid: diagnostics use dev realizations only")
|
||||
path = REPO_ROOT / "configs" / "protocol_p2r.yaml"
|
||||
P2r = yaml.safe_load(path.read_text())
|
||||
main = set(rids) & set(P2r["grid"]["realizations"])
|
||||
if not main:
|
||||
return None
|
||||
if set(rids) - main:
|
||||
raise SystemExit("do not mix protocol_p2r main-grid realizations with dev realizations in one run")
|
||||
expected = (REPO_ROOT / "configs" / "protocol_p2r.sha256").read_text().split()[0]
|
||||
actual = hashlib.sha256(path.read_bytes()).hexdigest()
|
||||
if actual != expected:
|
||||
raise SystemExit(f"protocol_p2r.yaml changed after locking ({actual[:12]} ≠ {expected[:12]})")
|
||||
for k, v in P2r["inputs"].items():
|
||||
h = hashlib.sha256((REPO_ROOT / v["path"]).read_bytes()).hexdigest()
|
||||
if h != v["sha256"]:
|
||||
raise SystemExit(f"{v['path']} differs from the version recorded in protocol_p2r ({h[:12]} ≠ {v['sha256'][:12]})")
|
||||
return P2r
|
||||
|
||||
|
||||
def reg_settings(P: dict) -> dict:
|
||||
r = P["registration"]
|
||||
keys = ("S", "g_max", "sigma_a_ms", "sigma_b_ms", "kernel", "hyperprior", "hyper_starts", "ess_min_frac",
|
||||
|
||||
Reference in New Issue
Block a user