Skip to content

feat(interferometer): visualizer on array-free datasets (streaming phase 3) - #761

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/streaming-p3-visualizer
Sep 30, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/streaming-p3-visualizer

Conversation

@Jammy2211

@Jammy2211 Jammy2211 commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

PyAutoLens half of streaming phase 3 (https://github.com/orgs/PyAutoLabs/discussions/13; epic streaming-visibilities). Pairs with PyAutoLabs/PyAutoArray#597 (issue PyAutoLabs/PyAutoArray#596) and PyAutoLabs/PyAutoGalaxy#640. CI resolves the same-named upstream branches.

  • FitInterferometer gains model_image_natural (lensed galaxy images), dirty_model_image_natural, dirty_residual_map_natural.
  • Array-free branches: subplot_fit becomes a 2×3 (natural dirty image / model / residual; source plane zoomed / unzoomed; one blank); subplot_fit_dirty_images 1×3 natural; subplot_fit_interferometer_combined natural dirty image / model, source plane, natural residual; subplot_fit_real_space "Reconstructed Image" and subplot_tracer_from_fit panel 0 use dirty_model_image_natural. In-memory output unchanged.
  • interferometer/model/visualizer.py: logger(...) → logger.warning(...); the positions image uses dirty_image_natural on array-free. The identical logger(...) TypeError in imaging/model/visualizer.py (L143) is fixed too — same defect, one line, flagged here as the only change outside the interferometer scope.
  • Test hygiene: the stale assertion reading dirty_images.fits (the writer produces fit_dirty_images.fits; it passed only because a tracked 207 KB file existed) is fixed and the dead tracked file removed.

Witness: al visualize_before_fit + visualize write the same 10 files array-free and in memory; array-free vs in-memory natural dirty model rel 2.2e-15; W̃ vs transformer path rel 3.9e-14.

API Changes

Additive: the three FitInterferometer natural properties. Array-free datasets get natural-weighted panels under the existing filenames; in-memory unchanged. Both visualizers' linear-algebra fallbacks log a warning instead of raising TypeError.
See full details below.

Test Plan

  • pytest test_autolens — 776 passed, 1 xfailed (774 before the review fix)
  • New: array-free visualizer end to end (incl. fit_dirty_images.png/.fits, image_with_positions.png, tracer.png); array-free plot-function branches; fit properties; red with the source changes stashed
  • CI green on unittest 3.12 / 3.13 / nojax + docs

Heart RED override (development only)

Heart verdict at ship: RED (2026-09-30T18:32Z): release validation FAILED (stage integrate) (unrelated release-integrate leg) plus two canonical-checkout drift reasons from another session (PyAutoLens: on branch feature/point-solver-padding-backend (not main), PyAutoLens: 2 uncommitted source change(s)) — none caused by these branches. Live human authorization in-session 2026-09-30 for issue PyAutoLabs/PyAutoArray#596 and the three feature/streaming-p3-visualizer branches ("Authorize override for #596"): commit, push and the pending-release PRs only. Branch gates: test_autoarray 1898, test_autogalaxy 1293, test_autolens 776 + 1 xfailed; red-checks on the inversion-plot fix and the array-free tests; Codex (gpt-6-astra) review: FINDINGS (1) — model_image_natural summed galaxy_image_dict, whose entries are overwritten by a galaxy's linear reconstruction, so a galaxy with both ordinary and linear light lost its ordinary component (reproduced: rel error 1.0 in ag, 1.14/1.31 in al); fixed in-branch as profile_image + inversion.mapped_reconstructed_data, with mixed-galaxy tests against an independent transformer reference from fit.model_data (rel ≤ 2e-14), red-checked. Merge needs its own explicit human command with every check green.

Full API Changes (for automation & release notes)

Added

  • FitInterferometer.model_image_natural, .dirty_model_image_natural, .dirty_residual_map_natural

Changed Behaviour

  • subplot_fit, subplot_fit_dirty_images, subplot_fit_interferometer_combined, subplot_fit_real_space, subplot_tracer_from_fit — natural-weighted panels on array-free datasets
  • VisualizerInterferometer / VisualizerImaging — logger.warning in the InversionException fallback (was a TypeError); interferometer positions image from dirty_image_natural on array-free

Migration

  • None.

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JZZksyZ8LTA4LLxoZjQMNF

…ase 3, PyAutoArray#596)

Natural-weighted fit properties and array-free branches in subplot_fit (2x3),
subplot_fit_dirty_images, subplot_fit_interferometer_combined,
subplot_fit_real_space and subplot_tracer_from_fit; positions image from
dirty_image_natural. Both visualizers' InversionException fallbacks called
logger(...) (TypeError) and now log a warning (the imaging one is the same
defect, fixed in passing). Stale dirty_images.fits test assertion fixed and the
dead tracked file removed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JZZksyZ8LTA4LLxoZjQMNF
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Independent review (Codex gpt-6-astra) of the three branches before PR-open

  • P2 — Natural model/residual images omit ordinary light in mixed-component galaxies. autogalaxy/interferometer/fit_interferometer.py:438, autolens/interferometer/fit_interferometer.py:356.

    On an in-memory dataset after apply_sparse_operator(), put an ordinary Sersic and a linear Gaussian—or pixelization—in the same galaxy. galaxy_image_dict replaces that galaxy’s ordinary image with its linear reconstruction. Summing its values therefore omits the ordinary component: dirty_model_image_natural is too small, and dirty_residual_map_natural contains the omitted component’s dirty image.

    Classification: the dictionary overwrite is pre-existing; using it as the complete model introduces this defect into the new properties. Assemble the model from profile_image plus inversion.mapped_reconstructed_data.

    The added tests miss this: they use pixelization-only models and construct their Fourier reference from model_image_natural itself, rather than independently from fit.model_data.

FINDINGS (1)

Disposition: FINDINGS (1) — model_image_natural summed galaxy_image_dict, whose entries are overwritten by a galaxy's linear reconstruction, so a galaxy with both ordinary and linear light lost its ordinary component (reproduced: rel error 1.0 in ag, 1.14/1.31 in al); fixed in-branch as profile_image + inversion.mapped_reconstructed_data, with mixed-galaxy tests against an independent transformer reference from fit.model_data (rel ≤ 2e-14), red-checked. Test names: test__natural_dirty_images__galaxy_with_ordinary_and_linear_light__matches_model_data[linear_light_profile|pixelization] in both repos.

🤖 Generated with Claude Code

@Jammy2211
Jammy2211 merged commit a2fbe88 into main Sep 30, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/streaming-p3-visualizer branch September 30, 2026 19:22
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