Skip to content

docs: tutorial_2_mappers draws polygons in both planes; dead index sections fixed (image-source-mappings P3) - #76

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/image-source-mappings-p3
Sep 3, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/image-source-mappings-p3

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Phase 3 of the image-source-mappings epic (PyAutoLabs/autolens_workspace#525). Chapter 3's tutorial_2_mappers has said "VISUALS SLIGHTLY BUGGY" since the mapping overlays were removed in 2025: every "watch a source pixel map to the image" step computed mapper.slim_indexes_for_pix_indexes(...) and then drew nothing with it (and that method returns over-sampled sub-slim indexes, not image pixels, so it was wrong as well as dead). tutorial_3_inversions carried the same dead block.

The tutorial now draws what it describes. Each replaced block calls mapper.mappings_from(pix_indexes=...) (PyAutoArray#517) and passes the Mapping objects to subplot_image_and_mapper(regions=...), so a source-plane cell and the image-plane regions it maps to appear as filled polygons in the same colour in both panels: one central source pixel and its multiple images; two groups in two colours; edge cells that map to empty sky (the motivation for the mask); four neighbouring cells under the annular mask. The point-level indexes= block, which also never plotted, now draws the same coordinates in both planes with plot_grid(indexes=...). Prose around each figure is rewritten to teach what the polygons show and why this is the mapping matrix made visible.

Hard-coded mesh indexes are clamped with min(index, mapper.pixels - 1) and the point-level indexes derive from the grid size, so the smoke profile's 16×16 grid runs. Cells on the mesh's outer top row / left column are avoided: RectangularBilinearAdaptDensity gives them zero-extent contours, so they draw as nothing (library follow-up noted on #525).

The polygon overlay is reached via import autoarray.plot as aaplt because autolens.plot.plot_array / plot_grid do not yet forward regions= / indexes= (library follow-up noted on #525).

pending-release: runs today from source installs; PyPI users need the PyAutoArray and PyAutoLens releases carrying phases 1–2.

Scripts Changed

  • scripts/chapter_3_pixelizations/tutorial_2_mappers.py — BUGGY warning dropped; four dead index blocks replaced with mappings_from + subplot_image_and_mapper(regions=) polygons in both planes; point-level block now plots via plot_grid(indexes=); prose rewritten; indexes clamped / grid-derived.
  • scripts/chapter_3_pixelizations/tutorial_3_inversions.py — the "random mappings" block now draws its five mappings as coloured polygons; index 11 (a degenerate edge cell) swapped for an interior cell.
  • Notebook twins regenerated with PyAutoHands generate.py; catalogue files byte-identical.

Test Plan

  • Full-resolution runs of both tutorials (11 and 10 figures), polygons visible in both planes
  • Smoke: 2/2 pass via the repo harness (run_python.py howtolens scripts --list <touched>)
  • check_tutorials_complete.py passes (39 scripts)
  • CI green

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

https://claude.ai/code/session_016o9DxkjAvvpRAApQhRQBEM

…ctions fixed (image-source-mappings P3, autolens_workspace#525)

tutorial_2_mappers.py: drop the "SLIGHTLY BUGGY" warning; replace the four
dead `slim_indexes_for_pix_indexes` blocks with `mapper.mappings_from` and
draw the resulting `Mapping` objects via `subplot_image_and_mapper(regions=)`,
so each source-plane cell and the image-plane regions it maps to share a
colour. The point-level `indexes=` block now actually plots, in both planes.
Hard-coded mesh indexes are clamped with `min(index, mapper.pixels - 1)`.

tutorial_3_inversions.py: the same dead block now draws the five random
mappings it always described.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016o9DxkjAvvpRAApQhRQBEM
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Sep 3, 2026
@Jammy2211
Jammy2211 merged commit 723f26c into main Sep 3, 2026
7 checks passed
@Jammy2211
Jammy2211 deleted the feature/image-source-mappings-p3 branch September 3, 2026 23:09
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Oct 7, 2026
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