Skip to content

test_mode: add disable_jax() predicate and stamp the small-datasets cap shape into FITS headers - #160

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

Closes #159. Phase 8c (library leg) of the ci-timing-fast-tests epic (PyAutoMind draft/feature/pyautoheart/ci_timing_fast_tests_epic.md) — the Nerves half of two findings from the phase-8 user-workspace smoke diagnosis (autolens_workspace#536). The PyAutoArray PR (PyAutoArray#528) reads the card and uses the predicate; this one lands first (library-first).

Summary

  • autonerves/test_mode.py: disable_jax() — the predicate for PYAUTO_DISABLE_JAX=1, documented beside small_datasets(). Until now the variable was read by a bare os.environ.get in exactly one place in the stack while two workspace guides document it as the global switch.
  • autonerves/fitsable.py: beside SMALLDAT, stamp_small_datasets_regime now writes a SMALLSHP card ("<rows>x<cols>") under the cap, recording the cap shape in force in the writing process. Absent on every file written before this card existed; readers treat absence as unknown (today's behaviour). This is what lets autoarray.util.dataset_util stop re-simulating capped interferometer / multi_dataset datasets on every run (~26 s per autolens_workspace CI run, ~28 s per autogalaxy_workspace run) — those families cannot corroborate SMALLDAT by shape.
  • Tests for both regimes of the stamp and for the predicate (182 pass).

Test Plan

  • python3 -m pytest -q -n auto — 182 passed
  • lib-tests.yml on the PR (both Python legs)

🤖 Generated with Claude Code

https://claude.ai/code/session_0151gQm9fk3XGLi5f18Urdba


Generated by Claude Code

…ap shape

Two harness-level facts the base layer owns but did not expose.

`PYAUTO_DISABLE_JAX` is documented by the workspace guides as the global
switch for forcing the NumPy path, but had no predicate beside
`small_datasets()` and friends — which is why it was read by a bare
`os.environ.get` in exactly one place in the whole stack while
`apply_sparse_operator` ignored it. `disable_jax()` gives it the same shape
as every other `PYAUTO_*` switch, compared against the exact string "1".

`SMALLDAT = T` records "the env var was set at write time", which is not the
proposition a reader deciding whether to reuse a dataset asks — that one is
"capped at today's cap". Readers therefore had to corroborate the card
against the measured shape of `data.fits`, which interferometer data
`(n_visibilities, 2)` and multi_dataset's prefixed `{waveband}_data.fits`
structurally cannot do, so those families are deleted and re-simulated on
every run. `SMALLSHP` records the cap itself (`"<rows>x<cols>"`), written
only in the capped regime, so absence keeps meaning "unknown" and readers
fall back to what they did before.

On the import direction the issue raises: autonerves does not import
autoarray, at module level or lazily. The cap shape constant now has its
canonical home here in `test_mode`, beside the regime switch it belongs to
and one layer below the library that applies it; `autoarray` keeps its own
literal of the same value, for the reason already recorded there against
`SMALL_DATASETS_HEADER_KEY` — a `--no-deps` or editable install can put a
pre-stamp autonerves on the path, where a literal degrades safely ("card
absent" -> the shape heuristic) and an import would be an `ImportError` at
module load. The drift guard the duplication needs is a test in that repo,
which can see both constants.

Refs #159

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151gQm9fk3XGLi5f18Urdba
@Jammy2211
Jammy2211 merged commit efe7c04 into main Sep 6, 2026
3 checks passed
@Jammy2211
Jammy2211 deleted the claude/ci-test-timing-epic-ke2lul branch September 6, 2026 16:15
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.

test_mode: a disable_jax() predicate beside small_datasets(), and stamp the small-datasets cap shape into FITS headers

2 participants