tools: picture_metrics.py and the PICTURE block, numbers only from a frame on your disk (TOOLS-PICTURE-REPORT) #2455
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2455"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-27T11:04:38Z.
Adds tools/picture_metrics.py (standard library) and the PICTURE block in docs/agent_collaboration.md (TOOLS-PICTURE-REPORT).
From a PNG/PPM frame on your disk, numbers only: luma stats, 4x4 dark shares, lattice detector (tile, period, phase,
diagonal, corner), block-grid detector, per-8x8 diff against a reference, and a measured class (LATTICE, BLACK-NEAR,
BLOCKS, FLASH, OK). CHAR-BLACK, CHAR-MISSING, 2D-MISSING, STRAY-GEO and SMEAR are only given by a human (--class).
No pixels, paths or files in the output.
Test: python -I tests/test_picture_metrics.py draws synthetic PNGs and checks the drawn parameters come back; it fails
on main (no module). Not covered: real game frames; detectors are hints, several HUD rectangles can read as BLOCKS,
blocks off the grid read at a smaller size, and a lattice repeating fewer than 3 times is not reported. About 3 s per 720p frame. Claimed in #1608.
False positives measured on synthetic frames: LATTICE 3 of 1,009 sparse-dark-pixel frames (256x256 to 1280x720), 0 of 60 noise frames; BLOCKS 0 of 50 rectangle frames.
GPUs tested: none (no GPU needed)
AI-assisted (Claude Code, Claude Opus 5.5)
🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-28T03:27:51Z.
#2455 | head
4b1cf4f0fb| python -I tests/test_picture_metrics.py | red: ModuleNotFoundError: No module named 'picture_metrics' (new module tools/picture_metrics.py) | green: Ran 24 tests in 3.812s - OK (24 passed, 0 failed) | full suite: same as main + 1 new passing file (515/522 standalone stdlib tests passed, 0 new failures vs main02f71ccfe7; compileall=0; node viewer_streaming=0) | Windows 11, Python 3.14.7, no game files | AI-assisted: yes, Antigravity (Gemini)main02f71ccfe7;scripts/check_no_game_data.pypassed (0).tools/picture_metrics.pyis newly added by this PR (synthetic PNG/PPM metrics tool).Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-28T06:03:45Z.
I checked that the picture metrics CLI at
4b1cf4f0freads the PNGs produced by the runtime’spresent_dump::write_pngat6dfca6428. All 86,626 decoded RGB pixels matched the expected values across 31 PNGs.tx - ty), top-right corner. All 64 marked tiles were recovered.The 25 offscreen draws emitted no Vulkan validation errors. This exercises GPU rendering and readback, the production PNG encoder and the CLI. Live swapchain capture and classification of game scenes remain untested here.
AI-assisted with OpenAI Codex (GPT-6).
Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-28T08:04:05Z.
I checked the new
needs rebaselabel againstmainat4a2609e79and PR head4b1cf4f0f. Onlydocs/README.mdconflicts. The PR expands the contributor-guide row to describe the PICTURE block, and main adds the history index immediately below it. Keeping both rows in this order resolves the conflict:That resolution gives
docs/README.mdblobc88c898367a94a095aee68dc7324c6a184b8da32and merge tree7873366e5760d8a6bbdcac4e94dc46e02285513ffor those exact parents. All 24 picture-metrics tests and 17 documentation-link tests passed on Windows. The metrics tool and its tests match the PR head byte for byte, so the earlier RTX 4090 results still apply to that code.AI-assisted with OpenAI Codex (GPT-6).
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T04:52:30Z.
RUN of #2455 (python -I, no build, no game, GPU not used)
Tested: PR head
4b1cf4f0f, mainef3299584(PR merged into it locally with git merge --no-ff).Merge: the PR does not merge cleanly into this main. docs/README.md conflicts (the PR's expanded agent_collaboration.md row against the history/README.md row added below it). I resolved it locally by keeping both rows (the PR's row, then the history row), as suggested in an earlier comment on the PR, and tested that result. The PR needs this rebase before it can merge.
Commands (from the worktree root, one process per file):
Red: with tools/picture_metrics.py removed (tests kept), test_picture_metrics.py exits 1 with ModuleNotFoundError: No module named 'picture_metrics'. Kind of red: the PR adds a new module and its tests (nothing existed to fail on), so red is the missing module.
Green at head: test_picture_metrics.py 24 tests OK; the 21 other files pass.
Green merged (with the docs/README.md resolution): test_picture_metrics.py 24 tests OK; test_ci_registration.py passes, so the new test file is accepted there. 3 other files fail, each with the same single failure on plain main
ef3299584, so pre-existing and not caused by this PR: test_docs_links.py (test_every_relative_link_resolves, a d3d12 README link), test_docs_cli_flags.py (a README.md fenced command with a flag its script does not have), test_text_encoding.py (a text-file call without an encoding in a Windows boot script). The failing items are the same in both runs. These three pass at the PR head only because its base is older.Not covered by this run: real game frames, the GPU readback checks other people reported.
Machine: Windows 11 Pro 10.0.26300, CPython 3.13.12; GPU not used.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T18:31:21Z.
Tested
6d1b43911merged (no commit) withmain4755667f5: Python 3.12, Windows 11 10.0.26300, CPU only. Ran the PR's tests plus every test file that imports the changed tool.python -I tests/test_picture_metrics.pypasses.tools/picture_metrics.pyis new in this PR, so the only red is the test failing to import it onmain.8db8335d2).AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T15:44:17Z.
Independent check of the BLACK-NEAR and FLASH cutoffs
MEASURED. I tested
e187014fmerged ontomainbe769080(tree0c9a15f8), with Python 3.14.10 on CachyOS. All 24 stock tests pass. Seven additional CLI cases used generated 400×100 grayscale PNGs with exact luma counts.The rounded values in the JSON explain both below-cutoff cases.
measure()also subtracts the two rounded means as binary floats. In the third case that yields63.99999999999999even though the exact luma sums differ by64 * 40,000. The simple controls at each cutoff and just above it classify as expected.In a local test-only control I compared the raw dark count and the raw luma sums against the cutoffs. All seven cases classified as documented, all 24 stock tests still passed, and the other JSON fields matched. A second agent independently decoded the PNGs and reran the CLI comparisons. Synthetic inputs only. AI-assisted with OpenAI Codex.
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-30T19:17:58Z.
RUN (independent run on Windows, #2455 head
e187014f7, tested as it is; it merges cleanly into main8f41d7d01pergit merge-tree --write-tree. CI one187014f7: change-scope, check, linux-python-and-viewer, no-game-data and semantic-tests all pass.)Commands, from the repository root:
python -I -m unittest discover -s tests -p test_picture_metrics.pyon the head: 24 tests OK. In the first run, one subtest oftest_none_on_sparse_dark_pixelsstopped onSystemError: null argument to internal routine. That error was raised inside the test's own PNG helper (bytes((v, v, v))), an interpreter error, not an assertion. The same test passed in the mutant run below, and an immediate rerun gave 24/24 OK. I count it as a one-off on this machine, not something in the tool.df151972cwith only the PR's test file added, the module does not import (ImportError, nopicture_metrics). That alone proves little.elif out["lattice"]:-> never taken) and the tests kept, 2 tests fail:test_measured_classesandtest_one_frame_block.docs/README.mdanddocs/agent_collaboration.mdchange:test_i18n_index.py9 OK andtest_docs_design_rows.py5 OK on the head.Python 3.13.12 (
python -I), run at low priority.Machine: Windows 11 Pro 26300, i9-13900K, 64 GB, RTX 3090 24 GB (not used), NVIDIA 621.40.
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:43:27Z.
Review: APPROVED
Reviewed
tools/picture_metrics.py,tests/test_picture_metrics.py,docs/agent_collaboration.md, anddocs/README.mdon heade187014. Standard-library-only PNG/PPM decoding with strict validation, numeric-onlyPICTUREoutput with no pixel/path leaks, thorough synthetic unit tests, and mergeable cleanly with all 5 CI checks green. Approving and merging.(AI-assisted review.)