Repository navigation
feat: COOLEST standard interop — profile converters + template import/export #612
Description
Activity
Library PRs Created
- PyAutoGalaxy: feat: COOLEST-standard profile parameter converters (autogalaxy.interop.coolest) PyAutoGalaxy#501 —
autogalaxy.interop.coolestparameter converters (dependency-free, dict-in/dict-out; Sersic/SIE/PEMD/NFW/shear/sheet; sqrt(q) and angle conventions derived + numerically certified). 982 tests passed. - PyAutoLens: feat: COOLEST template import/export (autolens.interop.coolest) #613 —
autolens.interop.coolest.to_coolest/from_coolestCOOLEST JSON template I/O (coolestoptional extra; NFW sigma_crit from cosmology; Einstein-radius definition documented). 385 tests passed. Merge the PyAutoGalaxy PR first.
Heart was RED on 6 pre-existing, unrelated reasons at ship time; shipped through on explicit user acknowledgement (commit/push/PR-open only).
API changes: Added only (new
ag.interop/al.interopnamespaces +coolestextra) — no workspace script is affected (grep confirms nointeropusage).Next:
- Merge both PRs (library-first), then a minimal
autolens_workspaceCOOLEST guide +autolens_workspace_testround-trip script as a follow-up PR (Phase C). - Follow-up task (filed, starts after this merges):
PowerLawIntermediateprofile + herculens EPL cross-code parity via a shared COOLEST file —PyAutoMind/draft/feature/autolens/coolest_powerlaw_herculens_parity.md.
- PyAutoGalaxy: feat: COOLEST-standard profile parameter converters (autogalaxy.interop.coolest) PyAutoGalaxy#501 —
- added a commit that references this issue
on Jul 17, 2026 Phase C Shipped — workspace PRs open
- autolens_workspace: feat: COOLEST export/import guide (guides/coolest_interop) autolens_workspace#283 —
guides/coolest_interop.pyexport/import guide (+ regenerated notebook/catalogue). Runs green end-to-end; round trip agrees to 8.9e-16. - autolens_workspace_test: feat: COOLEST interop round-trip validation script autolens_workspace_test#173 —
scripts/coolest_round_trip.pyvalidation script (all PASS).
Also merged this session: the library PRs PyAutoGalaxy#501 + PyAutoLens#613, and the corrective PyAutoLens#615 (the
coolestJSONSerializer rejects relative paths;to_coolest/from_coolestnow absolutize — found by running the guide, regression-tested).Note: the guide is named
coolest_interop.pybecause aguides/coolest.pyshadows thecoolestpackage (script dir is onsys.path).Remaining: merge the two workspace PRs (library-first gate satisfied — upstream MERGED), then issue the follow-up task
draft/feature/autolens/coolest_powerlaw_herculens_parity.md(PowerLawIntermediate + herculens parity).- autolens_workspace: feat: COOLEST export/import guide (guides/coolest_interop) autolens_workspace#283 —
Shipped — 2026-07-17
PRs (all MERGED)
- feat: COOLEST-standard profile parameter converters (autogalaxy.interop.coolest) PyAutoGalaxy#501
- feat: COOLEST template import/export (autolens.interop.coolest) #613
- fix: COOLEST interop rejects relative file paths #615 (corrective: relative template paths)
- feat: COOLEST export/import guide (guides/coolest_interop) autolens_workspace#283
- feat: COOLEST interop round-trip validation script autolens_workspace_test#173
Summary
COOLEST interop is live on all mains:
ag.interop.coolestparameter converters (derived + numerically certified √q/angle factors) andal.interop.coolest.to_coolest/from_coolestJSON template I/O, with a workspace guide and a workspace_test validation script (round trip to 8.9e-16). Conversion sits at the model I/O boundary; internal conventions unchanged.Session Notes
- A workspace script named
coolest.pyshadows thecoolestpackage — guide iscoolest_interop.py. notebooks/weak/*.ipynbare stale on autolens_workspace main (regeneration diffs them) — worth a separate sweep.- Validation against Sonnenfeld's golden-lens templates (euclid-sgs GitLab, auth) remains a human step via
from_coolest. - Next: follow-up task
draft/feature/autolens/coolest_powerlaw_herculens_parity.md—PowerLawIntermediateprofile + herculens EPL parity via a shared COOLEST file.
Overview
Preparation for modeling ~18,000 Euclid DR1 lenses: PyAutoLens results must be exchangeable with lenstronomy/herculens/Glee via the COOLEST standard (https://github.com/aymgal/COOLEST). This task adds a conversion layer at the model I/O boundary covering all profiles COOLEST defines — internals unchanged (sampling stays on (e1,e2); no internal convention flip), per the Slack consensus (Sonnenfeld, Galan). The intermediate-axis question is handled by a follow-up
PowerLawIntermediate+ herculens-parity task (PyAutoMind/draft/feature/autolens/coolest_powerlaw_herculens_parity.md).Plan
autogalaxy/interop/coolest/package — pure, dependency-free bidirectional parameter converters for every COOLEST-defined light/mass profile (ellipticity, angle, intermediate-axis radius conventions), reusingautogalaxy/convert.py.autolens/interop/coolest.py— COOLEST JSON template import/export of full lens models (analytic profile parameters only) via thecoolestpip package as an optional dependency.Detailed implementation plan
Affected Repositories
Branch Survey
Suggested branch:
feature/coolest-standard-supportWork classification: Library (workspace follow-up)
Worktree root:
~/Code/PyAutoLabs-wt/coolest-standard-support/Convention facts (verified against coolest.readthedocs.io)
autogalaxy/convert.py) → φ_coolest = angle_ag − 90° renormalizedell_comps—ell_comps_from/axis_ratio_and_angle_fromPowerLawuses the 2/(q^-½+q^½) rescale (profiles/mass/total/power_law.py) — per-profile factors derived and numerically certifiedshear_magnitude_and_angle_fromcoolestpip package (coolest.template)Implementation Steps
Phase A — PyAutoGalaxy
autogalaxy/interop/coolest/conventions.py— angle (+x ↔ East-of-North), (e1,e2) ↔ (q, PA), (y,x) ↔ (x,y) centre swap, per-profile radius-factor helpers. Reuseautogalaxy/convert.py; do not duplicate its math.light.py—ag.lp.Sersic↔ COOLESTSersic(effective-radius factor audited against ag's elliptical-radius definition); shapelets if supported by the installedcoolestversion.mass.py—ag.mp.Isothermal↔ SIE,ag.mp.PowerLaw↔ PEMD/EPL (θ_E intermediate-axis conversion),ag.mp.NFW↔ NFW,ag.mp.ExternalShear↔ ExternalShear,ag.mp.MassSheet↔ convergence sheet if defined.coolestimport in autogalaxy — zero new dependencies). Unsupported profiles raise a clear, named error (no silent skips).test_autogalaxy/interop/(numpy-only): per-profile round-trip identity + numerical certification — evaluate the ag profile and the profile reconstructed from its COOLEST parameters, assert equal convergence/deflections; for PowerLaw assert the analytic √q relation between θ_E definitions.Phase B — PyAutoLens
autolens/interop/coolest.py6.
to_coolest(galaxies_or_tracer, file_path)— export analytic profile parameters into a COOLEST JSON template (lensing entities from lens/source galaxies, redshifts fromGalaxy.redshift), via the Phase A registry. Lazycoolestimport with informative error;pip install autolens[coolest]extra; added to test/dev extras so CI exercises it.7.
from_coolest(file_path) -> Tracer— read a template, build ag/al profiles via the inverse mappings (built to consume Sonnenfeld's golden-lens JSONs).8. Einstein-radius definition documented in module docstring + template metadata.
9. Tests
test_autolens/interop/: full-model round-trip (PowerLaw + Shear lens, Sersic light + Sersic source), template written and re-read withcoolest.template, parameters equal to input; end-to-end convergence/deflection equality on a grid.Phase C — workspace follow-up PR (after library merge)
10. Minimal
autolens_workspace/scripts/guides/COOLEST example + autolens_workspace_test round-trip script.Key Files
PyAutoGalaxy/autogalaxy/convert.py— existing (e1,e2)/(q,PA)/shear converters to reusePyAutoGalaxy/autogalaxy/profiles/mass/total/power_law.py— the 2/(q^-½+q^½) Einstein-radius rescale to mapPyAutoGalaxy/autogalaxy/interop/coolest/{conventions,light,mass}.py— newPyAutoLens/autolens/interop/coolest.py— newtest_autogalaxy/interop/,test_autolens/interop/— new testsOriginal Prompt
Click to expand starting prompt
See
PyAutoMind/active/coolest_standard_support.md(filed from the COOLEST Slack thread with Alessandro Sonnenfeld and Aymeric Galan; original request verbatim inside).