Skip to content

Ns aw

BlackJAX nested sampling with bilby/dynesty-style adaptive DE acceptance-walk kernel.

BlackJAXNSAWSampler ¤

Bases: Sampler

BlackJAX nested sampler using the bilby/dynesty-style adaptive DE acceptance-walk kernel.

Samples in the sampling space defined by sample_transforms (typically the unit cube via BoundToBound transforms). Operates on flat arrays of shape (n_dims,); the acceptance-walk kernel is pytree-generic and works identically with flat arrays.

Note

This sampler requires the sampling space to be the unit hypercube [0, 1]^n_dims. All sample_transforms in Jim must map the prior support onto [0, 1] per dimension before sampling. A ValueError is raised at construction if the supplied log_prior_fn violates this constraint.

Reference: Prathaban, M., Yallup, D., Alvey, J., Yang, M., Templeton, W., Handley, W., "Gravitational-wave inference at GPU speed: A bilby-like nested sampling kernel within blackjax-ns", arXiv:2509.04336 (Sep 2025).

Configure via BlackJAXNSAWConfig.

Parameters:

Name Type Description Default
n_dims int

Dimension of the sampling space.

required
log_prior_fn Callable

Log-prior callable (arr,) -> float.

required
log_likelihood_fn Callable

Log-likelihood callable (arr,) -> float.

required
log_posterior_fn Callable

Log-posterior callable (arr,) -> float.

required
config Optional[BlackJAXNSAWConfig]

Optional BlackJAXNSAWConfig; defaults to all-default values.

None
periodic Optional[list[int]]

Optional list of dimension indices that are periodic in [0, 1] (unit-cube space). None means no periodic parameters. Provided by Jim after resolving parameter names.

None

Methods:

Name Description
get_samples

Return equally-weighted posterior samples.

get_samples() -> dict[str, np.ndarray] ¤

Return equally-weighted posterior samples.

Uses NestedSamples.posterior_points to resample the nested dead-point collection to a set of equal-weight samples.

Returns:

Type Description
dict[str, ndarray]

Dict with keys "samples" (shape (n, n_dims)) and

dict[str, ndarray]

"log_likelihood" (shape (n,)).