Repository navigation
docs: draw the mask overlay in ch3 tutorial 3 by plotting after apply_mask - #79
Merged
Merged
Conversation
…_mask Two `aplt.plot_array` calls in chapter_3_pixelizations/tutorial_3_inversions.py sat above their `dataset.apply_mask(mask=mask)`, so the figure the prose introduces right after building an annular mask showed no mask at all. `plot_array` derives its overlay from the array's own mask one layer down (`auto_mask_edge`), which returns None for a fully-unmasked array. The tutorial runs green, which is why it went unnoticed. Each site now applies the mask before it plots, and each relocated figure is retitled "Image Data With Mask Applied" — the canonical idiom — instead of the bare "Data" it inherited. At the second site that also removes a duplicate: the two figures were byte-identical because `dataset` was unchanged between them. Site one reads better for the move: the docstring "We now create the masked source-plane grid via the tracer" was introducing `apply_mask`, and now sits directly above the tracer block it describes. The genuine raw-data figure before any mask exists is left in place. Notebook regenerated via PyAutoHands; the navigator catalogue is unchanged (it records paths, header summaries and __Contents__ names, none of which moved). Closes #78 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0119sx8hEa8cDa8c2q55FtmM
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
Two
aplt.plot_arraycalls inchapter_3_pixelizations/tutorial_3_inversions.pysat above theirdataset.apply_mask(mask=mask), so the figure the prose introduces right after building an annular mask showed no mask at all.plot_arrayderives its overlay from the array's own mask one layer down (autoarray/plot/array.py→if mask is None: mask = auto_mask_edge(array)), andauto_mask_edgereturnsNonefor a fully-unmasked array. The tutorial runs green — that is why it went unnoticed. The reader was told about the mask and then shown a plain image.Each site now applies the mask before it plots, and each relocated figure is retitled
"Image Data With Mask Applied"(the canonical idiom, perautogalaxy_workspace/markdown/ellipse/fit.md) instead of the bare"Data"it inherited. At the second site that also removes a duplicate: the two figures were byte-identical, becausedatasetwas unchanged between them.Reproduced on a live stack (autolens 2026.9.8.1) with the tutorial's own 0.5″/2.8″ annulus:
Sibling fix to HowToGalaxy#56, where this was first spotted.
Scripts Changed
scripts/chapter_3_pixelizations/tutorial_3_inversions.py— moved both pre-apply_maskplot_arraycalls below theirapply_maskand retitled them"Image Data With Mask Applied"; the genuine raw-data figure before any mask exists is left in place.Notebook regenerated via PyAutoHands (
notebooks/chapter_3_pixelizations/tutorial_3_inversions.ipynb). The navigator catalogue (llms-full.txt,workspace_index.json) regenerates byte-identical — it records each script's path, header summary and__Contents__names, none of which moved.Prose
At site one the fix reads better than a straight figure-move would: the docstring "We now create the masked source-plane grid via the tracer" was introducing
apply_mask, and now sits directly above thelens_galaxy/tracer/source_plane_gridblock it actually describes. The mask docstring gained ", and apply it to the dataset", and the relocated figure got a short intro in the tutorial's voice. At site two the blanket docstring ("This code is doing all the same as above…") still reads correctly and is left verbatim, with no docstring added so the block stays one notebook cell.Test Plan
scripts/chapter_3_pixelizations/tutorial_3_inversions.pyruns green under CI's exact smoke env (every default fromconfig/build/profile_smoke.yaml+MPLBACKEND=Agg): exit 0, zero tracebacks, Python 3.12.3. The script is not inconfig/build/no_run.yaml, so this is whatsmoke_tests.ymlexecutes.git statusbyte-identical, md5sums of the notebook and both catalogue files identical between runs)..ipynb: at site one,apply_mask(cell 9) → new markdown intro (10) → retitledplot_array(11) → tracer prose (12) → tracer code (13). No cell-id or execution-count churn.smoke_tests.ymlon Python 3.12 and 3.13 — only 3.12 was run locally.navigator_check.yml,tutorials_complete.yml.Not verified: the rendered PNG was not eyeballed.
auto_mask_edgewas confirmed to return a real edge array at the point each relocated call now runs, which is the mechanism the figure depends on.Closes #78
Generated by the PyAutoLabs agent workflow.
Generated by Claude Code