Repository navigation
feat: HilbertSNR image mesh and soft S/N adapt transform - #717
Merged
Merged
Conversation
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>
This was referenced Nov 26, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 1 of making the adapt-mesh-weighting result the library default (#714, #716). The
Hilbertimage 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 andweight_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.HilbertSNRkeepsHilbert'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_fromgivesAdaptSplitthe same signal as its adapt image.Hilbertand 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
HilbertSNRand dropsweight_power,weight_floorand the S/N 3 cap.API Changes
Adds a new image mesh,
image_mesh.HilbertSNR, and two functions,image_mesh.soft_snr_fromandimage_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, whileHilbert(weight_power=3.5, weight_floor=0.01)keeps < 20% on the arc at peak 250.test_autoarray: 2622 passed.peak_shareon all 15 real lenses with a unifiedsource_pix[1](max difference 0.0 arcsec).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)—Hilbertsubclass; overridesweight_map_from(point budget in absolute S/N) andimage_plane_mesh_grid_from(negative S/N set to 0 before the Hilbert interpolation). RaisesValueErrorunlessbackground_share + peak_share <= 1and 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 forAdaptSplit. Ones when nothing exceedssnr_noise.Migration
al.image_mesh.Hilbert(pixels=1250, weight_power=3.5, weight_floor=0.01)on the S/N map (optionally capped at 3)al.image_mesh.HilbertSNR(pixels=1250)on the S/N map before the adapt-image floor; giveAdaptSplital.image_mesh.adapt_image_soft_from(snr). ExistingHilbertcalls are unchanged.Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code