Skip to content

docs: restore the imaging simulator @jax.jit recipe and put it under CI - #382

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/restore-imaging-jax-recipe
Jul 30, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/restore-imaging-jax-recipe

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

PyAutoLabs/PyAutoArray#421 (merged e994485c) fixed the imaging simulator's
@jax.jit path. These docs still said it "does not currently work" — true when
#379 shipped, false now. This restores the recipe and puts it under CI.

Closes #381.

The CI half is the actual point

This is the fourth task in one arc (#368 → PyAutoGalaxy#536 → #379 →
PyAutoArray#421), and every generation traced to the same root cause: a
documented JAX recipe that no script executes will be wrong.

The old __JAX Variant__ section had the call commented out —
# dataset_jax = simulate(tracer) — so nothing ever ran it. That is exactly how a
broken recipe survived in the docs unnoticed. Restoring the prose without
executing it would rebuild the trap.

No simulator.py was in smoke_tests.txt (verified before starting), so
uncommenting alone buys zero CI coverage. imaging/simulator.py is therefore
added to the smoke list, and the summary count rises 17 → 18, confirming the
entry is picked up rather than silently ignored.

That is a real cost — one more entry on the per-PR gate — and it is deliberate: it
is the only mechanism that makes CI execute the recipe.

What the restored recipe says

Registration is still the caller's job, and the reason is kept: JAX flattens a
jitted function's arguments at trace time, before entering the callee, so a
simulator that registered internally would already be too late.
PyAutoArray#421 changed only what happens after registration — it did not make
registration automatic, and cannot.

Scripts Changed

  • scripts/imaging/simulator.py — restored the @jax.jit simulate cell with the register_tracer_classes(tracer) setup line, uncommented dataset_jax = simulate(tracer), and print the backing type so the CI log shows the claim being exercised
  • scripts/guides/using_jax.py — __Writing @jax.jit Yourself__ item 1 now carries the working recipe and notes that scripts/imaging/simulator.py runs it under CI
  • scripts/group/simulator.py, scripts/multi_galaxy/simulator.py — stubs no longer say the jitted wrap fails
  • smoke_tests.txt — + imaging/simulator.py

Notebooks, llms-full.txt and workspace_index.json regenerated.

Deliberately unchanged — still accurate

  • scripts/interferometer/simulator.py and the interferometer paragraph in the guide. PyAutoArray#421 explicitly excluded that path: TransformerDFT fails at the jit boundary because Interferometer is not a registered pytree, and TransformerNUFFT fails at operators/transformer.py:660. Tracked in PyAutoArray.
  • scripts/point_source/simulator.py, scripts/cluster/simulator.py — already correct.

Test Plan

  • scripts/imaging/simulator.py runs end-to-end; the uncommented jitted call executes and reports data backing type is ArrayImpl (a real jax.Array)
  • Smoke tests 18/18 passed — up from 17, so the new entry is genuinely being run
  • scripts/check_sizes.sh clean
  • Notebooks regenerated

Note

autogalaxy_workspace PR #184 is open and touches the generated artifacts; no
source overlap, and whichever merges last re-runs generate.py.

Generated by the PyAutoLabs agent workflow.

PyAutoArray#421 (merged e994485c) fixed the imaging simulator's @jax.jit path.
These docs still said it "does not currently work" — true when #379 shipped,
false now.

The CI half is the point. This is the fourth task in one arc (#368 ->
PyAutoGalaxy#536 -> #379 -> PyAutoArray#421), and every generation traced to the
same root cause: a documented JAX recipe that no script executes will be wrong.
The old __JAX Variant__ section had its call commented out
(`# dataset_jax = simulate(tracer)`), which is exactly why a broken recipe
survived unnoticed. Restoring the prose without executing it would rebuild the
trap.

No simulator.py was in smoke_tests.txt, so uncommenting alone would buy zero CI
coverage. imaging/simulator.py is added to the smoke list; the summary rises
17 -> 18, confirming the entry is genuinely run (5.3s, so the per-PR cost is
negligible).

Registration remains the caller's job, with the reason kept: JAX flattens a
jitted function's arguments at trace time, before entering the callee, so a
simulator that registered internally would already be too late. PyAutoArray#421
changed only what happens AFTER registration; it did not make registration
automatic, and cannot.

Interferometer is deliberately left saying the jitted path does not work —
PyAutoArray#421 excluded it, and it is still broken there (TransformerDFT at the
jit boundary, TransformerNUFFT at transformer.py:660).

Closes #381

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CWqjHGXUut25TEB8octU8H
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Jul 30, 2026
@Jammy2211
Jammy2211 merged commit ff6f1c8 into main Jul 30, 2026
8 checks passed
@Jammy2211
Jammy2211 deleted the feature/restore-imaging-jax-recipe branch July 30, 2026 10:06
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Oct 7, 2026
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.

docs: restore the imaging simulator @jax.jit recipe and put it under CI

1 participant