test: flip subhalo.py polarity to JAX regression check (#498)#81
Merged
test: flip subhalo.py polarity to JAX regression check (#498)#81
Conversation
Issue #498 (free subhalo redshift TracerBoolConversionError) is now fixed in PyAutoLens main via PR #499 (merge commit b790632). Update the integration-test reproducer to be the regression check: - Both Scenario A (fixed z=0.55) and Scenario B (free UniformPrior) must now produce a finite log_likelihood matching NumPy within rtol=1e-4. - Add an np.testing.assert_allclose regression literal at -1.412105e+09 on the vmap output (matches the reference value at the prior median z_subhalo=0.55, which both scenarios resolve to). - Drop the REPRODUCED / UNEXPECTED branching — the script now exits zero only when the bug stays fixed. - Update the docstring to describe the script as a regression check rather than a reproducer. A future regression of #498 — either a TracerBoolConversionError on Scenario B's vmap, or numerical drift away from the reference value — will trip this script in run_all_scripts.sh.
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
Issue #498 (free subhalo redshift
TracerBoolConversionErrorunder JAX, reported by @qiuhan96) is now fixed in PyAutoLensmainvia PR #499 (merge commitb790632). This PR converts the integration-test reproducer that landed in autolens_workspace_test#79 into the permanent JAX regression check for that fix.Both scenarios in
subhalo.pynow must PASS:redshift_subhalo=0.55. Exercises the unchanged numpy fast-path intracer_util.redshift_subhalo=af.UniformPrior(0.2, 0.9). Exercises the JAX partition-and-trust-input-order path introduced by PyAutoLens #499.Both must produce a finite
log_likelihoodmatching the NumPy path withinrtol=1e-4. The vmap output is locked to the reference literal-1.412105e+09vianp.testing.assert_allclose, mirroring the regression style established inlp.py:199-204.A future regression of #498 — either Scenario B raising
TracerBoolConversionErroragain, or numerical drift away from the reference value — will trip this script inrun_all_scripts.sh.Scripts Changed
scripts/jax_likelihood_functions/imaging/subhalo.py— flipped polarity from "expected to raise" to "expected to pass". Addednp.testing.assert_allclose(result, -1.412105e+09, rtol=1e-4)regression literal on the vmap output. Removed theREPRODUCED/UNEXPECTEDbranching and the diagnostictry/exceptwrappers around_vmap/jax.jit. Updated the top docstring to describe the script as a JAX regression check rather than a bug reproducer.Upstream PR
PyAutoLabs/PyAutoLens#499 (merged
b790632)Test Plan
python scripts/jax_likelihood_functions/imaging/subhalo.py— both scenarios PASS, vmap matches-1.412105e+09, JIT log-likelihood matches NumPy at-3.523166e+05withinrtol=1e-4autolens_workspace_test(11/11) passed with the patched library on PYTHONPATH (run during the parent/ship_libraryfor #499)🤖 Generated with Claude Code