Skip to content

feat: HilbertSNR image mesh and soft S/N adapt transform - #717

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/adapt-mesh-weighting-library
Nov 26, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/adapt-mesh-weighting-library

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Phase 1 of making the adapt-mesh-weighting result the library default (#714, #716). The Hilbert image mesh weights the adapt image by (adapt / max(adapt)) ** weight_power, so how well the rest of the source adapts depends on the single brightest pixel: with a peak S/N of 250 and weight_power=3.5, weight_floor=0.01, everything below S/N ~67 got the floor weight, the same as sky. The workspace's S/N 3 cap avoided that but treated all source structure as equal.

HilbertSNR keeps Hilbert's curve and deterministic draw and replaces only the weighting: 25% of the points spread evenly over the mask, 70% by a soft saturation in absolute S/N (zero at S/N ≤ 2, saturating for bright pixels), 5% on cells near the peak. HilbertSNR(pixels=...) with no other arguments gives the weighting the human approved after fits on 10 HST + 10 JWST (COWLS) lens datasets and an offline check on 19 lenses from peak S/N 5 to 1000 (Science/development/adapt_snr_cap). adapt_image_soft_from gives AdaptSplit the same signal as its adapt image. Hilbert and every regularization are unchanged (backward compatible).

Later phases (separate PRs): PyAutoGalaxy one-call adapt images (S/N map before the 1% adapt floor + the soft AdaptSplit image), then every workspace switches to HilbertSNR and drops weight_power, weight_floor and the S/N 3 cap.

API Changes

Adds a new image mesh, image_mesh.HilbertSNR, and two functions, image_mesh.soft_snr_from and image_mesh.adapt_image_soft_from. Nothing existing changes. See full details below.

Test Plan

  • test_autoarray/inversion/pixelization/image_mesh/test_hilbert_snr.py (8 tests): probabilities equal an independent copy of the approved formula; transform values; a much brighter pixel does not take the arc's share; blank and negative adapt data; arc + compact component at peak 25 / 250 / 1000 keeps > 50% of points on the arc and < 30% on sky, while Hilbert(weight_power=3.5, weight_floor=0.01) keeps < 20% on the arc at peak 250.
  • Full test_autoarray: 2622 passed.
  • Against the science project: the library mesh and soft adapt image equal those saved by a test-mode SLaM fit of the unified arm (max difference 0.0), and the mesh equals the project's peak_share on all 15 real lenses with a unified source_pix[1] (max difference 0.0 arcsec).
  • Heart dev readiness (PyAutoArray): GREEN, no reasons.
Full API Changes (for automation & release notes)

Added

  • autoarray.image_mesh.HilbertSNR(pixels=10.0, background_share=0.25, peak_share=0.05, peak_power=8.0, snr_noise=2.0, snr_soft=3.0, soft_power=2.0) — Hilbert subclass; overrides weight_map_from (point budget in absolute S/N) and image_plane_mesh_grid_from (negative S/N set to 0 before the Hilbert interpolation). Raises ValueError unless background_share + peak_share <= 1 and both are non-negative.
  • autoarray.image_mesh.soft_snr_from(snr, snr_noise=2.0, snr_soft=3.0, soft_power=2.0) — (x / (x + snr_soft)) ** soft_power, x = max(S/N - snr_noise, 0).
  • autoarray.image_mesh.adapt_image_soft_from(snr, snr_noise=2.0, snr_soft=3.0, soft_power=2.0, minimum_percent=0.01) — the soft transform floored at 1% of its maximum; the adapt image for AdaptSplit. Ones when nothing exceeds snr_noise.

Migration

  • Before: al.image_mesh.Hilbert(pixels=1250, weight_power=3.5, weight_floor=0.01) on the S/N map (optionally capped at 3)
  • After: al.image_mesh.HilbertSNR(pixels=1250) on the S/N map before the adapt-image floor; give AdaptSplit al.image_mesh.adapt_image_soft_from(snr). Existing Hilbert calls are unchanged.

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

HilbertSNR draws the Hilbert image mesh with a fixed point budget in
absolute S/N (25% even over the mask, 5% near the peak, 70% by a soft
S/N saturation) instead of (adapt / max) ** weight_power, so adaptation
no longer depends on the brightest pixel. soft_snr_from and
adapt_image_soft_from give AdaptSplit the same signal. Hilbert and the
regularizations are unchanged. Approved at gate 2 of the
adapt-mesh-weighting study (#714); closes phase 1 of #716.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant