Skip to content

test: flip subhalo.py polarity to JAX regression check (#498) - #81

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/subhalo-redshift-jax-regression
May 8, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/subhalo-redshift-jax-regression

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Issue #498 (free subhalo redshift TracerBoolConversionError under JAX, reported by @qiuhan96) is now fixed in PyAutoLens main via PR #499 (merge commit b790632). 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.py now must PASS:

  • Scenario A — fixed redshift_subhalo=0.55. Exercises the unchanged numpy fast-path in tracer_util.
  • Scenario B — 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_likelihood matching the NumPy path within rtol=1e-4. The vmap output is locked to the reference literal -1.412105e+09 via np.testing.assert_allclose, mirroring the regression style established in lp.py:199-204.

A future regression of #498 — either Scenario B raising TracerBoolConversionError again, or numerical drift away from the reference value — will trip this script in run_all_scripts.sh.

Scripts Changed

  • scripts/jax_likelihood_functions/imaging/subhalo.py — flipped polarity from "expected to raise" to "expected to pass". Added np.testing.assert_allclose(result, -1.412105e+09, rtol=1e-4) regression literal on the vmap output. Removed the REPRODUCED / UNEXPECTED branching and the diagnostic try/except wrappers 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+05 within rtol=1e-4
  • Smoke tests for autolens_workspace_test (11/11) passed with the patched library on PYTHONPATH (run during the parent /ship_library for #499)
  • CI smoke run picks up the new assertion polarity

🤖 Generated with Claude Code

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.
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label May 8, 2026
@Jammy2211
Jammy2211 merged commit 61b0b4f into main May 8, 2026
2 of 4 checks passed
@Jammy2211
Jammy2211 deleted the feature/subhalo-redshift-jax-regression branch May 8, 2026 12:38
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Oct 7, 2026
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.

1 participant