Repository navigation
docs: tutorial_2_mappers draws polygons in both planes; dead index sections fixed (image-source-mappings P3) - #76
Merged
Conversation
…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
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 3 of the
image-source-mappingsepic (PyAutoLabs/autolens_workspace#525). Chapter 3'stutorial_2_mappershas said "VISUALS SLIGHTLY BUGGY" since the mapping overlays were removed in 2025: every "watch a source pixel map to the image" step computedmapper.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_inversionscarried the same dead block.The tutorial now draws what it describes. Each replaced block calls
mapper.mappings_from(pix_indexes=...)(PyAutoArray#517) and passes theMappingobjects tosubplot_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-levelindexes=block, which also never plotted, now draws the same coordinates in both planes withplot_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:RectangularBilinearAdaptDensitygives 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 aapltbecauseautolens.plot.plot_array/plot_griddo not yet forwardregions=/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 withmappings_from+subplot_image_and_mapper(regions=)polygons in both planes; point-level block now plots viaplot_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.generate.py; catalogue files byte-identical.Test Plan
run_python.py howtolens scripts --list <touched>)check_tutorials_complete.pypasses (39 scripts)Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code
https://claude.ai/code/session_016o9DxkjAvvpRAApQhRQBEM