feat(light): add SersicMultipole and GaussianMultipole profiles#420
Merged
Conversation
Two new standalone elliptical multipole light profiles that perturb the eccentric radius by Fourier components at orders m=3 and m=4 before evaluating the underlying radial profile. With all multipole components set to zero (the default), each profile reduces exactly to its base class (Sersic, Gaussian), verified by machine-precision parity tests. The parameter API uses multipole_3_comps=(c, s) and multipole_4_comps=(c, s) tuples, matching the (k_m, phi_m) convention of EllipseMultipole and PowerLawMultipole. xp=np is threaded end-to-end through perturbed_radii_from, image_2d_via_radii_from, and image_2d_from for JAX support; JAX parity will be exercised in autogalaxy_workspace_test after this PR merges. Closes #418. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…e autosummary Adds the two new classes introduced in this PR to docs/api/light.rst so they appear in the Sphinx autosummary table under the Standard [ag.lp] section. 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
Adds two standalone elliptical multipole light profiles,
SersicMultipoleandGaussianMultipole, that perturb the eccentric radius by Fourier components at orders m=3 and m=4 before evaluating the underlying radial profile. With all multipole components set to zero (the default), each profile reduces exactly to its base class — confirmed by machine-precision parity tests againstSersicandGaussian.The parameter API uses
multipole_3_comps=(c, s)andmultipole_4_comps=(c, s)tuples, matching the(k_m, phi_m)convention used byEllipseMultipoleandPowerLawMultipole.xp=npis threaded end-to-end for JAX support; JAX parity will be exercised inautogalaxy_workspace_testafter this PR lands.Workspace priors + a modeling example follow in a separate workspace PR. The future generalisation (multipole as a standalone wrapper around any radial profile, unified with the ellipse-fitting API) is deferred to a
z_featurestracker — explicitly out of scope here.Closes #418.
API Changes
Two new public classes added to the
ag.lpnamespace:ag.lp.SersicMultipole— Sersic with m=3 and m=4 Fourier perturbations on the eccentric radiusag.lp.GaussianMultipole— Gaussian with m=3 and m=4 Fourier perturbations on the eccentric radiusBoth default to no perturbation (numerical parity with
ag.lp.Sersic/ag.lp.Gaussian), so this is a pure additive change — no existing scripts break.See full details below.
Test Plan
python -m pytest test_autogalaxy/profiles/light/standard/test_multipole.py— 12 new tests pass (zero-perturbation parity for Sersic/Gaussian, m=3 and m=4 rotational symmetry on circular base, centre translation, nonzero-multipole diff, finiteness + non-negativity under large perturbation)python -m pytest test_autogalaxy/— 885 tests pass, no regressionsag.lp.SersicMultipole()andag.lp.GaussianMultipole()resolve via the standardag.lp.*namespaceFull API Changes (for automation & release notes)
Added
ag.lp.SersicMultipole(centre, ell_comps, intensity, effective_radius, sersic_index, multipole_3_comps=(0.0, 0.0), multipole_4_comps=(0.0, 0.0))— elliptical Sersic with m=3 and m=4 Fourier perturbations on the eccentric radius. Inherits fromag.lp.Sersic, soisinstance(profile, ag.lp.Sersic)remains true.ag.lp.GaussianMultipole(centre, ell_comps, intensity, sigma, multipole_3_comps=(0.0, 0.0), multipole_4_comps=(0.0, 0.0))— elliptical Gaussian with m=3 and m=4 Fourier perturbations on the eccentric radius. Inherits fromag.lp.Gaussian.SersicMultipole.perturbed_radii_from(grid, xp=np, **kwargs)andGaussianMultipole.perturbed_radii_from(grid, xp=np, **kwargs)— returns the eccentric radii ofgridperturbed by the m=3 and m=4 Fourier multipoles as a raw backend array (numpy or jax.numpy), floored at 1e-8.autogalaxy.profiles.light.standard.multipole._LightProfileMultipoleMixin— internal mixin providing the sharedperturbed_radii_fromhelper. Leading underscore signals "do not import elsewhere"; intended to be replaced by the future wrapper-style multipole abstraction.Removed
Renamed
Changed Signature
Changed Behaviour
ag.lp.Sersic/ag.lp.Gaussianbehaviour is unchanged.Migration
No migration required. Users wanting m=3/m=4 perturbed profiles switch their model composition from
ag.lp.Sersic/ag.lp.Gaussianto the newag.lp.SersicMultipole/ag.lp.GaussianMultipoleand add the desired multipole components:🤖 Generated with Claude Code