fix: repair three stale plot API calls in chapter 4 tutorial 3 - #57
Merged
Conversation
The tutorial crashed in workspace-smoke with 'TypeError: plot_array() got an unexpected keyword argument mask' (cloud#30858578587). Two further stale-API breaks sat behind it, hidden because execution stopped at the first. - plot_array(mask=...): the aplt wrapper has no 'mask' parameter. The overlay is auto-derived from array.mask one layer down, but returns None for an unmasked array -- which is why the kwarg was added. Moving the call below apply_mask restores the intended mask boundary with no kwarg. - aplt.subplot_image_and_mapper: not re-exported by autogalaxy.plot. It lives in autoarray.plot, which tutorial_2_mappers.py in this same chapter already imports as 'aaplt'. - inversion.reconstruction_to_native: no longer exists; the plottable Array2D is mapped_reconstructed_operated_data. Also drops a private-path import of subplot_of_mapper in favour of the public aaplt export, so one import covers both helpers. All five chapter_4_pixelizations tutorials verified green locally. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 4, 2026
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
Fixes the workspace-smoke failure in the public
chapter_4_pixelizationsteaching notebook:Reported from PyAutoHeart workspace-smoke run 30858578587, job
smoke / run_notebooks (3.12, howtogalaxy, chapter_4_pixelizations), 2026-08-03. That run installed released autolens 2026.7.29.2; the newer 2026.8.4.1 does not fix it — PyAutoGalaxymainis at the release commitbf91c570and the wrapper still rejectsmask.The caller was wrong, not the signature, so no library change is involved.
Two further stale-API breaks were hidden behind the reported one, because execution stopped at the first. The tutorial is only green now because it was re-run after each fix:
plot_array(..., mask=mask)autogalaxy/util/plot_utils.py:124has nomaskparam. The overlay is auto-derived fromarray.maskatautoarray/plot/array.py:128, butauto_mask_edgereturnsNonefor an unmasked array — and the call sat beforeapply_mask.apply_mask, drop the kwargaplt.subplot_image_and_mapperautogalaxy.plot; lives inautoarray.plotaaplt.— the conventiontutorial_2_mappers.pyin this same chapter already usesinversion.reconstruction_to_nativemapped_reconstructed_operated_data(the plottableArray2D)Moving the plot rather than deleting the kwarg restores the mask boundary the author intended, measured on the installed stack:
The private-path import
from autoarray.inversion.plot.inversion_plots import subplot_of_mapperis also replaced by the publicaapltexport, so one import now covers both helpers.A sweep of every
.pyand.ipynbacross all ~25 workspace repos found themask=kwarg at exactly one logical site — HowToLens and HowToFit are clean.Scripts Changed
scripts/chapter_4_pixelizations/tutorial_3_inversions.py— movedplot_arraybelowapply_maskand droppedmask=; repointedsubplot_image_and_mapperandsubplot_of_mapperataaplt; replacedinversion.reconstruction_to_nativewithmapped_reconstructed_operated_datanotebooks/chapter_4_pixelizations/tutorial_3_inversions.ipynb— regenerated from the script via PyAutoHands (not hand-edited)Test Plan
chapter_4_pixelizationstutorials run green locally (the failing CI job covers the whole chapter, not just tutorial 3)plot_arraykwargs (it correctly still flagged the notebook until it was regenerated)Follow-ups filed (not in this PR)
HowToLensch4 t3 plots beforeapply_maskat lines 76/190, so its mask overlay never draws. Not a crash — a quality gap.aplt.Outputdrift inautocti_workspace_test(unverified — different library) andeuclid_strong_lens_modeling_pipeline.Generated by the PyAutoLabs agent workflow.