Overview
The public HowToGalaxy teaching notebook chapter_4_pixelizations/tutorial_3_inversions crashes with TypeError: plot_array() got an unexpected keyword argument 'mask', caught by PyAutoHeart workspace-smoke (run 30858578587, job smoke / run_notebooks (3.12, howtogalaxy, chapter_4_pixelizations), 2026-08-03T22:49:33Z).
That run installed released autolens 2026.7.29.2. The newer 2026.8.4.1 release does not fix it — PyAutoGalaxy main sits at the release commit bf91c570 and the wrapper still rejects mask. This is live breakage in a user-facing tutorial.
The caller is wrong, not the signature — plus a second, larger instance of the same stale-plot-API drift was found in autolens_workspace_developer.
Plan
- Move the HowToGalaxy
plot_array call below dataset.apply_mask(...) and drop the mask= kwarg, so the mask-boundary overlay is auto-derived — preserving the author's visual intent rather than just deleting the argument.
- Regenerate the HowToGalaxy notebook and navigator catalogue from the fixed script (never hand-edit the
.ipynb).
- Repair the related
aplt.Output drift across 10 files in autolens_workspace_developer, which currently raise AttributeError before they even reach the TypeError.
- Verify by re-running the AST detector on the post-fix tree, not by trusting the pre-fix inventory.
- File a separate follow-up prompt for the same drift in
autocti_workspace_test and euclid_strong_lens_modeling_pipeline.
Detailed implementation plan
Work Classification
Workspace (both repos are workspace/tutorial repos; no library change).
Affected Repositories
- HowToGalaxy (primary)
- autolens_workspace_developer
Branch Survey
| Repository |
Current Branch |
Dirty? |
| ./HowToGalaxy |
main |
clean |
| ./autolens_workspace_developer |
main |
clean |
Neither repo is claimed by any active.md worktree — no conflict.
Suggested branch: feature/plot-array-stale-kwargs
Worktree root: ~/Code/PyAutoLabs-wt/plot-array-stale-kwargs/
Root cause
aplt.plot_array resolves to PyAutoGalaxy/autogalaxy/util/plot_utils.py:124, whose parameters are array, title, output_path, output_filename, output_format, colormap, use_log10, vmin, vmax, symmetric, positions, lines, line_colors, grid, cb_unit, ax — no mask. The overlay is derived one layer down at PyAutoArray/autoarray/plot/array.py:128 (if mask is None: mask = auto_mask_edge(array)).
auto_mask_edge returns None for a fully-unmasked array, so it draws nothing. The tutorial's call sits before apply_mask, where dataset.data is still unmasked — which is why the author reached for mask=mask. Measured on the installed stack:
unmasked -> mask.is_all_false: True | auto_mask_edge: None
after mask -> mask.is_all_false: False | auto_mask_edge: (156, 2)
So relocating the call below apply_mask restores the intended overlay with no kwarg at all.
An AST sweep of every .py and .ipynb across all ~25 workspace repos found mask= at exactly one logical site. HowToLens and HowToFit are clean.
Implementation Steps
-
HowToGalaxy/scripts/chapter_4_pixelizations/tutorial_3_inversions.py:70 — move the plot below dataset = dataset.apply_mask(mask=mask) and drop the kwarg:
dataset = dataset.apply_mask(mask=mask)
aplt.plot_array(array=dataset.data, title="Data")
Matches the canonical idiom in autogalaxy_workspace/markdown/ellipse/fit.md:158.
-
Regenerate notebooks + catalogue from the HowToGalaxy repo root:
PYTHONPATH=../PyAutoHands/autohands python3 ../PyAutoHands/autohands/generate.py howtogalaxy
Commit the regenerated .ipynb, llms-full.txt and workspace_index.json — navigator_check.yml gates them.
-
autolens_workspace_developer — aplt.Output no longer exists on the autolens/autogalaxy plot namespace (it survives only as autoarray.plot.Output); its removal was deliberate and is documented in autolens_assistant/AGENTS.md:218. Fixing only the 7 plot_array(output=...) sites would leave these scripts still crashing on adjacent calls (e.g. subplot_tracer(..., output=aplt.Output(...)) at plotting_alignment/plot/imaging/orientation/simulator.py:137-139), so repair the repo's whole drift — 10 files:
# before
aplt.plot_array(array=..., output=aplt.Output(path=P, filename=F, format="png"))
# after
aplt.plot_array(array=..., output_path=P, output_filename=F, output_format="png")
Two forms need care beyond a blind rename:
scaling_relation_agg/error_make.py:20 binds output = aplt.Output(path=".", format="png") to a variable reused at line 55 — delete the binding, inline flat kwargs at the call site.
- Flat kwargs differ per callee (
subplot_tracer has no output_filename) — check each signature.
Key Files
HowToGalaxy/scripts/chapter_4_pixelizations/tutorial_3_inversions.py — the CI failure
autolens_workspace_developer/plotting_alignment/ — 9 of the 10 drifted files
autolens_workspace_developer/scaling_relation_agg/error_make.py — the variable-bound Output
PyAutoGalaxy/autogalaxy/util/plot_utils.py:124 — the wrapper signature (read-only reference; not modified)
PyAutoArray/autoarray/plot/array.py:128 — auto mask-edge derivation (read-only reference)
Verification
- Reproduce the
TypeError on unchanged input first (done — confirmed identical to the CI trace).
- Run the tutorial from the HowToGalaxy repo root; expect a clean run and a "Data" figure carrying the circular mask boundary:
NUMBA_CACHE_DIR=/tmp/numba_cache MPLCONFIGDIR=/tmp/matplotlib \
PYAUTO_TEST_MODE=1 PYAUTO_SKIP_FIT_OUTPUT=1 PYAUTO_FAST_PLOTS=1 \
python scripts/chapter_4_pixelizations/tutorial_3_inversions.py
- Re-run the AST detector on the post-fix tree; require zero remaining out-of-signature
plot_array kwargs.
- Sweep for residual
aplt.Output in autolens_workspace_developer; expect zero.
- That repo has no smoke coverage — compile-check all 10 files, run the cheap non-fitting ones, and state in the PR which were only compile-checked.
- Regenerate notebooks last, after the script is green.
Out of scope (tracked separately)
autocti_workspace_test — 27 files with aplt.Output. Unverified: autocti is not installed locally and PyAutoCTI has its own plot namespace that may still export Output.
euclid_strong_lens_modeling_pipeline/tools/ — psf_size.py, extra_galaxies_centres_gui.py.
Confirmed not bugs: PyAutoArray/test_autoarray/plot/test_output.py (there aplt is autoarray.plot, which does export Output) and the autolens_assistant markdown documenting the removal.
Also noted, not fixed: HowToLens/scripts/chapter_4_pixelizations/tutorial_3_inversions.py:76,190 plots before apply_mask with no kwarg, so it silently draws no mask — a quality gap, not a crash.
Sizing note
The Brain Feature Agent scored this large (score 9) and advised splitting into phases. Overridden to small, no phasing: the score tracks prompt prose length rather than scope (repos_affected = 2), and its "public-API change may ripple downstream" risk does not apply since no library is modified.
Original Prompt
Click to expand starting prompt
In the PyAutoLabs workspace, HowToGalaxy chapter_4_pixelizations fails in
PyAutoHeart's workspace-smoke with:
TypeError: plot_array() got an unexpected keyword argument 'mask'
Evidence: PyAutoHeart workspace-smoke run 30858578587, job
"smoke / run_notebooks (3.12, howtogalaxy, chapter_4_pixelizations)",
2026-08-03T22:49:33Z. That run installed released autolens 2026.7.29.2;
2026.8.4.1 has since published, so first confirm whether the release
already fixes it before assuming it's live.
This is a public teaching notebook so it's user-facing. Find whether the
caller or the plot_array signature is wrong, check for sibling call sites
with the same kwarg across HowToGalaxy/HowToLens/HowToFit and the
workspaces, and fix them all. Route through start_dev.
Overview
The public HowToGalaxy teaching notebook
chapter_4_pixelizations/tutorial_3_inversionscrashes withTypeError: plot_array() got an unexpected keyword argument 'mask', caught by PyAutoHeart workspace-smoke (run 30858578587, jobsmoke / run_notebooks (3.12, howtogalaxy, chapter_4_pixelizations), 2026-08-03T22:49:33Z).That run installed released autolens 2026.7.29.2. The newer 2026.8.4.1 release does not fix it — PyAutoGalaxy
mainsits at the release commitbf91c570and the wrapper still rejectsmask. This is live breakage in a user-facing tutorial.The caller is wrong, not the signature — plus a second, larger instance of the same stale-plot-API drift was found in
autolens_workspace_developer.Plan
plot_arraycall belowdataset.apply_mask(...)and drop themask=kwarg, so the mask-boundary overlay is auto-derived — preserving the author's visual intent rather than just deleting the argument..ipynb).aplt.Outputdrift across 10 files inautolens_workspace_developer, which currently raiseAttributeErrorbefore they even reach theTypeError.autocti_workspace_testandeuclid_strong_lens_modeling_pipeline.Detailed implementation plan
Work Classification
Workspace (both repos are workspace/tutorial repos; no library change).
Affected Repositories
Branch Survey
Neither repo is claimed by any
active.mdworktree — no conflict.Suggested branch:
feature/plot-array-stale-kwargsWorktree root:
~/Code/PyAutoLabs-wt/plot-array-stale-kwargs/Root cause
aplt.plot_arrayresolves toPyAutoGalaxy/autogalaxy/util/plot_utils.py:124, whose parameters arearray, title, output_path, output_filename, output_format, colormap, use_log10, vmin, vmax, symmetric, positions, lines, line_colors, grid, cb_unit, ax— nomask. The overlay is derived one layer down atPyAutoArray/autoarray/plot/array.py:128(if mask is None: mask = auto_mask_edge(array)).auto_mask_edgereturnsNonefor a fully-unmasked array, so it draws nothing. The tutorial's call sits beforeapply_mask, wheredataset.datais still unmasked — which is why the author reached formask=mask. Measured on the installed stack:So relocating the call below
apply_maskrestores the intended overlay with no kwarg at all.An AST sweep of every
.pyand.ipynbacross all ~25 workspace repos foundmask=at exactly one logical site. HowToLens and HowToFit are clean.Implementation Steps
HowToGalaxy/scripts/chapter_4_pixelizations/tutorial_3_inversions.py:70— move the plot belowdataset = dataset.apply_mask(mask=mask)and drop the kwarg:Matches the canonical idiom in
autogalaxy_workspace/markdown/ellipse/fit.md:158.Regenerate notebooks + catalogue from the HowToGalaxy repo root:
Commit the regenerated
.ipynb,llms-full.txtandworkspace_index.json—navigator_check.ymlgates them.autolens_workspace_developer—aplt.Outputno longer exists on the autolens/autogalaxy plot namespace (it survives only asautoarray.plot.Output); its removal was deliberate and is documented inautolens_assistant/AGENTS.md:218. Fixing only the 7plot_array(output=...)sites would leave these scripts still crashing on adjacent calls (e.g.subplot_tracer(..., output=aplt.Output(...))atplotting_alignment/plot/imaging/orientation/simulator.py:137-139), so repair the repo's whole drift — 10 files:Two forms need care beyond a blind rename:
scaling_relation_agg/error_make.py:20bindsoutput = aplt.Output(path=".", format="png")to a variable reused at line 55 — delete the binding, inline flat kwargs at the call site.subplot_tracerhas nooutput_filename) — check each signature.Key Files
HowToGalaxy/scripts/chapter_4_pixelizations/tutorial_3_inversions.py— the CI failureautolens_workspace_developer/plotting_alignment/— 9 of the 10 drifted filesautolens_workspace_developer/scaling_relation_agg/error_make.py— the variable-boundOutputPyAutoGalaxy/autogalaxy/util/plot_utils.py:124— the wrapper signature (read-only reference; not modified)PyAutoArray/autoarray/plot/array.py:128— auto mask-edge derivation (read-only reference)Verification
TypeErroron unchanged input first (done — confirmed identical to the CI trace).plot_arraykwargs.aplt.Outputinautolens_workspace_developer; expect zero.Out of scope (tracked separately)
autocti_workspace_test— 27 files withaplt.Output. Unverified:autoctiis not installed locally and PyAutoCTI has its own plot namespace that may still exportOutput.euclid_strong_lens_modeling_pipeline/tools/—psf_size.py,extra_galaxies_centres_gui.py.Confirmed not bugs:
PyAutoArray/test_autoarray/plot/test_output.py(thereapltisautoarray.plot, which does exportOutput) and theautolens_assistantmarkdown documenting the removal.Also noted, not fixed:
HowToLens/scripts/chapter_4_pixelizations/tutorial_3_inversions.py:76,190plots beforeapply_maskwith no kwarg, so it silently draws no mask — a quality gap, not a crash.Sizing note
The Brain Feature Agent scored this
large (score 9)and advised splitting into phases. Overridden to small, no phasing: the score tracks prompt prose length rather than scope (repos_affected= 2), and its "public-API change may ripple downstream" risk does not apply since no library is modified.Original Prompt
Click to expand starting prompt