fix(mass): wire convergence_func on dPIE family for MGE decomposition#466
Merged
Conversation
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>
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
Restores cluster-scale workspace scripts that build
al.mp.dPIEMassSphprofiles. C3 cluster of the 2026-05-28 release-prep triage (3 scripts inautolens_workspace/scripts/cluster/).dPIEMass/dPIEMassSph/dPIEPotential/dPIEPotentialSphoverrideconvergence_2d_fromvia a private_convergence(radii, xp=np)radial helper but never override the abstractconvergence_func(grid_radius, xp=np)hook.MGEDecomposer.decompose_convergence_via_mge(mge.py:274) walks the convergence radially during MGE potential decomposition and callsconvergence_func, which fell through to the abstract base and raisedNotImplementedError.Add 3-line shims on each base class that delegate to the existing
_convergencehelper. Spherical variants inherit the override._convergenceis already broadcast-safe and is the same code pathconvergence_2d_fromalready uses.Test plan
pytest test_autogalaxy/profiles/mass/total/test_dual_pseudo_isothermal_{mass,potential}.py -v— both files pass including 2 newtest__convergence_func__matches_private_helpercases (scalar + array, asserts equality with_convergence, plus aSphinheritance check).pytest test_autogalaxy/profiles/mass -q— 408/408 mass-profile tests pass.autolens_workspace/scripts/cluster/simulator.pyno longer hitsNotImplementedErrorinconvergence_func(runs through to real cluster simulation; the previous fast-fail at 9.14s gave way to genuine model-fitting work).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_funcgap:PowerLawBroken+PowerLawBrokenSphPowerLawMultipolecNFWfamily (8+ classes)DevVaucouleurs,Exponential,GaussianGradientNone 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 profilesissue/PR will sweep them.🤖 Generated with Claude Code