Skip to content

test: cap the chapter-3 source meshes with the data under PYAUTO_SMALL_DATASETS (epic phase 8) - #77

Merged
Jammy2211 merged 1 commit into
mainfrom
claude/ci-test-timing-epic-ke2lul
Sep 6, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
claude/ci-test-timing-epic-ke2lul

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Part of autolens_workspace#536 — phase 8 of the ci-timing-fast-tests epic (PyAutoMind draft/feature/pyautoheart/ci_timing_fast_tests_epic.md): the user-workspace + HowTo slow-script pass driven by the ingested per-script timings.

Summary

Three chapter-3 tutorials reconstructed a 1600-pixel rectangular source from 80 unmasked image pixels under the smoke cap: PYAUTO_SMALL_DATASETS=1 shrinks the data to 16×16 but nothing capped the model, so the capped run solved a harder, more degenerate inversion than the real one (fnnls_cholesky 4.5 s + cholinsertlast_inplace 1.7 s per fit). The mesh shape now follows the data:

mesh_shape = (
    al.util.dataset.SMALL_DATASETS_SHAPE_NATIVE
    if dataset.shape_native == al.util.dataset.SMALL_DATASETS_SHAPE_NATIVE
    else (40, 40)
)

It reads the cap back off the loaded dataset (the idiom these tutorials already use for the pixel scale) with the library's existing constant — no new environment variable, no env read in a tutorial, no prose changed, and nothing a reader sees changes: with the cap unset the dataset is (100, 100) and the mesh stays (40, 40) (verified).

  • chapter_3_pixelizations/tutorial_6_borders.py — 1 site
  • chapter_3_pixelizations/tutorial_4_bayesian_regularization.py — 4 sites
  • chapter_3_pixelizations/tutorial_3_inversions.py — 1 site (not on the issue list; the identical finding in the same folder)

Notebooks regenerated and committed alongside.

Measured (this container, warm numba cache, smoke profile, the repo's own smoke runner)

script before after
tutorial_6_borders.py 14.0 s 4.5 s
tutorial_4_bayesian_regularization.py 10.0 s 4.2 s
tutorial_3_inversions.py 7.7 s 4.1 s
suite (50 scripts) ~201 s 182.2 s, 50/50 pass

CI record before (run 33908175450): 219.3 s; the PR's own run is the after. The remaining time on this repo is the per-process import floor (47 of 50 scripts under 10 s; 4.3–4.8 s warm), which no workspace change can move.

Context from the diagnosis (on the issue)

The "4–6× slower locally" gap the issue opened with was a cold numba cache plus the should_simulate re-simulation subprocess, not any script; warm, the local suite agrees with CI per script. The category (a) findings — work a PYAUTO_* variable should have suppressed — were traced to unguarded library calls and are filed as library prompts, not applied here.

Test Plan

  • Local smoke suite before/after (50/50 pass both)
  • Cap unset: dataset (100, 100), mesh (40, 40) — reader-facing behaviour unchanged
  • The gate's two Python legs

🤖 Generated with Claude Code

https://claude.ai/code/session_0151gQm9fk3XGLi5f18Urdba


Generated by Claude Code

…epic phase 8)

Three chapter 3 tutorials build a 40 x 40 `RectangularBilinearAdaptDensity`
mesh. `Grid2D.uniform` and `Mask2D.circular` both honour
`PYAUTO_SMALL_DATASETS=1` and cap to `SMALL_DATASETS_SHAPE_NATIVE`, but a
pixelization's `shape=` does not, so a capped smoke run reconstructs 1600
source pixels from the 80 unmasked image pixels a 16 x 16 image leaves — an
inversion 20x over-parameterised against its own data, solved by the NNLS
Cholesky path on every fit.

`mesh_shape` reads the cap back off the loaded dataset, the way the workspace
scripts already read the pixel scale back off it, and uses the existing
`al.util.dataset.SMALL_DATASETS_SHAPE_NATIVE` constant. A full-resolution run
— every run a reader will do — is unchanged at 40 x 40, so the prose, the
figures and what each tutorial demonstrates are untouched.

Measured in a warm container under the smoke profile:

  tutorial_6_borders.py                14.0 s -> 4.5 s
  tutorial_4_bayesian_regularization.py 10.0 s -> 4.2 s
  tutorial_3_inversions.py              7.7 s -> 4.1 s

Full smoke suite 50/50 PASS, 182.2 s (was ~201 s); no assertion, tolerance or
allowlist entry touched. Notebooks regenerated.

The systemic form of this — capping mesh `shape` in PyAutoArray beside the
grid and mask, which would reach ~28 further call sites — is proposed
separately and routes through the library-first gate; this guard resolves to
the same shape and is harmless if that lands.

Refs PyAutoLabs/autolens_workspace#536

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151gQm9fk3XGLi5f18Urdba
@Jammy2211
Jammy2211 merged commit 3d60e73 into main Sep 6, 2026
7 checks passed
@Jammy2211
Jammy2211 deleted the claude/ci-test-timing-epic-ke2lul branch September 6, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants