Repository navigation
fix: guard the point-source parity scripts against the SMALL_DATASETS cap - #265
Merged
Merged
Conversation
… cap Follows #264, which found that `should_simulate` rmtree's the committed, gitignore-allowlisted, JSON-only `dataset/point_source/simple` whenever `PYAUTO_SMALL_DATASETS=1` is in force, and that no `SMALLDAT` stamp exists on JSON data for PyAutoArray#471's library guard to read. Two gaps remained. First, that sweep missed a site. `point_source/visualization/modeling_visualization_jit.py` declared `ENV: real_output` — which does not release the cap — while its own `__Env__` prose claimed "full-resolution data". It calls `should_simulate` on the committed dataset, so it is the same defect fixed next door in `visualization.py`. Now declares `full_datasets real_output`. Second, the parity scripts had no defence of their own. Five scripts pin absolute likelihood literals against this dataset and would happily compare them to capped-regime output. Under the cap `PointSolver.solve` short-circuits to a fixed position pair identical for every lens model, so such a comparison measures nothing — that is how it presented: an assert failing with a different value on every run, once as the `-1e99` sentinel and once as a finite-but-wrong 16.131221. Each of the five now asserts the cap is off before anything touches the dataset directory, following the `interferometer/nufft.py` precedent. The check reads the env var rather than inferring from grid geometry, because a JSON dataset has no capped shape to detect. It runs before the bootstrap deliberately: a misconfigured run now fails naming the cause instead of first destroying data the next run depends on. Verified in-session against libraries 2026.8.23.1 + PyAutoLens main: - `should_simulate('dataset/point_source/simple')` returns True and deletes the directory under the cap; returns False and leaves it intact with the cap unset. - `PointSolver.solve` returns [(1.0, 0.0), (0.0, 1.0)] at einstein_radius 1.0, 1.6 and 2.5 alike. - All four runnable parity scripts pass under the correct profile with the guards in place (point.py pins exact at -83.38049778 / -82.33883111). - With `PYAUTO_SMALL_DATASETS=1`, point.py now fails on the guard and leaves the dataset untouched. A corrected sweep of every allowlisted dataset against every `should_simulate` call site in this workspace now reports no at-risk sites. Refs PyAutoLens#710, PyAutoArray#470 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJSb9kydhAgMgCCKh26ai2
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.
Workspace leg of PyAutoLabs/PyAutoLens#710. Library-first merge gate: PyAutoLabs/PyAutoLens#711 must merge before this one.
What this fixes
Follows #264, which found that
should_simulatermtrees the committed, gitignore-allowlisted, JSON-onlydataset/point_source/simplewheneverPYAUTO_SMALL_DATASETS=1is in force — and that noSMALLDATstamp exists on JSON data for PyAutoArray#471's library guard to read. Two gaps remained after it.1. That sweep missed a site.
point_source/visualization/modeling_visualization_jit.pydeclaredENV: real_output— a marker that does not release the cap — while its own__Env__prose claimed "full-resolution data". It callsshould_simulateon the committed dataset, making it the same defect #264 fixed next door invisualization.py.2. The parity scripts had no defence of their own. Five scripts pin absolute likelihood literals against this dataset and would happily compare them to capped-regime output. Under the cap
PointSolver.solveshort-circuits to a position pair identical for every lens model, so the comparison measures nothing. That is how it presented: an assert failing with a different value on every run — once the-1e99sentinel, once a finite-but-wrong16.131221.Scripts Changed
point_source/visualization/modeling_visualization_jit.pyENV: real_output→ENV: full_datasets real_output, prose correctedpoint_source/jax_likelihood/point.pypoint_source/jax_likelihood/image_plane.pypoint_source/jax_likelihood/source_plane.pypoint_source/jax_likelihood/fluxes_time_delays.pydataset_file.exists()bootstrap — it cannot delete, but it does read what a sibling poisoned)point_source/jax_grad/gradient.pyThe guard follows the
interferometer/nufft.pyprecedent. Two deliberate choices:nufft.pycan assert its mask shape because it owns a FITS dataset with detectable capped geometry. A JSON dataset has no capped shape to detect.should_simulatecall is what destroys the data, so a misconfigured run now fails naming the cause instead of first destroying what the next run depends on.Evidence
Measured in-session against libraries
2026.8.23.1+ PyAutoLens#711:should_simulate('dataset/point_source/simple'), cap onTrue— directory deleted, all 3 tracked JSON files goneFalse— intactPointSolver.solveateinstein_radius1.0 / 1.6 / 2.5 under cap[(1.0, 0.0), (0.0, 1.0)]point.pyunder the correct profile-83.38049778and-82.33883111, both pins exactimage_plane.py,source_plane.py,fluxes_time_delays.pypoint.pywithPYAUTO_SMALL_DATASETS=1So the originally reported failure is fully explained and no library numerical bug exists — the script passes on current
mainwith an intact dataset.Corrected sweep
Re-ran #264's audit — every
!dataset/**allowlisted directory against everyshould_simulatecall site whoseENV:lacksfull_datasets. No at-risk sites remain in this workspace.Two limits on that, stated plainly: it covers this repo only, so #264's "every workspace in the organism" claim is still unverified elsewhere; and
full_datasets real_outputis a marker combination that did not previously exist (every existing combo pairsfull_datasetswithreal_plots). The derivation lives in PyAutoHands, so the smoke run is what confirms the harness accepts it.Generated by Claude Code