feat: Phase 3 — mirror Nautilus profiling scripts#8
Merged
Conversation
…ase 3)
Phase 3 of the autolens_profiling z_feature roadmap. Stands up
autolens_profiling/searches/ with profiling for the Nautilus sampler
only, mirrored from autolens_workspace_developer/searches_minimal/.
Designs the folder layout so other samplers (Dynesty, Emcee, BlackJAX,
NumPyro, PocoMC, NSS, LBFGS) can slot in cleanly under their own
follow-up prompts.
Files mirrored (4 copies from clean origin/main of _developer):
searches_minimal/_setup.py -> searches/_setup.py
searches_minimal/_metrics.py -> searches/_metrics.py
searches_minimal/nautilus_simple.py -> searches/nautilus/simple.py
searches_minimal/nautilus_jax.py -> searches/nautilus/jax.py
Path rewrites in _setup.py:
- _DATASET_SUBPATH:
Path("jax_profiling") / "dataset" / "imaging" / "hst"
-> Path("dataset") / "imaging" / "hst"
- Replaced the if al.util.dataset.should_simulate(...) subprocess block
(which invoked _developer's dataset_setup/imaging.py) with a clean
FileNotFoundError pointing back at _developer for regeneration —
matches the Phase 1 pattern.
- Dropped now-unused subprocess + sys imports.
- Docstring example: `from searches_minimal._setup` -> `from searches._setup`
- Cross-reference: `jax_profiling/imaging/mge.py` -> `likelihood/imaging/mge.py`
Import rewrites in nautilus/simple.py and nautilus/jax.py:
- `from searches_minimal._{metrics,setup}` -> `from searches._{metrics,setup}`
- Added sys.path injection at top so scripts work whether run as
`python searches/nautilus/<name>.py` or `python -m searches.nautilus.<name>`.
Output convention upgrade (both Nautilus scripts):
- Originals wrote a freeform `<script>_summary.txt` to `output/`.
- New: write versioned JSON + bar-chart PNG to
`results/searches/nautilus/<script>_summary_v<al.__version__>.{json,png}`
matching Phase 1's convention. JSON carries sampler config, results,
performance, and convergence sections plus the al.__version__ tag.
PNG is a horizontal bar chart of headline timings (wall time, time
per eval, time to ML; plus JIT compile time on jax.py).
READMEs:
- searches/README.md: replaces Phase 0 placeholder. Section overview,
why bypass af.NonLinearSearch, shared _setup / _metrics roles,
supported-samplers table (Nautilus ✓, others "planned"), versioned
artifact convention, run instructions.
- searches/nautilus/README.md: per-sampler narrative grounded in
_developer/searches_minimal/sweep_findings.md — expected behaviour
(converged logZ ≈ -169k for this MGE setup), caveats (upstream JAX-
gradient pathology #514), headline-run-times table placeholder for
Phase 4 to auto-populate.
Smoke status: ran py_compile across all 4 files (PASS), verified no
residual `searches_minimal` references in the mirrored scripts. Full
runtime smoke (`python searches/nautilus/simple.py` end-to-end) was
intentionally skipped — n_live=200 takes 30+ min on CPU and Phase 5
will add the AUTOLENS_PROFILING_SMOKE=1 short-circuit that makes this
cheap forever. Static checks + matching the Phase 1/2 pattern give
sufficient confidence to ship.
F1 lesson applied: copies came from the worktree's clean origin/main
of _developer (NOT the canonical, which is dirty with ~36 modified
files).
Closes #5.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 16, 2026
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
Phase 3 of the autolens_profiling z_feature roadmap — stands up
autolens_profiling/searches/with sampler profiling for the Nautilus sampler only, mirrored fromautolens_workspace_developer/searches_minimal/. Other samplers (Dynesty, Emcee, BlackJAX, NumPyro, PocoMC, NSS, LBFGS) are explicitly out of scope; the folder layout is designed so they slot in under their own follow-up prompts._developerstays the source of truth — the originals do not move.Closes #5.
What changed
origin/mainof_developer/searches_minimal/:_setup.py(shared dataset/model/analysis builder) →searches/_setup.py_metrics.py(MLTrackerfor evals/time to ML) →searches/_metrics.pynautilus_simple.py(NumPy backend) →searches/nautilus/simple.pynautilus_jax.py(JAX-JIT'd likelihood) →searches/nautilus/jax.py_setup.py:_DATASET_SUBPATH:Path(\"jax_profiling\") / \"dataset\" / \"imaging\" / \"hst\"→Path(\"dataset\") / \"imaging\" / \"hst\"(matches Phase 1's top-level layout).should_simulatesubprocess block (which invoked_developer/jax_profiling/dataset_setup/imaging.py) with a cleanFileNotFoundErrorpointing readers back at_developerfor regeneration — same pattern Phase 1 used.subprocess+sysimports.from searches._setup,likelihood/imaging/mge.py).nautilus/{simple,jax}.py:from searches_minimal._{metrics,setup}→from searches._{metrics,setup}.sys.pathinjection at the top of each script (_REPO_ROOT = Path(__file__).resolve().parents[2]) so they work invariant to invocation style (python searches/nautilus/<name>.pyorpython -m searches.nautilus.<name>).<script>_summary.txttooutput/. The mirror writes versioned JSON + bar-chart PNG toresults/searches/nautilus/<script>_summary_v<al.__version__>.{json,png}matching the Phase 1 convention so Phase 4's dashboard can pick them up.sampler,backend,instrument,model,sampler_config,results,performance,convergence,version.wall_time,time_per_eval,time_to_ml; plusjit_compileonjax.py).searches/README.md(replaces Phase 0 placeholder): section overview, shared helper roles, supported-samplers table (Nautilus ✓, 7 others marked planned), versioned-artifact convention, run instructions.searches/nautilus/README.md: narrative grounded in_developer/searches_minimal/sweep_findings.md— expected converged logZ ≈ -169k for this MGE setup, caveats (upstream JAX-gradient pathology PyAutoLens#514), headline-run-times table placeholder for Phase 4.F1 lesson applied
Copies came from the worktree's clean
origin/mainof_developer, NOT the canonical (which is currently dirty with ~36 modified files). This is the same lesson that prompted F1's re-mirror PR #3 for Phase 1.Test plan
py_compilePASSES for all 4 mirrored files (_setup.py,_metrics.py,nautilus/simple.py,nautilus/jax.py).grep -r searches_minimalon the mirroredsearches/returns no residual references — only the section README references the upstream folder by name in context.sys.pathinjection lets both scripts resolvefrom searches._{setup,metrics}regardless of cwd / invocation style..gitignorealready coversresults/searches/from Phase 1 — smoke artifacts won't leak.python searches/nautilus/simple.pyat defaultn_live=200takes 30+ min on CPU. Phase 5 (issue #7) will add theAUTOLENS_PROFILING_SMOKE=1env-var short-circuit that makes future smokes cheap; until then the static checks above + the matching pattern with Phase 1's already-shipped scripts give sufficient confidence to ship. The Nautilus scripts can be smoked manually after this lands by running them with whatevern_livethe user wants.Refs
🤖 Generated with Claude Code