M-EXPORT2: reorg-geometry XYZ export + generalized PNG capture bridge - #54
Merged
Merged
Conversation
… (EXP2.1-2.3, EXP2.5) - EXP2.3: export_destination() — one place deciding where a new export lands and what it's called, scoped to new exporters only (the 3 existing structure exporters are left alone to avoid regressing working code). - EXP2.1: Export XYZ button on the reorg-geometry viewer, one file per distinct geometry (R_neutral + each R_ion), each carrying its own charge/multiplicity in the header comment. reorg_geometries() now threads charge/multiplicity through (the source payload already had it). - EXP2.2: generalized the isosurface's PNG capture bridge — _png_capture_controls now takes a capture_fn name instead of hardcoding the isosurface's bare window.__quantuiIsoCapture global (default preserved for exact backward compatibility). Wired a Save-PNG button into the reorg-geometry viewer with its own uid-scoped capture function and its own inbox, since every render gets a fresh uid and a shared global would risk one render's button capturing another's viewer. Molecule/trajectory/vibrational viewers are deliberately deferred — the roadmap's "cost of passing a capture_class" framing wasn't accurate until this generalization existed; this PR proves the reusable pattern on one viewer rather than retrofitting all of them. - EXP2.5: 20 new tests covering export_destination, the XYZ exporter, the PNG capture handler, and the capture-wiring HTML (isosurface default unchanged, reorg viewer gets a uid-scoped function, button omitted when capture_class is empty). Full suite: 2538 passed, 14 failed (pre-existing NMR failures, unrelated), 23 skipped. ruff + black + mypy (pre-push hook-stage) all clean. Contributions: - Claude (Opus 4.8): implementation, tests, verification - Jonathan Schultz: direction and review Co-authored-by: Jonathan Schultz <schultzdjon@gmail.com> Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Third in the stack behind M-METAL (#52) and M-TYPECHECK (#53), both now merged. This branch has
mainmerged in and is green. Next up: #CHECKPOINT.reorg_geometries()now threads charge/multiplicity through (the source payload already had it — this was a pass-through fix).export_destination(), one shared helper deciding folder + sanitised filename for new exporters. Deliberately does not retrofit the 3 existing structure exporters (XYZ/MOL/PDB) — they work today and retrofitting risked a regression for no user-visible gain._PNG_CAPTURE_JShardcoded the isosurface's own global (window.__quantuiIsoCapture). Fixed by parameterizing the capture-function name (isosurface's default preserved byte-for-byte, verified by test), then wired a Save-PNG button into the reorg-geometry viewer with its own uid-scoped capture function and inbox — that viewer gets a fresh uid every render, so a shared global would risk one render's button capturing a stale viewer. Molecule/trajectory/vibrational viewers are deliberately deferred; the reusable pattern is now proven on one viewer rather than four at once.tests/test_export2_reorg_and_destination.py) covering the destination helper, the XYZ exporter, the PNG capture handler, and the capture-wiring HTML.Scope note: this is the first slice of M-EXPORT2. EXP2.4 (general provenance beyond the XYZ header) and the remaining EXP2.2 viewers stay open on the roadmap.
Test plan
pytest -m "not network"— full suite passes on CI (ubuntu 3.9/3.10/3.11 + windows 3.11). Locally the only failures are the two GFN-FFtest_preopt_gfnfftests, which are environmental (this dev box'sxtbC-API extension is broken) — they pass on CI where the xtb wheel is intact.pre-commit run --hook-stage pre-push mypy --all-files— clean (re-confirmed on themain-merged branch).mainbase: Lint & type check + all test matrix jobs.