From 580397eaf83c85b233495791ecc51662a374a247 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 31 Oct 2026 10:21:42 +0000 Subject: [PATCH] research: karman reproduce uses committed pinball ids after sync_bodies add_body after initialize returns a pending negative id; sync_bodies commits the new bodies in order, so the pinball ids are n0..n0+2 (f2f88c phase3 did the same). Fixes the KeyError(-1) in the GPU smoke. Co-Authored-By: Claude Opus 5.5 --- research/karman_reproduce/run.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/research/karman_reproduce/run.py b/research/karman_reproduce/run.py index 2bc0606..88acebe 100644 --- a/research/karman_reproduce/run.py +++ b/research/karman_reproduce/run.py @@ -76,9 +76,11 @@ def main(): # Legacy build_karman_cloak order: stabilize disturbance + probes, then the # 150-interval zero-action target sampling (kept as flow time), then the pinball. sim.run(WARMUP + FIFO_LEN * SI) - pinball = [sim.add_body("circle", center=c, radius=R) - for c in ((30 * L0, YC, 0.0), (626.0, YC + 15, 0.0), (626.0, YC - 15, 0.0))] + n0 = sim.bodies.count + for c in ((30 * L0, YC, 0.0), (626.0, YC + 15, 0.0), (626.0, YC - 15, 0.0)): + sim.add_body("circle", center=c, radius=R) # pending (negative) id until sync sim.sync_bodies() + pinball = list(range(n0, n0 + 3)) # committed ids, as in f2f88c phase3 sim.run(WARMUP) cells = float(len(sim.bodies.get(probes[0]).get_sensor_list(NX, NY)[0])) # probe sum = mean * cells