#!/usr/bin/env python """Agent prior card (ablation factor A): what a coding agent can infer about the cloth parameter card from the reference video alone, without any fitting. This emulates the "coding agent writes a world + parameters" arm of the ablation. The agent sees: reference.mp4 (and nothing else). Its priors: 1. Material: it looks like standard polyester/cotton fabric -> areal density ~0.2-0.4 kg/m^2 -> card density 0.35 (anchored working point). 2. Stiffness: folds look soft, drapes over the table edge smoothly -> flimsy -> bending 0.02 (rag-like). 3. Air drag: the drop in the video falls fast, no parachute behavior -> air_damp 1.0 (Blender default). So the agent card IS the default card here, which is the honest baseline: "agent guesses from priors, no measurement". The NeuIDO arm (B1) instead *measures* the parameters from the truth trajectories by closed-loop fitting. We write the card to JSON so the 2x2 ablation runner picks it up. Usage: python agent_card.py --world work/B_07/world --out work/B_07/agent_card.json """ import argparse import json import os from pathlib import Path import numpy as np def main(): ap = argparse.ArgumentParser() ap.add_argument("--world", required=True) ap.add_argument("--out", required=True) args = ap.parse_args() world = Path(args.world) spec = json.loads((world / "spec.json").read_text()) z = np.load(world / "dyn" / "Cloth.npz") pos = z["pos"] faces = z["faces"] # cloth area at frame 0 (agent could estimate this from the video geometry) v = pos[0].astype(np.float64)[faces.astype(np.int64)] a = v[:, 1] - v[:, 0] b = v[:, 2] - v[:, 0] area = float(0.5 * np.linalg.norm(np.cross(a, b), axis=1).sum()) # drop speed visible in the first frames (agent could read this from video) dt = 1.0 / float(spec["video"]["fps"]) speed = float(np.linalg.norm((pos[6] - pos[0]) / (6 * dt), axis=1).mean()) # agent priors -> card (fabric recognition + free-fall check vs 9.81) card = { "density": 0.35, # "standard fabric" prior, kg/m^2 anchor "bending": 0.02, # "soft drape" prior "air_damp": 1.0, # "falls like normal cloth" prior "tensile": 15.0, "compress": 15.0, "shear": 8.0, "method": "agent_prior", "notes": { "cloth_area_m2": round(area, 3), "early_drop_speed_ms": round(speed, 3), "gravity_freefall_check": round(speed / (6 * dt) / 9.81, 3), }, } Path(args.out).write_text(json.dumps(card, indent=1)) print(json.dumps(card, indent=1)) if __name__ == "__main__": main()