Skip to content

fix: make the PointSolver SMALL_DATASETS short-circuit announce itself - #711

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/point-source-dataset-cap-guard
Aug 23, 2026
Merged

fix: make the PointSolver SMALL_DATASETS short-circuit announce itself#711
Jammy2211 merged 1 commit into
mainfrom
feature/point-source-dataset-cap-guard

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Closes #710 (library leg). The workspace leg is PyAutoLabs/autolens_workspace_test#265 and must merge after this one.

What this fixes

Under PYAUTO_SMALL_DATASETS=1, PointSolver.solve skips the triangle-tiling solve and returns the fixed pair [(1.0, 0.0), (0.0, 1.0)]. That is intentional — the solve dominates smoke-run cost and is meaningless on downsized grids — but it was completely silent, and the pair is identical for every lens model.

Anything derived from those positions is therefore model-independent, so a parity script comparing such a value against a pinned literal is measuring nothing. That is exactly how it surfaced: autolens_workspace_test's point_source/jax_likelihood/point.py produced a different wrong value on every run — once the -1e99 sentinel, once a finite-but-wrong 16.131221 — and cost a full investigation before the cause was found.

The change

The short-circuit now emits one logger.warning per process, latched at module level rather than per instance (a vmap batch calls solve once per sampled parameter set, and the condition is about the process environment, not any one solver).

Warn rather than raise on purpose: every smoke script that legitimately relies on the speedup keeps working, and only the silence goes away.

Evidence

Measured in-session against libraries 2026.8.23.1 + this branch:

Check Result
solve() at einstein_radius 1.0 / 1.6 / 2.5 under the cap identical [(1.0, 0.0), (0.0, 1.0)]
log output at DEBUG, warnings forced to always, before this change nothing at all

API Changes

None. No signature, return type or default changes — the short-circuit returns exactly what it returned before. The only new behaviour is one WARNING log record per process on the autolens.point.solver.point_solver logger.

Tests

Three added to test_autolens/weak/test_simulator_small_datasets.py, covering each property independently:

  • the returned pair is model-independent across three Einstein radii
  • the warning fires exactly once across repeated solve calls
  • nothing is emitted when the flag is unset
test_autolens/weak/test_simulator_small_datasets.py  6 passed
test_autolens/                                     541 passed

Generated by Claude Code

Under `PYAUTO_SMALL_DATASETS=1`, `PointSolver.solve` skips the triangle-tiling
solve and returns the fixed pair `[(1.0, 0.0), (0.0, 1.0)]`. That is intentional
— the solve is the dominant cost in smoke runs and is meaningless on downsized
grids — but it was completely silent, and the returned pair is identical for
every lens model. Verified here at einstein_radius 1.0 / 1.6 / 2.5: same two
coordinates, no log line even at DEBUG with warnings forced on.

Anything derived from those positions is therefore model-independent, so a
parity script comparing such a value against a pinned literal is measuring
nothing. That is exactly how it failed: `autolens_workspace_test`'s
`point_source/jax_likelihood/point.py` produced a different wrong value on every
run and cost a full investigation before the cause was found (#710).

The short-circuit now emits one `logger.warning` per process — latched at module
level rather than per instance, because a vmap batch calls `solve` once per
sampled parameter set and the condition is about the process environment. Warn
rather than raise: every smoke script that legitimately relies on the speedup
keeps working, and only the silence goes away.

Tests cover all three properties: the pair is model-independent, the warning
fires exactly once across repeated calls, and nothing is emitted when the flag
is unset.

Refs #710

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JJSb9kydhAgMgCCKh26ai2
@Jammy2211
Jammy2211 merged commit 27126fb into main Aug 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: guard point-source parity scripts against the SMALL_DATASETS cap

2 participants