Publish validated native Pi Physics-IQ video smoke and full native trace
Browse filesFiles changed (7)
35 unmodified lines36373835 unmodified linesquality_audit/case_006.jpg filter=lfs diff=lfs merge=lfs -textquality_audit/case_036.jpg filter=lfs diff=lfs merge=lfs -textquality_audit/case_095.jpg filter=lfs diff=lfs merge=lfs -text35 unmodified lines363738394035 unmodified linesquality_audit/case_006.jpg filter=lfs diff=lfs merge=lfs -textquality_audit/case_036.jpg filter=lfs diff=lfs merge=lfs -textquality_audit/case_095.jpg filter=lfs diff=lfs merge=lfs -textnative_harness_smoke/pi/inspection.png filter=lfs diff=lfs merge=lfs -textnative_harness_smoke/pi/video_chrono_v2.mp4 filter=lfs diff=lfs merge=lfs -text
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205from pathlib import Pathimport json, mathimport numpy as npfrom PIL import Image, ImageDraw, ImageFilterfrom artifact_io import save
CASE = Path(__file__).resolve().parentspec = json.loads((CASE / 'task_spec.json').read_text())W, H, N, FPS = spec['width'], spec['height'], spec['frames'], spec['fps']
source = Image.open(CASE / 'first_frame.png').convert('RGB')base = np.asarray(source, dtype=np.uint8)assert base.shape == (H, W, 3)
# Fill the two places where the initially held objects occlude the wall. The# wall is nearly planar here; a small harmonic inpaint gives a much less# conspicuous result than cloning a single patch over the whole area.remove = Image.new('L', (W, H), 0)d = ImageDraw.Draw(remove)d.ellipse((354, 101, 486, 229), fill=255)d.rectangle((1054, 169, 1108, 313), fill=255)mask = np.asarray(remove, dtype=bool)filled = base.astype(np.float32).copy()known = ~maskfor _ in range(155): up = np.roll(known, 1, axis=0); down = np.roll(known, -1, axis=0) left = np.roll(known, 1, axis=1); right = np.roll(known, -1, axis=1) count = up.astype(np.float32) + down + left + right if not np.any(mask & (count > 0)): break total = (np.roll(filled, 1, axis=0) * up[..., None] + np.roll(filled, -1, axis=0) * down[..., None] + np.roll(filled, 1, axis=1) * left[..., None] + np.roll(filled, -1, axis=1) * right[..., None]) take = mask & (count > 0) filled[take] = (total[take] / count[take, None]) known[take] = Truebackground = np.clip(filled, 0, 255).astype(np.uint8)# The wall is gently graded across each scanline. Replace the inpainted# interiors by interpolation from the two clean sides; this avoids preserving# the dark circular shadow of the held ball in the otherwise empty wall.background = base.copy()for yy in range(H): row = mask[yy] xx = 0 while xx < W: if not row[xx]: xx += 1 continue start = xx while xx < W and row[xx]: xx += 1 end = xx - 1 left = max(0, start - 1) right = min(W - 1, end + 1) if left == right: background[yy, start:end+1] = base[yy, left] else: q = np.linspace(0.0, 1.0, end-start+3)[1:-1, None] background[yy, start:end+1] = np.round((1-q)*base[yy, left] + q*base[yy, right]).astype(np.uint8)
# Object cutouts retain the original low-light shading and slight optical# softness of the supplied frame. Only their alpha is made geometric.def ball_sprite(): x0, y0, x1, y1 = 345, 92, 495, 242 rgb = base[y0:y1, x0:x1] yy, xx = np.mgrid[0:y1-y0, 0:x1-x0] radial = (((xx-75.0)/66.0)**2 + ((yy-72.0)/65.0)**2) # Brown pixels distinguish the ball from the blue jaws and white wall. r, g, b = rgb[..., 0], rgb[..., 1], rgb[..., 2] brown = (r > 22) & (r > g * 1.13) & (g > b * 1.10) & ((r-g) > 8) & (r < 170) bm = Image.fromarray((brown * 255).astype(np.uint8), 'L') bm = bm.filter(ImageFilter.MaxFilter( nine := 9)).filter(ImageFilter.GaussianBlur(1.1)) alpha = np.asarray(bm, dtype=np.float32) * np.clip(1.0 - (radial-0.82)/0.20, 0, 1) alpha[(radial > 1.02) | (yy < 7)] = 0 rgba = np.dstack([rgb, np.clip(alpha, 0, 255).astype(np.uint8)]) return Image.fromarray(rgba, 'RGBA')
def block_sprite(): x0, y0, x1, y1 = 1048, 158, 1116, 322 rgb = base[y0:y1, x0:x1] # A soft rounded rectangle follows the visible red/orange block, including # its shaded edges, while excluding the wall and the tool above it. m = Image.new('L', (x1-x0, y1-y0), 0) md = ImageDraw.Draw(m) md.rounded_rectangle((8, 12, 59, 151), radius=5, fill=255) m = m.filter(ImageFilter.GaussianBlur(1.15)) rgba = np.dstack([rgb, np.asarray(m)]) return Image.fromarray(rgba, 'RGBA')
BALL = ball_sprite()BLOCK = block_sprite()
def alpha_over(arr, sprite, cx, cy, scale=1.0, angle=0.0): """Composite a PIL sprite at a floating-point center onto an RGB array.""" if scale != 1.0: nw = max(2, round(sprite.width * scale)); nh = max(2, round(sprite.height * scale)) sprite = sprite.resize((nw, nh), Image.Resampling.BICUBIC) if angle: sprite = sprite.rotate(angle, resample=Image.Resampling.BICUBIC, expand=True) x = round(cx - sprite.width/2); y = round(cy - sprite.height/2) layer = Image.new('RGBA', (W, H), (0, 0, 0, 0)) layer.paste(sprite, (x, y), sprite) out = Image.alpha_composite(Image.fromarray(arr, 'RGB').convert('RGBA'), layer) return np.asarray(out.convert('RGB'), dtype=np.uint8)
def add_shadow(arr, cx, ground, rx, ry, strength): layer = Image.new('RGBA', (W, H), (0, 0, 0, 0)) ld = ImageDraw.Draw(layer) ld.ellipse((cx-rx, ground-ry, cx+rx, ground+ry), fill=(32, 27, 26, int(strength))) layer = layer.filter(ImageFilter.GaussianBlur(max(2, round(ry/2)))) return np.asarray(Image.alpha_composite(Image.fromarray(arr, 'RGB').convert('RGBA'), layer).convert('RGB'))
def ball_state(t): # The left pillow crest is about y=514. The 58 px ball reaches it after # just under a second, then makes one soft, quickly damped bounce. g = 650.0 start_y, impact_y = 164.0, 457.0 ti = math.sqrt(2*(impact_y-start_y)/g) if t < ti: y = start_y + .5*g*t*t x = 420.0 + 2.0*t squash = 1.0 else: u = t-ti if u < .43: v = 0.23 * g * ti y = impact_y - v*u + .5*g*u*u x = 422.0 + 4.0*u squash = 1.0 - 0.18*math.exp(-((u)/.075)**2) else: q = u-.43 y = impact_y + 2.6*math.exp(-3.9*q)*math.cos(9.5*q) x = 423.7 + 1.0*math.exp(-3*q) squash = 1.0 return x, y, squash, ti
def block_state(t): g = 700.0 start_y, impact_y = 241.0, 414.0 ti = math.sqrt(2*(impact_y-start_y)/g) if t < ti: y = start_y + .5*g*t*t x = 1080.0 - 20.0*t*t angle = 0.0 + 3.5*t bounce = 0.0 else: u = t-ti # A foam/plastic block tips while the pillow absorbs its landing. if u < .38: v = 0.20*g*ti y = impact_y - v*u + .5*g*u*u bounce = max(0, (y-impact_y)) else: q = u-.38 y = impact_y + 4.5*math.exp(-4.0*q)*math.cos(10*q) bounce = y-impact_y x = 1080.0 - 20.0*ti*ti - 42.0*min(u, .8) angle = 68.0*(1.0-math.exp(-4.3*u)) if u > 0 else 0.0 # Keep the lower corner just above the right pillow as it tips. half_box = abs(164/2*math.cos(math.radians(angle))) + abs(68/2*math.sin(math.radians(angle))) surface = 482.0 if t >= ti: y = surface-half_box + (y-impact_y) return x, y, angle, ti
frames = []for i in range(N): if i == 0: # Required pixel identity, not merely visual similarity. frames.append(base.copy()) continue t = i / FPS frame = background.copy() bx, by, bs, ball_ti = ball_state(t) ox, oy, oa, block_ti = block_state(t)
# A restrained amount of temporal blur during the fast fall makes the # release read as filmed motion rather than a sequence of pasted stills. if t < ball_ti and t > .10: for frac, a in ((.30, .10), (.62, .13)): px, py, _, _ = ball_state(max(0, t - frac/24)) ghost = BALL.copy(); ghost.putalpha(ghost.getchannel('A').point(lambda v: int(v*a))) frame = alpha_over(frame, ghost, px, py, bs, 0) frame = alpha_over(frame, BALL, bx, by, bs, 0)
if t < block_ti and t > .10: for frac, a in ((.35, .08), (.7, .11)): px, py, pa, _ = block_state(max(0, t-frac/24)) ghost = BLOCK.copy(); ghost.putalpha(ghost.getchannel('A').point(lambda v: int(v*a))) frame = alpha_over(frame, ghost, px, py, 1.0, pa) frame = alpha_over(frame, BLOCK, ox, oy, 1.0, oa)
# Contact shadows grow as the pillows receive the impacts. if t > ball_ti-.10: amt = min(34, max(0, (t-(ball_ti-.10))*260)) frame = add_shadow(frame, 424, 516, 64, 10, amt) if t > block_ti-.08: amt = min(28, max(0, (t-(block_ti-.08))*230)) frame = add_shadow(frame, ox, 480, 48, 9, amt) frames.append(frame)
assert len(frames) == Nsave(frames, CASE)print(f'Wrote {N} RGB frames at {FPS} fps to {CASE}')1<!doctype html><meta charset="utf-8"><title>Pi · Physics-IQ smoke</title><body style="max-width:1050px;margin:40px auto;font-family:system-ui"><h1>Pi 1.6.0 · Physics-IQ smoke</h1><p>GPT-5.6-Luna · 0001 · 1280×720 · 24 FPS · 5 秒 · 120 帧 · 交付验证通过</p><video controls style="width:100%" src="video_chrono_v2.mp4"></video><p>Input 145878 · Output 13525 · Cached input 131358</p><p><a href="trace.tar.gz">完整 trace(含 Pi 原生 session 与事件)</a> · <a href="generate.py">生成代码</a> · <a href="../../analyses.html">返回分析进度</a></p><img style="width:100%" src="inspection.png"></body>1{"harness": "Pi1.6.0", "model": "GPT-5.6-Luna", "case": "0001", "width": 1280, "height": 720, "fps": 24, "frames": 120, "status": "complete", "validation_passed": true, "input_tokens": 145878, "output_tokens": 13525, "cached_input_tokens": 131358, "actual_image_returns": 5, "full_regressions": 615, "video": "video_chrono_v2.mp4", "trace": "trace.tar.gz"}123version https://git-lfs.github.com/spec/v1oid sha256:b9a9831de3e4c0e3850f5e16634f275c24fd35f0244b82176c6436d1b89813ebsize 7283797123version https://git-lfs.github.com/spec/v1oid sha256:c82cc8653b9880693d85ad290c4619502f1b71918090d1868c9952ba83856f4fsize 101616.gitattributes+2
native_harness_smoke/pi/generate.pyAdded+205
native_harness_smoke/pi/index.htmlAdded+1
native_harness_smoke/pi/inspection.pngAdded
Large File Pointer Details
- SHA256: d9d46a3e417975179b15cef8abfc8318aedfb800576c19b3daf2abf038953247
- Pointer size: 131 Bytes
- Size of remote file: 284 kB
native_harness_smoke/pi/progress.jsonAdded+1
native_harness_smoke/pi/trace.tar.gzAdded+3
native_harness_smoke/pi/video_chrono_v2.mp4Added+3