Skip to content

Implement Einasto and Core Einasto profiles - #500

Merged
adrn merged 7 commits into
mainfrom
potential/einasto
Oct 17, 2026
Merged

adrn merged 7 commits into
mainfrom
potential/einasto

Conversation

@adrn

@adrn adrn commented Oct 23, 2025 •

Copy link
Copy Markdown
Owner

Describe your changes

Fixes #368.

The core einasto model is currently failing tests and I'm not sure where the bug is!

Checklist

  • Did you add tests?
  • Did you add documentation for your changes?
  • Did you reference any relevant issues?
  • Did you add a changelog entry? (see CHANGES.rst)
  • Are the CI tests passing?
  • Is the milestone set?

@adrn adrn modified the milestone: v1.11 Oct 23, 2025
adrn and others added 6 commits October 16, 2026 16:50
- Core Einasto enclosed mass had the wrong sign: gsl_sf_gamma_inc is the
  upper incomplete gamma, so differences of it gave -M(r)
- Einasto potential at r=0 included a spurious term
- Inside the core (r < r_c) the closed-form mass cancels catastrophically;
  integrate rho numerically with gsl_integration_qng there instead
- Einasto now shares the core-Einasto implementation with r_c = 0
- Compute scale^a Gamma(a) in log space to avoid overflow at small alpha
- Add Hessians for both potentials and remove unused helpers

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Add both potentials to CANONICAL (fixes test collection), enable Hessian
tests, compare Phi and dPhi/dr to direct quadrature of the density, and
check that core Einasto with r_c = 0 matches Einasto.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@adrn
adrn force-pushed the potential/einasto branch from 9eed01e to 87f3576 Compare October 16, 2026 21:17
@adrn adrn changed the title [WIP] Implement Einasto and Core Einasto profiles Implement Einasto and Core Einasto profiles Oct 16, 2026
@adrn adrn added this to the v1.13 milestone Oct 16, 2026
The Einasto C functions only exist when compiled with GSL, so reference
them only under USE_GSL (as PowerLawCutoffWrapper does) and mark both
potentials GSL_only. Fixes an undefined-symbol ImportError on import of
gala.potential in no-GSL builds.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@adrn
adrn merged commit 01d5e8d into main Oct 17, 2026
27 checks passed
@adrn
adrn deleted the potential/einasto branch October 17, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement the core Einasto potential/density model

1 participant