#!/usr/bin/env python3 """Run the sole frozen D1 dynamic neutral-projection candidate.""" import argparse import json import os import subprocess import sys def main(): parser = argparse.ArgumentParser() parser.add_argument("--device", default="cuda") parser.add_argument("--dry_run", action="store_true") parser.add_argument( "--s0_gate", default="results/kp_innovation_stability_gate.json") parser.add_argument( "--out", default="results/kp_dynamic_projection/dynamic.json") args = parser.parse_args() with open(args.s0_gate) as handle: gate = json.load(handle) if (gate.get("protocol") != "kp_stability_margin_training_prefix_v1" or gate.get("status") != "failed_no_eligible_margin"): raise ValueError("D1 requires the audited failed S0 gate") command = [ sys.executable, "experiments/diagnose_kp_traffic_nonfinite.py", "--rule", "innovation", "--predictor_mode", "closed_form", "--predictor_every", "0", "--stability_margin", "0", "--neutral_projection", "--device", args.device, "--max_steps", "352", "--out", args.out, ] print(" ".join(command), flush=True) if not args.dry_run: os.makedirs(os.path.dirname(os.path.abspath(args.out)), exist_ok=True) subprocess.run(command, check=True) if __name__ == "__main__": main()