#!/usr/bin/env python3 """The `PRESS Ⓐ` plate over time: does it stay up, pulse, or blink once? `fast_title_probe.py` answers "is the title up yet" — a threshold crossing. This logs the **whole series**, because the port's question is about the shape: an authored `looping_focus_records` entry is deleted if the plate blinks once and kept if it pulses. Counter is byte-identical to `is_title.py`. ⚠️ Controls, run before this was pointed at anything unknown: live-title-press-a.png 753 (plate up) live-main-menu.png 327 (documented) live-title-build4-no-plate.png 159 ← the FLOOR: the title art alone carries 159 green pixels, so 0 is not the plate-absent value and a series that bottoms at ~159 is a plate going away, not a black screen. 🔴 The stream is torn down every RESTART_S. A single long-lived x11grab degrades to 1.60 fps and then reports a stale frame forever — see `fast_title_probe.py`. plate_timeseries.py SECONDS OUT.tsv """ import subprocess import sys import time import numpy as np W, H = 1280, 720 LIMIT = float(sys.argv[1]) if len(sys.argv) > 1 else 300 OUT = sys.argv[2] if len(sys.argv) > 2 else "/dev/stdout" RESTART_S = 30 def _open(): return subprocess.Popen( ["ffmpeg", "-loglevel", "error", "-f", "x11grab", "-draw_mouse", "0", "-video_size", f"{W}x{H}", "-i", ":98", "-r", "6", "-f", "rawvideo", "-pix_fmt", "rgb24", "-"], stdout=subprocess.PIPE, bufsize=W * H * 3 * 2) p = _open() n = W * H * 3 t0 = time.time() seg = t0 with open(OUT, "w") as f: f.write("# t_s\tglyph_px\tsurface_mean\n") while time.time() - t0 < LIMIT: if time.time() - seg > RESTART_S: p.kill(); p = _open(); seg = time.time() buf = p.stdout.read(n) if len(buf) < n: p.kill(); p = _open(); seg = time.time(); continue a = np.frombuffer(buf, np.uint8).reshape(H, W, 3).astype(int) r, g, b = a[:, :, 0], a[:, :, 1], a[:, :, 2] c = int(((g > 130) & (g - r > 45) & (g - b > 45)).sum()) f.write(f"{time.time()-t0:.3f}\t{c}\t{a.mean():.3f}\n") f.flush() p.kill()