fix: make the dPIEMass ellipticity→ell_comps conversion JAX-tracer safe - #527
Merged
Merged
Conversation
The dPIEMass constructor (and dPIEMassB0.from_lenstool) converted the Lenstool ellipticity/angle_pos parameterization to ell_comps with np.sqrt and an un-threaded convert.ell_comps_from. Under a real jitted model-fit those arguments arrive as JAX tracers (ellipticity and angle_pos are free parameters), and the np.* ops raise TracerArrayConversionError — which failed the new group/features/group_halo/modeling.py script in the nightly Stage 3 release-fidelity run (PyAutoHeart run 30189764840). The PR smoke gate never sees this because PYAUTO_TEST_MODE=2 bypasses the sampler. Constructors carry no xp threading, so infer the backend from the values (the gnfw_virial_mass_conc is_jax idiom) and thread it through the sqrt and ell_comps_from. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016uj1vtq2eV7kRg3r5C7fDb
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
Fixes the 2026-07-26 nightly release failure (PyAutoBrain nightly run → Stage 3 release-fidelity Heart run, job
run_scripts (3.12, autolens, group)).dPIEMass.__init__(anddPIEMassB0.from_lenstool) converted the Lenstoolellipticity/angle_posparameterization toell_compsvianp.sqrtand an un-threadedconvert.ell_comps_from. Under a real jitted model-fit those arguments arrive as JAX tracers —ellipticityandangle_posare free parameters — and thenp.*ops raiseTracerArrayConversionError. The newautolens_workspacegroup/features/group_halo/modeling.py(merged Sat 2026-07-25 evening) is the first script to fitdPIEMasswith free ellipticity priors, so last night's Stage 3 run was the first to hit it. The PR smoke gate never sees this becausePYAUTO_TEST_MODE=2bypasses the sampler.The fix
Constructors carry no
xpthreading (their signatures are the model-composition contract — adding anxpargument would surface as a bogus model parameter and break serialization), so the backend is inferred from the argument values via a small_xp_from(*values)helper — the same idiom asis_jaxingnfw_virial_mass_conc.py— and threaded through thesqrtandconvert.ell_comps_fromcalls in bothdPIEMass.__init__anddPIEMassB0.from_lenstool. The branch depends only on the Python type of the value, never a traced value, and returnsnpunless a JAX array/tracer actually arrives, so the NumPy path is unchanged.Verification
scripts/group/features/group_halo/modeling.pynow runs end-to-end under the exactprofile_release.yamlenvironment (PYAUTO_TEST_MODE=1, real Nautilus under JAX): both fits complete, Δ log Z = +35.8, exit 0. Previously reproduced the exactTracerArrayConversionErroratdual_pseudo_isothermal_mass.py:1189.dPIEMass/from_lenstoolpasses under its release-profile env:group/features/group_halo/simulator.py,cluster/mass_parameterizations{,_pyautolens}.py,cluster/lenstool/{data,modeling,parameterization_mapping}.py,cluster/csv_api.py,guides/profiles/{mass,light_and_mass_profiles}.py, andautolens_workspace_testcluster/lenstool_parity.py+misc/mass/total.py(real mode — numerical parity vs the Lenstool reference is unaffected).test_autogalaxy/suite: 996 passed, 1 skipped.Downstream impact
None expected: no public-API change, NumPy behaviour identical. PyAutoLens re-exports these profiles unchanged.
🤖 Generated with Claude Code
https://claude.ai/code/session_016uj1vtq2eV7kRg3r5C7fDb
Generated by Claude Code