feat: PowerLawIntermediate — intermediate-axis (COOLEST) Einstein radius power-law#503
Merged
Merged
Conversation
New elliptical power-law whose einstein_radius parameter follows the intermediate-axis convention of COOLEST/lenstronomy/herculens (theta_int = sqrt(q) (2/(1+q))^(1/(gamma-1)) theta_PL), giving an identity COOLEST PEMD mapping. Implemented via a behavior-preserving einstein_radius_major_from(xp) hook in PowerLawCore/PowerLaw (all existing profiles numerically unchanged; full suite green), a thin xp-threaded override, ag.mp export, and a priors-config block. mass_profile_from gains intermediate=True to rebuild PEMDs as PowerLawIntermediate. Part of PyAutoLabs/PyAutoLens#616. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 17, 2026
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
ag.mp.PowerLawIntermediate(PyAutoLens#616, follow-up to the COOLEST interop #612): an elliptical power-law identical in mass distribution toPowerLaw, but whoseeinstein_radiusis the intermediate-axis Einstein radius used by COOLEST/lenstronomy/herculens —theta_int = sqrt(q)·(2/(1+q))^(1/(gamma−1))·theta_PL. Its COOLESTPEMDmapping is therefore an identity (no √q factors), giving direct parameter-level exchange with other lens modeling codes.Implementation is a behavior-preserving hook:
PowerLawCore.einstein_radius_major_from(xp)(returnseinstein_radiusfor all existing profiles) now feedseinstein_radius_rescaledandPowerLaw.deflections_yx_2d_from; the new class overrides only that hook with the xp-threaded conversion (JAX-traceable like its parent). Also:ag.mpexport,PowerLawIntermediate:priors block inconfig/priors/mass/total/power_law.yaml(verified viaaf.Model(...)), andinterop.coolest.mass_profile_from(..., intermediate=True)to rebuild PEMDs in this parameterisation.API Changes
Added only —
ag.mp.PowerLawIntermediate, theeinstein_radius_major_fromhook (identity for existing profiles), and an optionalintermediatekwarg oninterop.coolest.mass_profile_from. No existing symbol's behaviour changes (full suite is the regression net).See full details below.
Test Plan
test_autogalaxy/profiles/mass/total/test_power_law_intermediate.py: PowerLawIntermediate ≡ PowerLaw convergence/deflections/potential under the θ rescale (parametrized over q, γ incl. isothermal); analytic COOLEST-form certification with identity θ_E; PowerLaw numeric pin proving the hook is a no-op.test_autogalaxy/interop/: COOLEST mapping identity +intermediate=Trueround trip + default-import equivalence.Full API Changes (for automation & release notes)
Added
ag.mp.PowerLawIntermediate(centre, ell_comps, einstein_radius, slope)— power-law with intermediate-axis (COOLEST) Einstein radiusPowerLawCore.einstein_radius_major_from(xp)— convention hook; returnseinstein_radiusfor all pre-existing profilesautogalaxy.interop.coolest.mass_profile_from(..., intermediate=False)— new optional kwarg;Truebuilds PEMD asPowerLawIntermediateconfig/priors/mass/total/power_law.yaml—PowerLawIntermediate:blockGenerated by the PyAutoLabs agent workflow.