Skip to content

fix: synthetic PositionsLH under skip_checks + test_mode#490

Merged
Jammy2211 merged 1 commit intomainfrom
feature/group-pixelization-delaunay-fixes
May 1, 2026
Merged

fix: synthetic PositionsLH under skip_checks + test_mode#490
Jammy2211 merged 1 commit intomainfrom
feature/group-pixelization-delaunay-fixes

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

Workspace integration scripts using a chained .positions extraction (e.g. scripts/group/features/pixelization/slam.py:735-737) were failing under the smoke profile (PYAUTO_TEST_MODE=2 PYAUTO_SKIP_CHECKS=1) with AttributeError: 'NoneType' object has no attribute 'positions'. The cause was Result.positions_likelihood_from short-circuiting to None when skip_checks() is true, instead of falling through to the existing test-mode synthetic-positions safeguard.

This change makes the function return a usable PositionsLH (built from the same [(1.0, 0.0), (-1.0, 0.0)] synthetic fallback already used elsewhere in the function) when both skip_checks() and is_test_mode() are active. Production semantics are preserved: with skip_checks alone (no test mode) the function still returns None.

API Changes

autolens.analysis.result.Result.positions_likelihood_from no longer returns None under the combination PYAUTO_SKIP_CHECKS=1 + PYAUTO_TEST_MODE>0 — it now returns a synthetic PositionsLH with positions=[(1.0, 0.0), (-1.0, 0.0)] and threshold=minimum_threshold or 0.5. Behaviour is unchanged when skip_checks alone is active (still returns None) and when neither flag is active (full multiple-image-position computation as before).

See full details below.

Test Plan

  • python -m pytest test_autolens/analysis/test_result.py -k positions_likelihood_from -x passes (5 tests, including 2 new)
  • autolens_workspace/scripts/group/features/pixelization/slam.py runs end-to-end under the smoke profile
Full API Changes (for automation & release notes)

Changed Behaviour

  • Result.positions_likelihood_from — under PYAUTO_SKIP_CHECKS=1 + PYAUTO_TEST_MODE>0, returns a synthetic PositionsLH instead of None. Threshold defaults to minimum_threshold or 0.5 when unset. Plane redshift is forwarded.

Added (tests)

  • test__positions_likelihood_from__skip_checks_returns_none_outside_test_mode — confirms the production-path None return is unchanged.
  • test__positions_likelihood_from__skip_checks_returns_synthetic_in_test_mode — confirms the new synthetic return under skip_checks + test_mode.

Migration

  • No migration needed. Workspace scripts that chain .positions on the return value (e.g. result.positions_likelihood_from(...).positions) now work end-to-end under the smoke profile without per-script guards.

🤖 Generated with Claude Code

…r skip_checks + test_mode

Previously `positions_likelihood_from` returned `None` when `PYAUTO_SKIP_CHECKS=1`,
breaking workspace scripts that chain `.positions` (e.g. group/features/pixelization/slam.py)
under the smoke profile. The function now returns a `PositionsLH` built from the synthetic
fallback pair `[(1.0, 0.0), (-1.0, 0.0)]` (with threshold = `minimum_threshold` or 0.5)
when both `skip_checks()` and `is_test_mode()` are active. Production semantics for
`skip_checks` alone are preserved — it still returns `None`.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label May 1, 2026
@Jammy2211 Jammy2211 merged commit 5c972c9 into main May 1, 2026
5 checks passed
@Jammy2211 Jammy2211 deleted the feature/group-pixelization-delaunay-fixes branch May 1, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant