Skip to content

test: af.NSS wiring + HST MGE smokes (searches_minimal/nss_first_class{,_gaussian}.py) - #64

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/nss-search-wrapper
May 16, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/nss-search-wrapper

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

Adds two searches_minimal/ scripts that exercise the new af.NSS Phase 1 wrapper shipping concurrently in PyAutoLabs/PyAutoFit#1272 (closes PyAutoLabs/PyAutoFit#1271). Paired with the library PR — that one introduces the wrapper, this one pins its wiring as long-running regression gates.

searches_minimal/nss_first_class_gaussian.py — fast wiring smoke

Two-parameter Gaussian flat-likelihood problem; ~10 sec wall on CPU. Validates the full af.NSS().fit() path end-to-end on real nss.ns.run_nested_sampling output:

  1. JAX closures are built and accepted by nss.
  2. _NSSInternal repackages the post-run state.
  3. NSSamples.samples_via_internal_from builds the sample_list with proper weight normalisation.
  4. AbstractNest.perform_update writes samples.csv through the Paths pipeline.
  5. Result.max_log_likelihood_instance returns the expected type with the right model attributes.
  6. Weighted posterior means recover the prior means under flat likelihood (asserts x_mean ≈ 2.5 ± 1.5, y_mean ≈ -1.0 ± 1.0).

Designed as a permanent regression gate — fails loudly if any future refactor breaks the wrapper (e.g. a sign regression in log_prior_from_value, a missing Fitness.batch_size from _fit, or a wrong Paths attribute lookup).

searches_minimal/nss_first_class.py — heavy HST MGE numerical-parity smoke

Same model as the bare-bones nss_jit.py reference (15-dim MGE + isothermal + external shear, n_live=200, num_mcmc_steps=5, num_delete=10, termination=-3) but driven through af.NSS().fit() instead of the raw call. Asserts einstein_radius ≈ 1.5996 ± 0.002 and finite log_evidence. Designed for HPC GPU runs (~7 min on A100 per FINDINGS_v3 c3_big_delete) — too slow on laptop CPU for routine smoke runs.

API Changes

None — internal workspace_developer addition only. New scripts surface no public API.
See full details below.

Test Plan

  • python searches_minimal/nss_first_class_gaussian.py — passes in 10 sec wall against the matching af.NSS PyAutoFit branch. Verified Result.max_log_likelihood_instance round-trips, samples.csv written, weights sum to 1.0, posterior recovers prior means.
  • python searches_minimal/nss_first_class.py — partial run verified (JIT compiled, 1000+ dead points accumulated with monotonic logZ progression). Full HPC GPU run for numerical-parity validation is a separate exercise.
Full API Changes (for automation & release notes)

None — internal test workspace addition only. New searches_minimal/ scripts surface no public API.

🤖 Generated with Claude Code

…ian}.py

Two new searches_minimal scripts exercising the new `af.NSS` Phase 1 wrapper
(PyAutoLabs/PyAutoFit#1271 — fix shipping concurrently on the matching
feature/nss-search-wrapper branch in PyAutoFit).

scripts/searches_minimal/nss_first_class_gaussian.py
  Fast (~10 sec wall) wiring smoke on a 2D Gaussian flat-likelihood problem.
  Validates the full path: af.NSS().fit() builds JAX closures, nss accepts
  them, _NSSInternal repackages the post-run state, NSSamples conversion
  produces a populated sample_list, AbstractNest.perform_update writes
  samples.csv through the Paths pipeline, and Result.max_log_likelihood_instance
  returns the expected type with the right model attributes. Weighted
  posterior means recover the prior means (x=2.4481 vs target 2.5,
  y=-0.9774 vs target -1.0) under flat likelihood. Designed as a permanent
  regression gate — fails loudly if any future refactor breaks the wrapper.

scripts/searches_minimal/nss_first_class.py
  Heavy HST MGE numerical-parity smoke. Same model as the bare-bones
  nss_jit.py reference (15-dim MGE + isothermal + external shear, n_live=200,
  num_mcmc_steps=5, num_delete=10, termination=-3) but driven through
  af.NSS().fit(). Asserts einstein_radius ≈ 1.5996 ± 0.002 and finite
  log_evidence. Designed for HPC GPU runs (~7 min on A100 per FINDINGS_v3
  c3_big_delete) — too slow on laptop CPU for routine smoke runs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release Pending release build label May 16, 2026
@Jammy2211
Jammy2211 merged commit 83b3836 into main May 16, 2026
@Jammy2211
Jammy2211 deleted the feature/nss-search-wrapper branch May 16, 2026 08:55
@Jammy2211 Jammy2211 removed the pending-release Pending release build label Oct 7, 2026
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.

feat: af.NSS NonLinearSearch wrapper (Phase 1 of nss_first_class_sampler)

1 participant