fix: synthetic PositionsLH under skip_checks + test_mode#490
Merged
Conversation
…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]>
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
Workspace integration scripts using a chained
.positionsextraction (e.g.scripts/group/features/pixelization/slam.py:735-737) were failing under the smoke profile (PYAUTO_TEST_MODE=2 PYAUTO_SKIP_CHECKS=1) withAttributeError: 'NoneType' object has no attribute 'positions'. The cause wasResult.positions_likelihood_fromshort-circuiting toNonewhenskip_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 bothskip_checks()andis_test_mode()are active. Production semantics are preserved: withskip_checksalone (no test mode) the function still returnsNone.API Changes
autolens.analysis.result.Result.positions_likelihood_fromno longer returnsNoneunder the combinationPYAUTO_SKIP_CHECKS=1 + PYAUTO_TEST_MODE>0— it now returns a syntheticPositionsLHwithpositions=[(1.0, 0.0), (-1.0, 0.0)]andthreshold=minimum_threshold or 0.5. Behaviour is unchanged whenskip_checksalone is active (still returnsNone) 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 -xpasses (5 tests, including 2 new)autolens_workspace/scripts/group/features/pixelization/slam.pyruns end-to-end under the smoke profileFull API Changes (for automation & release notes)
Changed Behaviour
Result.positions_likelihood_from— underPYAUTO_SKIP_CHECKS=1 + PYAUTO_TEST_MODE>0, returns a syntheticPositionsLHinstead ofNone. Threshold defaults tominimum_thresholdor 0.5 when unset. Plane redshift is forwarded.Added (tests)
test__positions_likelihood_from__skip_checks_returns_none_outside_test_mode— confirms the production-pathNonereturn is unchanged.test__positions_likelihood_from__skip_checks_returns_synthetic_in_test_mode— confirms the new synthetic return under skip_checks + test_mode.Migration
.positionson 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