diff options
Diffstat (limited to 'experiments')
| -rw-r--r-- | experiments/analyze_kp_dynamic_projection_confirmation.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/experiments/analyze_kp_dynamic_projection_confirmation.py b/experiments/analyze_kp_dynamic_projection_confirmation.py index 291de88..9a17206 100644 --- a/experiments/analyze_kp_dynamic_projection_confirmation.py +++ b/experiments/analyze_kp_dynamic_projection_confirmation.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 """Audit the frozen D4 paired five-seed test confirmation.""" import argparse +import glob import json import math import os @@ -68,6 +69,20 @@ def main(): source_commits = set() failures = [] finite_values = [] + expected_names = { + f"seed{seed}_{condition}.json" + for seed in SEEDS for condition in CONDITIONS + } + observed_names = { + os.path.basename(path) + for path in glob.glob(os.path.join(args.input_dir, "*.json")) + } + if observed_names != expected_names: + missing = sorted(expected_names - observed_names) + extra = sorted(observed_names - expected_names) + raise ValueError( + f"D4 requires exactly the frozen ten records; " + f"missing={missing}, extra={extra}") bp_macs_50k = int(round( float(full_gate["metrics"]["bp_total_macs"]) * 50_000 / 45_000)) for seed in SEEDS: @@ -240,6 +255,14 @@ def main(): "establish the strict accept bar; depth scaling remains oral work"), } os.makedirs(os.path.dirname(os.path.abspath(args.out)), exist_ok=True) + if os.path.exists(args.out): + with open(args.out) as handle: + existing = json.load(handle) + if existing != output: + raise ValueError( + "existing D4 gate differs from the deterministic re-audit") + print(json.dumps(output, indent=2)) + return with open(args.out, "w") as handle: json.dump(output, handle, indent=2, sort_keys=True) handle.write("\n") |
