Skip to content

searches: UltraNest and PySwarms subclass NonLinearSearch (A4 companion) - #33

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/search-ext-a4-companions
Oct 14, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/search-ext-a4-companions

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Companion to PyAutoFit A4 (PyAutoLabs/PyAutoFit#1687, merged): the developer-tier UltraNest and PySwarms searches move off the deprecated AbstractNest / AbstractMLE family bases, per the "Companion changes required" text of #1687.

  • UltraNest(NonLinearSearch): samples_cls = SamplesNest, posterior_kind = WEIGHTED, produces_evidence = True, test_mode_budget = {"max_iters": 1, "max_ncalls": 1}, initializer via WEIGHTED.nested_initializer_for.
  • AbstractPySwarms(NonLinearSearch): posterior_kind = POINT, test_mode_budget = {"iters": 1}, clipper via POINT.clipper_for, initializer via POINT.initializer_for, and rng=initializer_rng(self) on its start-point draw so seed= reproduces them.
  • The is_test_mode() tails and apply_test_mode overrides are removed (the post-init hook applies test_mode_budget). globe.py / local.py unchanged.

This repo has no CI — the evidence is the local fit proof below.

Refs PyAutoLabs/PyAutoBrain#520 (closed by PyAutoLabs/PyAutoBrain#522)

Scripts Changed

  • searches/ultranest/search.py — NonLinearSearch + WEIGHTED kind + test_mode_budget
  • searches/pyswarms/abstract.py — NonLinearSearch + POINT kind + test_mode_budget + seeded initializer rng (CRLF endings preserved)

Upstream PR

PyAutoLabs/PyAutoFit#1687 (merged)

Witness results

  • searches.ultranest.search, searches.pyswarms.globe, searches.pyswarms.local import cleanly under python -W error::FutureWarning (on main both warn: "subclasses AbstractNest/AbstractMLE, which is deprecated").
  • Construct + fit under -W error::FutureWarning: PySwarmsGlobal and PySwarmsLocal FIT OK at PYAUTO_TEST_MODE=1 and =2 (budget iters=1, ClipperNone, InitializerBall); UltraNest FIT OK at PYAUTO_TEST_MODE=2 (budget max_iters=1, max_ncalls=1, InitializerPrior). UltraNest at TEST_MODE=1 hits ImportError: numpy.core.multiarray failed to import from ultranest's compiled mlfriends extension; main fails identically (numpy ABI of the local ultranest build, not this change).
  • Search identifiers (output hash folders) identical on branch and main for PySwarmsGlobal, PySwarmsLocal and UltraNest.
  • autofit_workspace_test/scripts/graphical/analytic_gaussian.py with af.DynestyStatic(seed=): PARITY: PASS (41/41) (18/18 + 23/23), run twice, parity tables identical.
  • Brain skills/sampler_pipeline/reference.md no longer names a family base, apply_test_mode or is_test_mode.

Test Plan

  • FutureWarning-free imports (python -W error::FutureWarning -c "import ...")
  • Gaussian fit at PYAUTO_TEST_MODE=1 and =2 (see Witness results; UltraNest TM=1 env ImportError reproduces on main)
  • No CI in this repo

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

  • Effective level: safe (header: safe, cap: refactor → safe); Consequence: glance
  • Plan: on the issue (refactor: A4 companions — sampler reference, developer-tier searches, seeded Dynesty helper (search-extensibility) PyAutoBrain#520), unmodified since
  • Gate: tests PyAutoBrain pytest tests/ 1258 passed; autofit_workspace_test / autofit_workspace_developer have no test dir (n/a) · smoke autofit_workspace_test smoke_tests.txt 15/15 PASS on the branch (incl. graphical/analytic_gaussian.py); the six Heart workspaces are not downstream of these repos (no library change) · review CLEAN (independent review agent; every Witness claim basis-cited, UltraNest TEST_MODE=1 env caveat stated) · Heart STALE ("release validation incomplete: no rehearsal for current source")
  • Human: plan sound in hindsight?
  • Human: diff matches plan (no scope creep)?
  • Human: merge, amend, or reject — then log the outcome

🤖 Generated with Claude Code

Move the developer-tier UltraNest (WEIGHTED) and PySwarms (POINT)
searches off the deprecated AbstractNest / AbstractMLE family bases onto
NonLinearSearch with declared posterior kinds and test_mode_budget,
replacing the apply_test_mode overrides. PySwarms draws its start points
from initializer_rng(self) so seed= reproduces them.

Refs PyAutoLabs/PyAutoBrain#520

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

1 participant