Skip to content

fix: make the dPIEMass ellipticity→ell_comps conversion JAX-tracer safe - #527

Merged
Jammy2211 merged 1 commit into
mainfrom
claude/nightly-build-release-failure-qqru5o
Jul 26, 2026
Merged

fix: make the dPIEMass ellipticity→ell_comps conversion JAX-tracer safe#527
Jammy2211 merged 1 commit into
mainfrom
claude/nightly-build-release-failure-qqru5o

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

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__ (and dPIEMassB0.from_lenstool) converted the Lenstool ellipticity/angle_pos parameterization to ell_comps via 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. The new autolens_workspace group/features/group_halo/modeling.py (merged Sat 2026-07-25 evening) is the first script to fit dPIEMass with free ellipticity priors, so last night's Stage 3 run was the first to hit it. The PR smoke gate never sees this because PYAUTO_TEST_MODE=2 bypasses the sampler.

The fix

Constructors carry no xp threading (their signatures are the model-composition contract — adding an xp argument 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 as is_jax in gnfw_virial_mass_conc.py — and threaded through the sqrt and convert.ell_comps_from calls in both dPIEMass.__init__ and dPIEMassB0.from_lenstool. The branch depends only on the Python type of the value, never a traced value, and returns np unless a JAX array/tracer actually arrives, so the NumPy path is unchanged.

Verification

  • scripts/group/features/group_halo/modeling.py now runs end-to-end under the exact profile_release.yaml environment (PYAUTO_TEST_MODE=1, real Nautilus under JAX): both fits complete, Δ log Z = +35.8, exit 0. Previously reproduced the exact TracerArrayConversionError at dual_pseudo_isothermal_mass.py:1189.
  • Every other script touching dPIEMass/from_lenstool passes 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, and autolens_workspace_test cluster/lenstool_parity.py + misc/mass/total.py (real mode — numerical parity vs the Lenstool reference is unaffected).
  • Full 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

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
@Jammy2211
Jammy2211 merged commit 11757fd into main Jul 26, 2026
5 checks passed
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.

2 participants