Skip to content

fix(mass): wire convergence_func on dPIE family for MGE decomposition#466

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/dpie-convergence-func
May 28, 2026
Merged

fix(mass): wire convergence_func on dPIE family for MGE decomposition#466
Jammy2211 merged 1 commit into
mainfrom
feature/dpie-convergence-func

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

Restores cluster-scale workspace scripts that build al.mp.dPIEMassSph profiles. C3 cluster of the 2026-05-28 release-prep triage (3 scripts in autolens_workspace/scripts/cluster/).

dPIEMass / dPIEMassSph / dPIEPotential / dPIEPotentialSph override convergence_2d_from via a private _convergence(radii, xp=np) radial helper but never override the abstract convergence_func(grid_radius, xp=np) hook. MGEDecomposer.decompose_convergence_via_mge (mge.py:274) walks the convergence radially during MGE potential decomposition and calls convergence_func, which fell through to the abstract base and raised NotImplementedError.

Add 3-line shims on each base class that delegate to the existing _convergence helper. Spherical variants inherit the override. _convergence is already broadcast-safe and is the same code path convergence_2d_from already uses.

Test plan

  • pytest test_autogalaxy/profiles/mass/total/test_dual_pseudo_isothermal_{mass,potential}.py -v — both files pass including 2 new test__convergence_func__matches_private_helper cases (scalar + array, asserts equality with _convergence, plus a Sph inheritance check).
  • pytest test_autogalaxy/profiles/mass -q — 408/408 mass-profile tests pass.
  • autolens_workspace/scripts/cluster/simulator.py no longer hits NotImplementedError in convergence_func (runs through to real cluster simulation; the previous fast-fail at 9.14s gave way to genuine model-fitting work).
  • Reviewer to confirm the shim signature matches existing override patterns in sersic.py:208, nfw.py:169, etc.

Follow-up

A wider audit during planning surfaced 6-12 more mass profile classes with the same latent convergence_func gap:

  • PowerLawBroken + PowerLawBrokenSph
  • PowerLawMultipole
  • cNFW family (8+ classes)
  • DevVaucouleurs, Exponential, GaussianGradient

None are in current triage failures, but each is a landmine for any future workspace that exercises them via MGE potential decomposition or Einstein-radius integration. A separate fix(mass): audit convergence_func coverage across all mass profiles issue/PR will sweep them.

🤖 Generated with Claude Code

dPIEMass / dPIEMassSph / dPIEPotential / dPIEPotentialSph override
convergence_2d_from via a private `_convergence(radii, xp=np)` radial
helper but never override the abstract `convergence_func(grid_radius,
xp=np)` hook. `MGEDecomposer.decompose_convergence_via_mge` (mge.py:274)
walks the convergence radially during MGE potential decomposition and
calls `convergence_func`, which fell through to the abstract base and
raised `NotImplementedError`. This broke every cluster-scale workspace
script (simulator, start_here, modeling) that builds an
`al.mp.dPIEMassSph` mass profile.

Add 3-line `convergence_func` shims on `dPIEMass` and `dPIEPotential`
that delegate to the existing `_convergence` helper. Spherical variants
inherit the override. The shim is broadcast-safe — `_convergence` is the
same code path `convergence_2d_from` already uses to evaluate convergence
on grid radii.

Verified locally:
- 408/408 mass-profile unit tests pass + 2 new `test__convergence_func`
  regression cases (one per base class, scalar + array, asserts
  equality with `_convergence`).
- `autolens_workspace/scripts/cluster/simulator.py` runs past the
  `NotImplementedError` point — the script now does real cluster
  simulation rather than fast-failing in MGE.

Follow-up: PowerLawBroken family, PowerLawMultipole, cNFW family,
DevVaucouleurs, Exponential, GaussianGradient have the same latent
gap (no `convergence_func` override). Not in current triage failures
but landmines for any future workspace that uses them with MGE
potential decomposition or Einstein-radius integration. Tracked
in a separate audit issue.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Jammy2211 Jammy2211 merged commit d4d3cc6 into main May 28, 2026
5 of 6 checks passed
@Jammy2211 Jammy2211 deleted the feature/dpie-convergence-func branch May 28, 2026 19:15
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