Repository navigation
docs: restore the imaging simulator @jax.jit recipe and put it under CI - #382
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PyAutoLabs/PyAutoArray#421 (merged
e994485c) fixed the imaging simulator's@jax.jitpath. 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 abroken recipe survived in the docs unnoticed. Restoring the prose without
executing it would rebuild the trap.
No
simulator.pywas insmoke_tests.txt(verified before starting), souncommenting alone buys zero CI coverage.
imaging/simulator.pyis thereforeadded 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 simulatecell with theregister_tracer_classes(tracer)setup line, uncommenteddataset_jax = simulate(tracer), and print the backing type so the CI log shows the claim being exercisedscripts/guides/using_jax.py—__Writing @jax.jit Yourself__item 1 now carries the working recipe and notes thatscripts/imaging/simulator.pyruns it under CIscripts/group/simulator.py,scripts/multi_galaxy/simulator.py— stubs no longer say the jitted wrap failssmoke_tests.txt—+ imaging/simulator.pyNotebooks,
llms-full.txtandworkspace_index.jsonregenerated.Deliberately unchanged — still accurate
scripts/interferometer/simulator.pyand the interferometer paragraph in the guide. PyAutoArray#421 explicitly excluded that path:TransformerDFTfails at the jit boundary becauseInterferometeris not a registered pytree, andTransformerNUFFTfails atoperators/transformer.py:660. Tracked in PyAutoArray.scripts/point_source/simulator.py,scripts/cluster/simulator.py— already correct.Test Plan
scripts/imaging/simulator.pyruns end-to-end; the uncommented jitted call executes and reportsdata backing type is ArrayImpl(a realjax.Array)scripts/check_sizes.shcleanNote
autogalaxy_workspacePR #184 is open and touches the generated artifacts; nosource overlap, and whichever merges last re-runs
generate.py.Generated by the PyAutoLabs agent workflow.