Skip to content

fix: PowerLawCore.convergence_2d_from drops xp (Isothermal not jit-traceable) - #633

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/isothermal-convergence-jit
Sep 27, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/isothermal-convergence-jit

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

PowerLawCore.convergence_2d_from called self.convergence_func(grid_radius=grid_eta) without forwarding xp, so Isothermal.axis_ratio fell back to np.minimum on JAX tracers and convergence_2d_from(..., xp=jnp) raised TracerArrayConversionError under jax.jit with traced ell_comps. This affects every PowerLawCore subclass that uses the shared method (Isothermal, PowerLaw, IsothermalCore, ...). The fix forwards xp=xp; it was the only convergence_func(...) call site that dropped it.

Closes #632

API Changes

None — internal. No public signatures change; the NumPy path is numerically unchanged.

Test Plan

  • New jax-free regression test test__convergence_2d_from__forwards_xp_to_convergence_func (spy xp into the undecorated method; asserts convergence_func receives it). Red on unfixed main (received numpy), green with the fix; jax is not imported by the test.
  • pytest test_autogalaxy/ — 1244 passed.
  • Scratch JAX witness: jax.jit over ell_comps gives [0.55477504 0.67082039], identical to NumPy; jax.grad w.r.t. e1 = -0.298 (finite, non-zero). Unfixed source raises TracerArrayConversionError.
  • Heart YELLOW (manifest drift x3, no release rehearsal) acknowledged by the human for this ship.

🤖 Generated with Claude Code

Dropping xp made Isothermal.axis_ratio use np.minimum on JAX tracers, so
convergence_2d_from could not be traced under jax.jit with traced
ell_comps (TracerArrayConversionError). Adds a jax-free regression test.

Closes #632

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Sep 27, 2026
@Jammy2211
Jammy2211 merged commit 152695e into main Sep 27, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/isothermal-convergence-jit branch September 27, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: PowerLawCore.convergence_2d_from drops xp (Isothermal not jit-traceable)

1 participant