Skip to content

test: CI JAX coverage for PointMass/SMBH profiles #251

Description

@Jammy2211

Overview

Follow-up to PyAutoLabs/PyAutoGalaxy#553 (fixed by PyAutoLabs/PyAutoGalaxy#554): al.mp.PointMass and al.mp.SMBH broke every JAX-mode fit, and nothing in CI exercised the JAX path for point-mass profiles, so the regression class was invisible. Add coverage for both bug shapes.

Plan

  • Add mp.PointMass and mp.SMBH to scripts/misc/profiles_jit.py (profile-level JIT: deflections_yx_2d_from + convergence_2d_from on Grid2DIrregular and Grid2D.uniform, three-step pattern) — catches the ArrayIrregular deflections bug shape.
  • New scripts/imaging/jax_likelihood/smbh.py — full-pipeline vmap+jit likelihood with lens = Isothermal + SMBH where mass is a free parameter (a free traced mass is the only way to exercise the SMBH.__init__ bug shape; profiles_jit.py instantiates with floats). Mirrors imaging/jax_likelihood/lp.py; added to smoke_tests.txt so the PR CI gate runs it.
  • Update scripts/CLAUDE.md coverage docs.
Detailed implementation plan

Affected Repositories

  • autolens_workspace_test (primary)

Branch Survey

Repository Current Branch Dirty?
./autolens_workspace_test main clean

Suggested branch: feature/pointmass-smbh-jax-ci
Worktree root: ~/Code/PyAutoLabs-wt/pointmass-smbh-jax-ci/
Work Classification: Workspace

Implementation Steps

  1. scripts/misc/profiles_jit.py — extend the mass-profile list with mp.PointMass(centre=(0.01, 0.02), einstein_radius=0.1) and mp.SMBH(centre=(0.01, 0.02), mass=1e10); both grids, all three JAX steps.
  2. scripts/imaging/jax_likelihood/smbh.py — mirror lp.py: auto-sim jax_test dataset, mask, model with lens Isothermal + SMBH (mass LogUniformPrior(1e8, 1e11), redshifts fixed 0.5/1.0) + Sersic source, Fitness + _vmap batch with hardcoded expected literal, Path A jax.jit(analysis.fit_from) round-trip vs numpy scalar. __Env__ section ENV: jax full_datasets.
  3. Generate the vmap literal by running locally under the CI env tokens; run lp.py first as a control to confirm the env reproduces its pinned literal (-1.34797827e09).
  4. Add imaging/jax_likelihood/smbh.py to smoke_tests.txt.
  5. Update scripts/CLAUDE.md (jax_likelihood table + profiles_jit profile list).

Key Files

  • scripts/misc/profiles_jit.py
  • scripts/imaging/jax_likelihood/smbh.py (new)
  • smoke_tests.txt
  • scripts/CLAUDE.md

Original Prompt

Click to expand starting prompt

Prompt file: PyAutoMind/test/autolens_workspace_test/pointmass_smbh_jax_ci_coverage.md

Maintainer instruction: "ok yes do a CI exercise in autolens_workspace_test with JAX on these profiles as a quick follow up"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions