Skip to content

feat: rect_adapt_duo — demo of RectangularRotatedAdaptImage multi-source fix - #71

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/rectangular-adapt-cdf
May 17, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/rectangular-adapt-cdf

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

New developer-workspace demo package (rect_adapt_duo/) that visually demonstrates the multi-source ghost-peak failure in RectangularSplineAdaptImage and the fix delivered by the new RectangularRotatedAdaptImage class (shipped in PyAutoArray #323).

The demo uses two compact Sérsic sources at source-plane (±0.5, ±0.5) behind an isothermal lens — the textbook case where the separable per-axis CDF produces a 4-quadrant outer-product mesh with two real source zones and two empty ghost cross-products. The new rotated class aligns to the +45° principal axis and concentrates pixels only on the real peaks.

Scripts Changed

  • rect_adapt_duo/__init__.py — package marker
  • rect_adapt_duo/README.md — demo overview, run order, expected result, honest χ² caveat
  • rect_adapt_duo/simulator.py — two-source diagonal lens simulator (isothermal lens, two Sérsic sources at (±0.5, ±0.5), 150×150 grid at 0.05" pixels, Gaussian PSF σ=0.1)
  • rect_adapt_duo/compare_meshes.py — side-by-side FitImaging for baseline (RectangularSplineAdaptImage) and new (RectangularRotatedAdaptImage) mesh classes at the true mass model, with truth-derived adapt image. Outputs a 2×3 comparison PNG (source mesh + reconstruction / image-plane model / image-plane residuals, per mesh class)
  • rect_adapt_duo/dataset/{data,noise_map,psf}.fits — generated dataset (small, committed for reproducibility)
  • rect_adapt_duo/output/comparison.png — the comparison figure produced by compare_meshes.py

Upstream PR

PyAutoLabs/PyAutoArray#323

Test Plan

  • python simulator.py produces dataset/{data,noise_map,psf}.fits
  • python compare_meshes.py runs end-to-end and produces output/comparison.png
  • Source-plane mesh panels (left column of the PNG) visually confirm the prediction: baseline shows the textbook 4-quadrant ghost grid (pixels concentrated at all (±0.5, ±0.5) zones, two real + two ghost); rotated shows a clean +45° diagonal band concentrating pixels only on the two real source peaks

Notes

This is a dev-workspace demo, not a release-pipeline asset. It complements the empirical experiments under PyAutoArray/files/ (ghost_peak_experiment.py, pca_rotation_experiment.py) by exercising the production class through the real FitImaging pipeline end-to-end.

🤖 Generated with Claude Code

…lti-source fix

Adds a new demo package under autolens_workspace_developer/rect_adapt_duo/
that visually demonstrates the ghost-peak failure of RectangularSplineAdaptImage
on multi-modal adapt images, and the fix delivered by the new
RectangularRotatedAdaptImage class shipped in PyAutoArray #323.

Scenario: two compact Sersic sources at source-plane (+/-0.5, +/-0.5) behind
an isothermal lens. The diagonal placement is the textbook case where the
separable per-axis CDF produces a 4-quadrant outer-product mesh — two pixel
zones on the real source peaks, two on the empty ghost cross-products.

Run order:
  python simulator.py        # → dataset/{data,noise_map,psf}.fits
  python compare_meshes.py   # → output/comparison.png

The headline panels are the source-plane mesh layouts (left column):
baseline shows the textbook 4-quadrant ghost grid; rotated shows a clean
+45° band through both real source peaks. README documents the chi^2 caveat
(rotated case needs different regularization coefficient for like-for-like
fit quality — both meshes need search-tuned regularization for fair
fit-quality comparison, intentionally skipped in this demo for clarity).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant