Skip to content

feat: HilbertSNR point cap and frame-independent interpolation, edge_pixels, shorter arguments - #718

Merged
Jammy2211 merged 2 commits into
mainfrom
feature/adapt-mesh-weighting-galaxy
Nov 26, 2026
Merged

Jammy2211 merged 2 commits into
mainfrom
feature/adapt-mesh-weighting-galaxy

Conversation

@Jammy2211

@Jammy2211 Jammy2211 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Phase 2 of making the adapt-mesh-weighting result the default everywhere (PyAutoLabs/PyAutoGalaxy#762; phase 1 #717). The API was settled with the human so a workspace pipeline stage becomes three lines. This PR is the PyAutoArray half; the PyAutoGalaxy PR on the same branch name depends on it (merge this first).

API Changes

Update (second commit): HilbertSNR now caps points per image pixel (max_per_pixel=8) and interpolates the adapt data frame-independently (frame_independent=True); Hilbert gains frame_independent=False (opt-in, so its output is unchanged).

Renames two HilbertSNR arguments and one function added in #717 (merged, not yet released, so no user code depends on them), and adds an optional edge_pixels= to Hilbert, HilbertSNR and Overlay (default 0: unchanged output) so scripts no longer append the Delaunay boundary points by hand. See full details below.

Test Plan

  • Cap: on a faint compact source the most points in one pixel goes 203 → 7 (max_per_pixel=8) / 3 (=3); on the study's 20 datasets no two points closer than 0.05 px (was 539 on the faintest), median share of points on S/N ≥ 3 0.71 → 0.70.
  • Frame independence: the same lens padded to larger and non-square frames gives the same HilbertSNR mesh to 1e-9 (before: points moved up to 6-9 px; non-square raised); bilinear interpolation exact on a linear image; Hilbert default unchanged.
  • Full test_autoarray after the second commit: 2632 passed.
  • test_hilbert_snr.py: renamed arguments; edge_pixels on all three image meshes (count, radius = half a pixel beyond the mask's outer edge, other points unchanged).
  • Full test_autoarray: 2625 passed.
  • A test-mode SLaM fit of the science project's unified arm using AdaptImages.from_result with HilbertSNR(pixels=1250, edge_pixels=30): the 1250 Hilbert points equal the reference peak_share mesh (0.0).

Heart

Scoped dev readiness (pyauto-heart readiness --dev --repos PyAutoArray,PyAutoGalaxy) is GREEN. Shown, non-blocking: PyAutoFit: CI failure (red), release validation FAILED (stage integrate) (red), workspace validation not passing (2 failed, 1 timeout, cloud#45815945322: autofit scripts/plot/emcee_plotter.py, autogalaxy_test scripts/misc/fit_imaging_sparse_operator.py, autogalaxy_test scripts/misc/fit_interferometer_sparse_operator.py) (yellow). The human had authorized a development-only Heart RED override for this task (PyAutoGalaxy#762, "Override, proceed"); the scoped gate came back GREEN, so it was not needed. Heart remains RED for release purposes.

Full API Changes (for automation & release notes)

Renamed

  • image_mesh.HilbertSNR(background_share=, peak_share=) → image_mesh.HilbertSNR(background=, peak=) (attributes too)
  • image_mesh.adapt_image_soft_from → image_mesh.soft_snr_map_from

Changed Signature

  • image_mesh.Hilbert(..., edge_pixels=0), image_mesh.HilbertSNR(..., edge_pixels=0), image_mesh.Overlay(..., edge_pixels=0): edge_pixels points appended by image_plane_mesh_grid_from on a circle of radius mask.circular_radius + pixel_scale / 2 (half a pixel beyond the outer edge of the outermost unmasked pixel). On even-sized frames this is where workspace scripts put them (mask_radius + pixel_scale / 2); on odd-sized frames half a pixel closer.

Added

  • AbstractImageMesh.with_edge_points_from(image_plane_mesh_grid, mask)

Added (second commit)

  • image_mesh.HilbertSNR(..., max_per_pixel=8.0, frame_independent=True) — the cap (None turns it off) and the interpolation switch.
  • image_mesh.Hilbert(..., frame_independent=False) — opt-in bilinear interpolation; default keeps griddata.
  • image_and_grid_from(..., frame_independent=False); Hilbert.probabilities_from(adapt_data_hb, mask) hook; hilbert_snr.capped_probabilities_from(probabilities, cap) (water-filling); module constant HILBERT_LENGTH = 193.

Migration

  • Before: grid = Hilbert(pixels=1000, ...).image_plane_mesh_grid_from(...) then append_with_circle_edge_points(grid, centre=mask.mask_centre, radius=mask_radius + mask.pixel_scale / 2.0, n_points=30)
  • After: image_mesh = HilbertSNR(pixels=1000, edge_pixels=30); Delaunay(pixels=image_mesh.pixels, zeroed_pixels=image_mesh.edge_pixels)

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

…ap_from

HilbertSNR's share arguments become background= and peak=, and
adapt_image_soft_from becomes soft_snr_map_from (both unreleased since
#717). Hilbert, HilbertSNR and Overlay take edge_pixels= (default 0),
appending the zeroed Delaunay boundary points half a pixel beyond the
circular mask's outer edge, so scripts no longer append them by hand.
Phase 2 of the adapt-mesh-weighting default (PyAutoGalaxy#762).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rpolation

HilbertSNR(max_per_pixel=8) water-fills the Hilbert probabilities so no
image pixel gets more than 8 points (faint sources had up to 61 in one
pixel, hundreds within 0.05 pixels of each other). image_and_grid_from
gains frame_independent: bilinear interpolation on the image's own pixel
grid, so the mesh no longer depends on the frame around the mask and
non-square frames work. On by default for HilbertSNR; Hilbert keeps the
original griddata interpolation unless asked (frame_independent=False),
so existing results are unchanged. Hilbert's normalised weight map moves
into a probabilities_from hook.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 changed the title feat: shorter HilbertSNR arguments, edge_pixels on image meshes, soft_snr_map_from feat: HilbertSNR point cap and frame-independent interpolation, edge_pixels, shorter arguments Nov 26, 2026
@Jammy2211
Jammy2211 merged commit 8662361 into main Nov 26, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/adapt-mesh-weighting-galaxy branch November 26, 2026 14:04
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