Skip to content

fix: use analytic potential for truncated NFW - #564

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/nfw-truncated-analytic-potential
Aug 9, 2026
Merged

fix: use analytic potential for truncated NFW#564
Jammy2211 merged 1 commit into
mainfrom
feature/nfw-truncated-analytic-potential

Conversation

@Jammy2211

@Jammy2211 Jammy2211 commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Replace the MGE approximation in NFWTruncatedSph.potential_2d_from with the exact analytic potential for the Baltz, Marshall & Oguri (2009) n=1 truncated NFW profile.

Use a sixth-order small-radius series to avoid catastrophic cancellation in NumPy/JAX float32, retain a finite zero-centred potential convention, and correct the paper's arXiv identifier.

Fixes #563.

API Changes

NFWTruncatedSph.potential_2d_from now returns the analytic BMO potential instead of the previous MGE approximation.
A reusable dimensionless analytic helper, potential_func_sph_from, is added.
See full details below.

Test Plan

  • pytest test_autogalaxy/profiles/mass/dark/test_nfw_truncated.py -q — 48 passed
  • pytest test_autogalaxy/ -q — 1054 passed
  • Full-mode 200×200 workspace checks for all three tNFW truncation regimes — 9 PASS / 0 FAIL / 0 SKIP
  • Independent comparison against lenstronomy TNFW
  • JAX JIT, autodiff, float32 stability, centre, x=1, and large-truncation checks
  • GitHub Actions Tests and Docs workflows

Gate Record

PR creation was explicitly authorized despite unrelated PyAutoHeart RED reasons from another task's shared checkout:

  • PyAutoFit: 2 commit(s) behind origin
  • PyAutoGalaxy: on branch feature/point-source-light (not main)
  • PyAutoGalaxy: 1 commit(s) behind origin

After CI passed, the human explicitly authorized merge. A fresh isolated-main Heart run removed all three RED reasons and reported STALE only because release-validation/install sidecars are unavailable in this web runtime.

Full API Changes (for automation & release notes)

Added

  • autogalaxy.profiles.mass.dark.nfw_truncated.potential_func_sph_from(grid_radius, tau, xp=np) — evaluates the dimensionless analytic n=1 truncated-NFW lensing potential with stable small-radius handling.

Changed Behaviour

  • autogalaxy.profiles.mass.dark.nfw_truncated.NFWTruncatedSph.potential_2d_from(grid, xp=np, **kwargs) — now uses the analytic BMO equation (18) potential rather than an MGE approximation; the paper convention sets the central additive constant to zero.

Migration

  • None required; the method signature and returned physical quantity are unchanged.

Generated by the PyAutoLabs agent workflow.

@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Aug 9, 2026 — with ChatGPT Codex Connector
@Jammy2211
Jammy2211 marked this pull request as ready for review August 9, 2026 18:03
@Jammy2211
Jammy2211 merged commit 71724e9 into main Aug 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: use analytic potential for truncated NFW

1 participant