Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,69 @@
`NFWTruncatedSph.potential_2d_from` failed the `grad(psi)=alpha` finite-difference
self-consistency check at med 7.1e-2 (vs ~8e-4 for every other NFW/gNFW/cNFW
variant) — the MGE decomposition's sigma range (`radii_max = truncation_radius * 5`)
was the prime suspect.

**Shipped:** [PyAutoGalaxy#564](https://github.com/PyAutoLabs/PyAutoGalaxy/pull/564),
merged 2026-08-09 (fixes PyAutoGalaxy#563). This ledger entry was reconciled
retroactively on 2026-08-19 — the fix shipped outside the prompt's dev flow, so the
draft prompt and `planned.md` entry had gone stale.

## What shipped (and how it differed from the plan)

The prompt's plan was to **widen/refine the MGE sigma range**. The shipped fix went
further: the MGE approximation was **replaced entirely** by the exact analytic
lensing potential — equation (18) of Baltz, Marshall & Oguri (2009) for the n=1
smoothly truncated NFW — which the prompt's step 3 had flagged as a cross-check.
The analytic form became the implementation:

- `potential_func_sph_from(grid_radius, tau, xp)` — dimensionless analytic BMO
potential, with a sixth-order small-radius series below `x = 1e-1` to avoid
catastrophic cancellation in NumPy/JAX float32, zero-centred per the paper's
convention.
- `NFWTruncatedSph.potential_2d_from` applies the `2 kappa_s r_s^2` normalisation.

## Validation

From the PR: 48 profile tests + 1054 full `test_autogalaxy/` pass; full-mode
200×200 workspace checks across three tNFW truncation regimes 9 PASS / 0 FAIL;
independent comparison against lenstronomy TNFW; JAX JIT/autodiff/float32, centre,
`x=1` and large-truncation checks. The unit tests the prompt asked for exist in
`test_autogalaxy/profiles/mass/dark/test_nfw_truncated.py`:
`test__potential_2d_from__gradient_matches_analytic_deflections` (rel 1e-6),
`__laplacian_matches_analytic_convergence` (rel 1e-5), an independent-implementation
match, and an NFW-limit comparison at large truncation radius.

Independent re-verification on `main` (49115ad, 2026-08-19), finite-differencing
`grad(psi)` against `coord_func_m`-based deflections over r in [1e-3, 20] arcsec:

| tau | median frac err | max |
|-----|-----------------|-----|
| 2.0 (defaults) | 1.4e-09 | 4.3e-07 |
| 10.0 | 2.2e-09 | 4.8e-07 |
| 0.5 | 1.2e-09 | 4.6e-07 |

The med 7.1e-2 failure is gone — errors are now at the FD-scheme floor, ~5 orders
below the other profiles' MGE-limited ~8e-4.

## Traps / lessons

- **Analytic beat MGE re-tuning.** The prompt's "widen the sigma range" plan would
have kept an approximation where a closed form exists. When a profile has a
published analytic potential (BMO 2009 here), port it — the MGE path is for
profiles without one.
- **Ledger drift:** the fix merged 2026-08-09 but the prompt sat in `draft/` and
`planned.md` for ten more days, still surfacing on the dashboard as open
high-priority work. A fix shipped outside the prompt's own dev flow must
reconcile the Mind in the same breath.
- Related but distinct: the Isothermal Ell/Sph potential disagreement
(`planned.md` § `isothermal-ell-sph-oversampling-at-the-cusp`) was once guessed
to share this root cause — retracted; MGE is not involved there.
- `draft/feature/autogalaxy/piemass_potential.md` (PIEMass has *no* potential) is
the sibling task and remains open; the BMO-style analytic-port route used here
is the template for it.

## Original prompt

# `NFWTruncatedSph.potential_2d_from`: MGE potential fails `grad(psi)=alpha` self-consistency

Type: bug
Expand Down
3 changes: 2 additions & 1 deletion complete/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Token-light navigation over the finished-work records (schema:
only then grep a dated bucket. Curators: edit the band between the CURATED
markers; everything below GENERATED is rebuilt.

1026 records across 7 buckets.
1027 records across 7 buckets.

<!-- CURATED:START -->
## Highlights
Expand Down Expand Up @@ -91,6 +91,7 @@ _(curate hard-won records here — survives regeneration.)_
- [multistart-gradient-resume-fom-sanity-check](2026/08/multistart-gradient-resume-fom-sanity-check.md)
- [multistart-nan-step-diagnostics](2026/08/multistart-nan-step-diagnostics.md)
- [nautilus-1core-serial-pool](2026/08/nautilus-1core-serial-pool.md) — corrective for the Heart RED "release validation FAILED (stage
- [nfw-truncated-potential-accuracy](2026/08/nfw-truncated-potential-accuracy.md)
- [normalise-auto-simulate-guard-idiom](2026/08/normalise-auto-simulate-guard-idiom.md)
- [notebook-setup-notebook-regen-drift](2026/08/notebook-setup-notebook-regen-drift.md)
- [nss-remainline-mainline-blackjax](2026/08/nss-remainline-mainline-blackjax.md)
Expand Down
18 changes: 8 additions & 10 deletions dashboard.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PyAutoMind task dashboard

<!-- generated by `pyauto-brain intake dashboard --apply` on 2026-08-18 — regenerate, do not hand-edit -->
<!-- generated by `pyauto-brain intake dashboard --apply` on 2026-08-19 — regenerate, do not hand-edit -->

Every task the Mind is holding, on one page: what is in flight, what is parked, and the whole backlog to pick from. Pick a line, then run `/start_dev <prompt-path>` to start it.

Expand All @@ -10,14 +10,14 @@ Tasks only — the organism's health lives with the Heart (`/health`), not here.
|-------|------:|
| [In flight](#in-flight) (`active/`) | 5 |
| [Parked](#parked) (`parked.md`) | 3 |
| [Planned](#planned) (`planned.md`) | 7 |
| [Backlog](#backlog) (`draft/`) | 124 |
| [Planned](#planned) (`planned.md`) | 6 |
| [Backlog](#backlog) (`draft/`) | 123 |

Live on GitHub: [open issues](https://github.com/search?q=org%3APyAutoLabs+is%3Aissue+is%3Aopen&type=issues) · [open pull requests](https://github.com/search?q=org%3APyAutoLabs+is%3Apr+is%3Aopen&type=prs)

## Start here

**Highest priority** (filed as `high`) — showing 12 of 24
**Highest priority** (filed as `high`) — showing 12 of 23

- [TRIAGE: needs manual review before routing](draft/triage/jax_zero_contour.md) — medium · safe · high
- [Decide whether the clipper belongs in the search identifier](draft/feature/autofit/clipper_in_search_identifier.md) — autofit · medium · human-required · high
Expand All @@ -29,8 +29,8 @@ Live on GitHub: [open issues](https://github.com/search?q=org%3APyAutoLabs+is%3A
- [Deep research: Can we speed up Delaunay in PyAutoArray?](draft/research/autoarray/delaunay_research.md) — autoarray · too-large · supervised · high
- [EP hierarchical parent-scale collapse: cure the basin, or document the](draft/bug/autofit/ep_scale_collapse_basin_cure_or_caveat.md) — autofit · too-large · human-required · high
- [Census of priors and messages — confirmed bugs + redesign](draft/research/autofit/priors_and_messages_math_audit.md) — autofit · too-large · supervised · high
- [`NFWTruncatedSph.potential_2d_from`: MGE potential fails `grad(psi)=alpha` self-consistency](draft/bug/autogalaxy/nfw_truncated_potential_accuracy.md) — autogalaxy · too-large · supervised · high
- [`einstein_radius_jit_from`: replace static init_guess with a JAX-native seed finder](draft/refactor/autogalaxy/einstein_radius_jit_native_seed_finder.md) — autogalaxy · too-large · supervised · high
- [Investigate eager `FitImaging.figure_of_merit` vs JIT/step-by-step divergence in rectangular pixelization](draft/bug/autolens/pixelization_eager_vs_jit_divergence.md) — autolens · too-large · supervised · high

**Quick wins** (small enough, and safe enough to run unattended)

Expand Down Expand Up @@ -69,27 +69,25 @@ Started or scoped, not currently in flight — resume by moving the row back to
Scoped but not started; some are not yet prompt files. Full detail in [`planned.md`](planned.md).

<details>
<summary><b>7</b> task(s)</summary>
<summary><b>6</b> task(s)</summary>

- **isothermal-ell-sph-oversampling-at-the-cusp** — planned — NOT yet a prompt file; file one via `/intake` before starting
- **remote-mcp-deployment-tiers** — [issue #20](https://github.com/PyAutoLabs/autofit_assistant/issues/20) — DESIGN-COMPLETE, build BLOCKED-ON-DEMAND — issue #20 holds the full auth/transport/hosting design + Richard/PyAutoMCP…
- **samples-parameter-paths** — [issue #1327](https://github.com/PyAutoLabs/PyAutoFit/issues/1327) — parked
- **jax-point-source-point-smoke-sentinel** — planned
- **nfw-truncated-potential-accuracy** — planned
- **piemass-potential** — planned
- **latent-nan-guard-honest-run**

</details>

## Backlog

**124** filed prompts, not started. Each section is sorted most-pickable first (priority, then size).
**123** filed prompts, not started. Each section is sorted most-pickable first (priority, then size).

<details>
<summary><b>bug</b> — 32</summary>
<summary><b>bug</b> — 31</summary>

- [EP hierarchical parent-scale collapse: cure the basin, or document the](draft/bug/autofit/ep_scale_collapse_basin_cure_or_caveat.md) — autofit · too-large · human-required · high
- [`NFWTruncatedSph.potential_2d_from`: MGE potential fails `grad(psi)=alpha` self-consistency](draft/bug/autogalaxy/nfw_truncated_potential_accuracy.md) — autogalaxy · too-large · supervised · high
- [Investigate eager `FitImaging.figure_of_merit` vs JIT/step-by-step divergence in rectangular pixelization](draft/bug/autolens/pixelization_eager_vs_jit_divergence.md) — autolens · too-large · supervised · high
- [Fix Autofit release sampler and database regressions](draft/bug/health_fixes/autofit_sampler_database.md) — health_fixes · too-large · supervised · high
- [Fix release JAX runtime compatibility and likelihood parity](draft/bug/health_fixes/jax_runtime_and_parity.md) — health_fixes · too-large · supervised · high
Expand Down
17 changes: 0 additions & 17 deletions planned.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,6 @@
Sibling smoke scripts to check while triaging: image_plane.py,
source_plane.py in the same dir — they share the seed dataset.

## nfw-truncated-potential-accuracy
- prompt: draft/bug/autogalaxy/nfw_truncated_potential_accuracy.md
- status: planned
- filed: 2026-06-05
- classification: library (accuracy bug)
- suggested-branch: feature/nfw-truncated-potential-accuracy
- summary: |
Pre-existing accuracy bug surfaced while shipping dark-matter-potentials.
NFWTruncatedSph.potential_2d_from (MGE) fails grad(psi)=alpha self-
consistency in autolens_workspace_test/scripts/mass/dark.py (med 7.1e-2 vs
~8e-4 for every other NFW/gNFW/cNFW variant). Deflections pass, only the
potential is off — likely the MGE sigma range (radii_max = truncation_radius
* 5) is too narrow. Reproduce on clean main first.
- affected-repos:
- PyAutoGalaxy


## piemass-potential
- prompt: draft/feature/autogalaxy/piemass_potential.md
- status: planned
Expand Down
Loading