Repository navigation
feat: PowerLawIntermediate profile + herculens power-law parity via COOLEST #616
Copy link
Copy link
Closed
Description
Overview
Follow-up to #612 (COOLEST interop, merged). Adds ag.mp.PowerLawIntermediate — an elliptical power-law whose einstein_radius parameter is the COOLEST intermediate-axis θ_E — making the COOLEST mapping for it an identity (no √q factors), i.e. a direct parameter-level link to herculens/lenstronomy's power-law. A herculens cross-code parity script then proves the link empirically: the same COOLEST template produces numerically matching convergence and deflections in both codes.
Plan
- PyAutoGalaxy: behavior-preserving
einstein_radius_major_from(xp)hook in the power-law implementation, thenPowerLawIntermediate(PowerLaw)overriding it with the certified conversion θ_ag = θ_int/√q · ((1+q)/2)^(1/(γ−1)). Exported asag.mp.PowerLawIntermediatewith a priors-config block. - COOLEST layer:
PowerLawIntermediate → PEMDidentity mapping;intermediate=Trueimport option (threaded throughal.interop.coolest.from_coolest) to rebuild PEMDs asPowerLawIntermediate. - Tests: PowerLawIntermediate ≡ PowerLaw equivalence under the θ rescale (parametrized over q, γ); COOLEST identity + analytic certification; round trip.
- autolens_workspace_test:
scripts/coolest_herculens_parity.py— export aPowerLawIntermediatemodel to a COOLEST template, load it into herculens, assert matching convergence/deflections on a shared grid (herculens installed in the env only, never a library dependency).
Detailed implementation plan
Affected Repositories
- PyAutoGalaxy (primary implementation)
- PyAutoLens (
from_coolestintermediate kwarg) - autolens_workspace_test (parity script)
Branch
feature/coolest-powerlaw-herculens, worktree ~/Code/PyAutoLabs-wt/coolest-powerlaw-herculens/
Implementation Steps
autogalaxy/profiles/mass/total/power_law_core.py: addPowerLawCore.einstein_radius_major_from(self, xp)returningself.einstein_radius; use it ineinstein_radius_rescaledand inPowerLaw.deflections_yx_2d_from's Einstein-radius line. Numerically unchanged for all existing profiles (full suite is the regression net).power_law.py:PowerLawIntermediate(PowerLaw)— same constructor; overrides the hook with the xp-threaded conversion (JAX-safe viaself.axis_ratio(xp)); docstring documents the convention and factor.- Namespace exports (
profiles/mass/total/__init__.py,profiles/mass/__init__.py) +PowerLawIntermediate:block inconfig/priors/mass/total/power_law.yaml. autogalaxy/interop/coolest/mass.py: registerPowerLawIntermediate → PEMD(identity θ_E);mass_profile_from(..., intermediate=True)buildsPowerLawIntermediate; threadintermediatethroughautolens/interop/coolest.py::from_coolest.- Tests in
test_autogalaxy/profiles/mass/total/+test_autogalaxy/interop/+test_autolens/interop/(numpy-only). - Workspace leg: pip install herculens (dry-run first;
--no-depsfallback if it moves the pinned jax 0.10.2),scripts/coolest_herculens_parity.pycomparing convergence + deflections from the same COOLEST template; settles empirically whether herculens EPL θ_E is lenstronomy-convention (identity) or carries the SPEMD √((1+q²)/(2q)) factor.
Key Files
PyAutoGalaxy/autogalaxy/profiles/mass/total/{power_law,power_law_core}.pyPyAutoGalaxy/autogalaxy/interop/coolest/mass.py,PyAutoGalaxy/autogalaxy/config/priors/mass/total/power_law.yamlPyAutoLens/autolens/interop/coolest.pyautolens_workspace_test/scripts/coolest_herculens_parity.py(new)
Original Prompt
Click to expand starting prompt
See PyAutoMind/active/coolest_powerlaw_herculens_parity.md.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
Jammy2211 commentedon Jul 17, 2026
All three PRs open — parity PROVEN
ag.mp.PowerLawIntermediate(988 tests passed)from_coolest(intermediate=True)(387 tests passed)Key empirical result: herculens 0.3.0's
EPLtheta_Eis exactly the COOLEST intermediate-axis convention (probe ratio 1.0 to machine precision — the SPEMDsqrt((1+q²)/(2q))factor does not apply to EPL). The direct link therefore holds with identity parameters: the same COOLEST template produces matching convergence AND deflection angles in herculens and PyAutoLens (rtol 1e-8 / 1e-6), including the spherical limit.Shipped through Heart RED (5 pre-existing unrelated reasons) on user ack. Merge order: PyAutoGalaxy#503 → PyAutoLens#617 → awst#175.
Jammy2211 commentedon Jul 17, 2026
Shipped — 2026-07-17
PRs (all MERGED, in order)
Summary
ag.mp.PowerLawIntermediateis live: a power-law whoseeinstein_radiusis the COOLEST intermediate-axis θ_E, with an identity PEMD mapping andfrom_coolest(intermediate=True). The parity script proves the direct link to herculens's EPL — same COOLEST template, matching convergence and deflections in both codes, identity parameters throughout (herculens EPL θ_E confirmed to be the COOLEST convention exactly).This completes the COOLEST arc from the original Slack thread (#612 + #616).