From 0d01d4e95078615e9347eeb293f6406ce6f198ae Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Wed, 14 Oct 2026 15:31:26 +0100 Subject: [PATCH] sampler_pipeline: promote searches as NonLinearSearch + posterior_kind Stage 3 now tells a new search to subclass autofit.NonLinearSearch, declare posterior_kind / test_mode_budget, take its defaults from posterior_kind.{CHAIN,WEIGHTED,POINT}, set samples_cls and implement run(ctx) + raw_samples_from. The family bases and the old test-mode hooks were deprecated in PyAutoFit A4 (#1685-#1687). Closes #520 Co-Authored-By: Claude Fable 5.1 --- skills/sampler_pipeline/reference.md | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/skills/sampler_pipeline/reference.md b/skills/sampler_pipeline/reference.md index 960f5478..94cfbff5 100644 --- a/skills/sampler_pipeline/reference.md +++ b/skills/sampler_pipeline/reference.md @@ -126,15 +126,25 @@ table. A new search package `autofit/non_linear/search///` needs: -1. **`search.py`** — subclass of the group abstract (`AbstractNest` / - `AbstractMCMC` / `AbstractMLE`): config kwargs on `__init__`, a `_fit()` - that drives the external sampler API through autofit's `Fitness`, - checkpoint/resume through `paths` (see NSS's pickle + `NullPaths` - handling), an `is_test_mode` short-circuit, and an internal-state holder - if the sampler carries one (cf. `_NSSInternal`). +1. **`search.py`** — subclass of `autofit.NonLinearSearch`. Declare the + static capabilities (`posterior_kind = PosteriorKind.WEIGHTED | CHAIN | + POINT`, `test_mode_budget = {...}`, …) and apply that kind's defaults in + `__init__` from `autofit.non_linear.search.posterior_kind` + (`initializer=WEIGHTED.nested_initializer_for(initializer)`, + `self.clipper = POINT.clipper_for(clipper)`, + `self.auto_correlation_settings = CHAIN.auto_correlation_settings_for(...)`). + Set `samples_cls`. Implement `run(ctx)` + `raw_samples_from` + (`docs/design/run_ctx.md`) rather than `_fit`, driving the external + sampler API through autofit's `Fitness`, with checkpoint/resume through + `paths` (see NSS's pickle + `NullPaths` handling) and an internal-state + holder if the sampler carries one (cf. `_NSSInternal`). The test-mode + reduction comes from `test_mode_budget` through the post-init hook alone, + so do not apply it again in `__init__` and do not short-circuit the run + in test mode. The search-level `seed` is inherited; do not add a `seed` + kwarg unless the backend needs it as a static identifier field. 2. **`samples.py`** — a `Samples` subclass converting sampler output into - autofit samples (cf. `NSSamples(SamplesNest)` — ~25 lines when the group - abstract does the heavy lifting). + autofit samples (cf. `NSSamples(SamplesNest)` — ~25 lines on top of + `SamplesNest`). 3. **Public export** — `autofit/__init__.py` (`af.` is the API). 4. **Dependency** — optional extra in `pyproject.toml`. Gotcha: PyPI rejects git-URL dependencies in uploaded wheels ("400 Can't have direct