Skip to content

feat: S/N map adapt images and AdaptImages.from_result - #763

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

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

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Phase 2 of making the adapt-mesh-weighting result the default everywhere (closes #762; phase 1 PyAutoLabs/PyAutoArray#717). The "adapt images" built from a result are, by default, per-galaxy signal-to-noise maps (data minus the other galaxies' model images, over the noise map, floored at 1% of the peak). The new HilbertSNR mesh and the soft AdaptSplit signal need them before that floor. This adds functions named for what they return, and a one-call builder, so a workspace pipeline stage goes from ~18 lines to:

image_mesh = al.image_mesh.HilbertSNR(pixels=1000, edge_pixels=30)
adapt_images = al.AdaptImages.from_result(result=result_1, image_mesh={"source": image_mesh})
mesh = al.mesh.Delaunay(pixels=image_mesh.pixels, zeroed_pixels=image_mesh.edge_pixels)

Existing calls and outputs are unchanged (Hilbert, AdaptSplit, galaxy_name_image_dict_via_result_from defaults). Depends on PyAutoLabs/PyAutoArray#718 (same branch name; merge that first).

API Changes

Adds galaxy_snr_maps_from, soft_snr_maps_from and AdaptImages.from_result; galaxy keys in AdaptImages may be written short ("source", "galaxies.source"); galaxy_name_image_dict_via_result_from gains minimum_percent=. The al. exports of the two functions follow in phase 3 (PyAutoLens was claimed by another task); al.AdaptImages.from_result works already. See full details below.

Test Plan

  • test_adapt_images.py (16 tests): minimum_percent with and without a cache (default unchanged, result maps not floored in place); galaxy_snr_maps_from unfloored; soft_snr_maps_from incl. galaxy_names; key resolution (full, dotted, short, ambiguous raises, unknown raises); updated_via_instance_from with short keys and an unknown key ignored as before; from_result equal to the manual steps.
  • Full test_autogalaxy: 1692 passed.
  • Test-mode SLaM fit of the science project's unified arm (COSJ100018+022138_F277W) with AdaptImages.from_result in source_pix[2] and soft_snr_maps_from in later stages: all 5 searches complete; the 1250 Hilbert points and the source AdaptSplit map equal the project's reference implementation (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 (#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)

Added

  • autogalaxy.galaxy_snr_maps_from(result) — per-galaxy S/N maps, negatives set to 0, no floor (= galaxy_name_image_dict_via_result_from(result, minimum_percent=0.0)).
  • autogalaxy.soft_snr_maps_from(snr_maps, galaxy_names=None) — aa.image_mesh.soft_snr_map_from per map; the AdaptSplit input matching HilbertSNR.
  • autogalaxy.AdaptImages.from_result(result, image_mesh=None, mask=None) — S/N maps, a mesh grid per galaxy in image_mesh (drawn from its unfloored S/N map, edge points included), soft maps as galaxy_name_image_dict; mask defaults to result.mask.
  • autogalaxy.analysis.adapt_images.adapt_images.galaxy_name_key_from(name, keys) — resolves full / dotted / short galaxy names.

Changed Signature

  • galaxy_name_image_dict_via_result_from(result, use_model_images=False, minimum_percent=None) — None uses the config floor (unchanged); 0.0 gives the maps before the floor.

Changed Behaviour

  • AdaptImages.updated_via_instance_from resolves short galaxy keys; a short key matching two galaxies raises; keys matching no galaxy are ignored as before.
  • galaxy_name_image_dict_via_result_from floors a copy, so the result's own maps (computed without a cache) are no longer floored in place.

Migration

  • Before: dict = al.galaxy_name_image_dict_via_result_from(result=r); cap the source map at 3; Hilbert(pixels=1000, weight_power=3.5, weight_floor=0.01).image_plane_mesh_grid_from(...); append_with_circle_edge_points(...); AdaptImages(galaxy_name_image_dict=dict, galaxy_name_image_plane_mesh_grid_dict={"('galaxies', 'source')": grid})
  • After: al.AdaptImages.from_result(result=r, image_mesh={"source": al.image_mesh.HilbertSNR(pixels=1000, edge_pixels=30)})

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

…Images.from_result

galaxy_snr_maps_from returns each galaxy's S/N map before the 1% adapt
floor (the HilbertSNR input); soft_snr_maps_from gives AdaptSplit the
same soft S/N signal; AdaptImages.from_result builds a pipeline stage's
adapt images and mesh grids in one call. Galaxy keys may be written
short ("source", "galaxies.source"). galaxy_name_image_dict_via_result_from
gains minimum_percent= and floors a copy instead of the result's maps.
Existing outputs are unchanged. Closes phase 2 of PyAutoGalaxy#762.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Nov 26, 2026
@Jammy2211
Jammy2211 merged commit 8eba023 into main Nov 26, 2026
9 checks passed
@Jammy2211
Jammy2211 deleted the feature/adapt-mesh-weighting-galaxy branch November 26, 2026 14:11
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.

feat: unfloored S/N adapt images and soft AdaptSplit images for HilbertSNR

1 participant