Commit 499e087
committed
small datasets: honour the cap card, the JAX switch and the cap in mesh shapes
Three findings of the phase-8 diagnosis of the user-workspace smoke timings,
all of them the same shape: a harness-level fact the library did not act on.
1. Capped datasets whose shape cannot corroborate their stamp were deleted and
re-simulated on every run. `_is_capped_at_the_current_cap` required
`SMALLDAT = T` *and* a measured `data.fits` at exactly the cap, because
`SMALLDAT` records "the env var was set at write time", not "capped at
today's cap". Interferometer data is `(n_visibilities, 2)`, multi_dataset
prefixes its FITS and datacubes nest theirs per channel, so none of them
could ever corroborate: 5.2-6.5 s per script, ~26 s per autolens_workspace
CI run and ~28 s per autogalaxy_workspace one, plus every local run.
The `SMALLSHP` card (PyAutoNerves#159) states the proposition directly, so
corroboration is no longer needed and those families are reachable. Two
things keep the safety property intact. The card is read *with* the
both-axes contradiction guard the full-resolution branch already applies --
both cards record the writing *process*, so a 180x180 image written in a
shell exporting `PYAUTO_SMALL_DATASETS=1` carries them while being full
resolution, and reusing it in a capped run is the shape-mismatch class the
capped branch exists to prevent. And an absent or malformed card falls back
to the shape heuristic rather than being coerced, so every pre-card dataset
behaves exactly as it did.
The path resolution (`_capped_data_paths`) is widened for the capped branch
only, by exact suffix at two known levels -- `data.fits`, then
`{waveband}_data.fits`, then `channel_*/data.fits`, never a `*.fits` glob.
The full-resolution branch still reads `data.fits` alone: widening the
capped branch can only move a dataset from delete to keep, whereas widening
the destructive one is its own change with its own review.
`test__small_regime__interferometer_dataset__is_always_regenerated` asserted
the conservative behaviour this issue exists to change, and is rewritten to
pin the half that stands: without a cap card, that family still regenerates.
2. `apply_sparse_operator(use_jax=True)` ignored `PYAUTO_DISABLE_JAX=1`, so the
smoke profile paid 2.3-3.2 s of JIT for a backend it had asked to disable.
The interferometer method now lets the harness win over an explicit `True`,
through `autonerves.test_mode.disable_jax()`.
The imaging method is deliberately left alone, and says why in its docstring:
it has no `use_jax` argument to override -- it *is* the JAX implementation,
and its NumPy sibling `apply_sparse_operator_cpu` returns a different
operator class and requires numba. Routing to that under an env var would
change the returned type based on the environment, which is a larger and
(on these measurements) unmotivated change.
3. Pixelization mesh `shape=` did not honour the cap the data does, so a capped
run reconstructed 1600-2500 source pixels from ~80 image pixels. The
rectangular meshes and `image_mesh.Overlay` now cap per axis under
`PYAUTO_SMALL_DATASETS=1`, with the same `respect_small_datasets=True`
escape hatch `Grid2D.uniform` carries. Measured on the four HowTo chapter-3
scripts whose guards this subsumes: 43.6 s -> 17.3 s.
`disable_jax` is imported defensively: an autonerves too old to carry the
predicate is exactly the case the sibling literal in `dataset_util` exists for,
and a hard import would turn a safe degradation into an `ImportError` at module
load.
Refs #528
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151gQm9fk3XGLi5f18Urdba1 parent a0e5c61 commit 499e087
12 files changed
Lines changed: 799 additions & 33 deletions
File tree
- autoarray
- dataset
- imaging
- interferometer
- inversion/mesh
- image_mesh
- mesh
- util
- test_autoarray
- dataset/interferometer
- inversion/pixelization
- image_mesh
- mesh
- util
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
602 | 602 | | |
603 | 603 | | |
604 | 604 | | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
605 | 619 | | |
606 | 620 | | |
607 | 621 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
8 | 26 | | |
9 | 27 | | |
10 | 28 | | |
| |||
266 | 284 | | |
267 | 285 | | |
268 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
269 | 295 | | |
270 | 296 | | |
271 | 297 | | |
| |||
289 | 315 | | |
290 | 316 | | |
291 | 317 | | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
292 | 321 | | |
293 | 322 | | |
294 | 323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
161 | | - | |
| 162 | + | |
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
| |||
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
179 | 184 | | |
180 | 185 | | |
181 | 186 | | |
182 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
183 | 192 | | |
184 | 193 | | |
185 | 194 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
74 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| 73 | + | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| |||
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
| |||
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
135 | 142 | | |
136 | 143 | | |
137 | 144 | | |
| |||
144 | 151 | | |
145 | 152 | | |
146 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
147 | 158 | | |
148 | 159 | | |
149 | 160 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
85 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
86 | 92 | | |
87 | 93 | | |
88 | 94 | | |
| |||
0 commit comments