Skip to content

fix: decouple chapter 4 mesh shape from image resolution - #59

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/howtogalaxy-ch4-mesh-shape
Aug 4, 2026
Merged

fix: decouple chapter 4 mesh shape from image resolution#59
Jammy2211 merged 1 commit into
mainfrom
feature/howtogalaxy-ch4-mesh-shape

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Decouples the chapter 4 pixelization mesh from image resolution.

scripts/chapter_4_pixelizations/tutorial_3_inversions.py:82 built the mesh with shape=dataset.shape_native, tying mesh size to the image: 10000 mesh pixels at full resolution, but only 256 under PYAUTO_SMALL_DATASETS, which every automated run sets. The tutorial's pix_indexes = [[445], [285], [313], [132], [11]] (line 140) then index past the end:

IndexError: list index out of range
  mapper.slim_indexes_for_pix_indexes(pix_indexes=pix_indexes)

The indices are not at fault. They match the 625-pixel mesh of HowToLens/scripts/chapter_4_pixelizations/tutorial_3_inversions.py:102 (shape=(25, 25)) that they were copied from — and this file's own line 176 already uses shape=(25, 25). Line 82 was the anomaly.

mesh shape pixels index 445
full resolution dataset.shape_native → 100×100 10000
PYAUTO_SMALL_DATASETS=1 dataset.shape_native → 16×16 256
this PR (25, 25) 625 ✅ always

Why this is urgent, and separate from #58

This was masked until now: before #57 the script died earlier on plot_array() got an unexpected keyword argument 'mask', so the IndexError was unreachable.

PyAutoHands' notebook runner resolves the same config/build/profile_smoke.yaml (run.pyfind_profile), so without this change PyAutoHeart's next weekly run fails this notebook with IndexError instead of TypeError and stays red. #57 fixed the reported error; this finishes the job.

It is deliberately split from #58 (the smoke-coverage rework) so a one-line unblock does not wait on review of a three-repo CI change.

Scripts Changed

  • scripts/chapter_4_pixelizations/tutorial_3_inversions.pyshape=dataset.shape_nativeshape=(25, 25)
  • notebooks/chapter_4_pixelizations/tutorial_3_inversions.ipynb — regenerated via PyAutoHands (not hand-edited)

Test Plan

  • All five chapter_4_pixelizations tutorials green under the exact CI smoke profile (the one Heart uses), from a deleted dataset/ so nothing stale was inherited
  • tutorial_3 is 19× faster under that profile: 8.2s vs 156.7s
  • Reconstruction sanity-checked at full resolution — 84% non-zero, all finite, max comparable to the previous mesh (20.15 vs 19.02), so this is not a silent science change
  • Smoke tests pass for all affected workspaces

Generated by the PyAutoLabs agent workflow.

tutorial_3_inversions built its pixelization mesh with
shape=dataset.shape_native, tying mesh size to image resolution: 10000
mesh pixels at full resolution but only 256 under PYAUTO_SMALL_DATASETS,
which every automated run sets. The tutorial's pix_indexes of
[[445], [285], [313], [132], [11]] then index past the end -> IndexError.

The indices are not at fault. They match the 625-pixel mesh of
HowToLens/scripts/chapter_4_pixelizations/tutorial_3_inversions.py:102
(shape=(25, 25)) that they were copied from, and this file's own line 176
already uses shape=(25, 25). Line 82 was the anomaly.

This was previously masked: before #57 the script died earlier on
'plot_array() got an unexpected keyword argument mask', so the IndexError
was unreachable. PyAutoHands' notebook runner resolves the same
config/build/profile_smoke.yaml, so without this change PyAutoHeart's next
weekly run would fail this notebook with IndexError instead of TypeError
and stay red.

Verified: all five chapter_4_pixelizations tutorials green under the CI
smoke profile, and tutorial_3 is 19x faster there (8.2s vs 156.7s).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Aug 4, 2026
@Jammy2211
Jammy2211 merged commit d17251e into main Aug 4, 2026
6 checks passed
@Jammy2211
Jammy2211 deleted the feature/howtogalaxy-ch4-mesh-shape branch August 4, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant