Skip to content

fix: drop stale enable_pytrees/register_model advice from searches/mcmc.py - #185

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/stale-enable-pytrees-advice
Nov 14, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/stale-enable-pytrees-advice

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

scripts/searches/mcmc.py told users to call enable_pytrees() / register_model(model) before running BlackJAXNUTS. Neither function is on af, and Fitness.__init__ (PyAutoFit autofit/non_linear/fitness.py:329-333) already calls both for any JAX analysis. scripts/searches/mle.py already says no registration is needed. The BlackJAXNUTS prose now names use_jax=True as the only requirement, and the import and the two calls are gone. The notebook was regenerated with PyAutoHands generate.py. The PyAutoFit half of the bug (the NUTS/SMC error strings) was already fixed on main.

Closes #184

Scripts Changed

  • scripts/searches/mcmc.py: dropped the stale pytree-registration requirement from the BlackJAXNUTS prose, and removed the enable_pytrees / register_model import and calls
  • notebooks/searches/mcmc.ipynb: regenerated from the script

Test Plan

  • autofit_workspace smoke (.github/scripts/run_smoke.py): 8/8 scripts and 2/2 notebooks pass, including searches/mcmc.py and searches/mcmc.ipynb
  • A real BlackJAXNUTS fit (100 warmup, 100 samples, use_jax=True, no manual registration) recovers centre 49.99, normalization 9.98, sigma 9.98 against true values of 50, 10, 10
  • With use_jax=False, BlackJAXNUTS raises a SearchException that names use_jax=True only

Validation checklist (--auto run — plan was not pre-approved)

  • Effective level: safe (header: safe, cap: bug → safe)
  • Plan: on the issue (fix: drop stale enable_pytrees/register_model advice from searches/mcmc.py #184), written at start, unmodified since
  • Gate: tests n/a (autofit_workspace has no test suite; no library change) · smoke 8/8 scripts + 2/2 notebooks · review CLEAN from a fresh Opus reviewer (witness both halves basis-cited; the auto-registration prose claim basis-cited from fitness.py:329-333 and a run; notebook-equals-generator basis-cited) · adversary (Sonnet, a different model) found every claim held, with one minor note: the autofit/jax/__init__.py:9 module docstring still mentions enable_pytrees. That docstring covers calling jax.jit by hand and is the library end state the prompt's 2026-11-05 re-scope accepted, so there is no change here · Heart dev-ship --repos autofit_workspace GREEN (shown, non-blocking: PyAutoLens dirty checkout, manifest drift ×2, PyAutoArray PR 10d old, release rehearsal stale — all within the shift's heart-ack)
  • Witness: PASS (no enable_pytrees hits in autofit_workspace/scripts/searches/; the library hits are internal only; the use_jax=False error names use_jax=True only)
  • Tier: glance — merge mode: auto-merge on green if the Witness passes, post-merge summary
  • Human: plan sound in hindsight?
  • Human: diff matches plan (no scope creep)?
  • Human: merge, amend, or reject — then log the outcome

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

…mc.py

Fitness.__init__ registers the model as a JAX pytree internally, so the
BlackJAXNUTS example no longer tells users to call enable_pytrees() /
register_model(model), which are not on the af namespace. The prose now
names use_jax=True as the only requirement, matching searches/mle.py.
Notebook regenerated with PyAutoHands generate.py.

Closes #184

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211
Jammy2211 merged commit 5267644 into main Nov 14, 2026
7 checks passed
@Jammy2211
Jammy2211 deleted the feature/stale-enable-pytrees-advice branch November 14, 2026 12:38
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.

fix: drop stale enable_pytrees/register_model advice from searches/mcmc.py

1 participant