UltraNestSampler#

class jetset.mcmc_ultranest.UltraNestSampler(model_minimizer, build_mcmc_parameters=True)[source]#

Bases: McmcSampler

UltraNest backend that reuses most of McmcSampler post-processing.

Notes

The class keeps the parameter/bounds workflow from McmcSampler and swaps the sampling engine with ultranest.ReactiveNestedSampler. Posterior samples are stored in self.samples with the same shape conventions used by McmcSampler so existing corner/model plotting helpers continue to work.

Attributes Summary

logz

Return the estimated Bayesian log-evidence.

logzerr

Return the uncertainty on the Bayesian log-evidence.

Methods Summary

reset_to_mcmc_best_fit([verbose])

Reset model parameters to the UltraNest best-fit point.

run_sampler([min_num_live_points, dlogz, ...])

Run posterior sampling with UltraNest.

Attributes Documentation

logz#

Return the estimated Bayesian log-evidence.

logzerr#

Return the uncertainty on the Bayesian log-evidence.

Methods Documentation

reset_to_mcmc_best_fit(verbose=True)[source]#

Reset model parameters to the UltraNest best-fit point.

run_sampler(min_num_live_points=400, dlogz=0.5, min_ess=None, frac_remain=0.01, max_ncalls=None, use_UL=False, loglog=False, resume='subfolder', ultranest_output_dir=None, show_status=True, posterior_samples_size=None, rnd_seed=0, use_stepsampler=True, nsteps=2, **run_kwargs)[source]#

Run posterior sampling with UltraNest.

Parameters:
  • min_num_live_points (int, optional) – Minimum number of live points.

  • dlogz (float, optional) – Stopping criterion on remaining log-evidence.

  • min_ess (int, optional) – Minimum effective sample size target.

  • frac_remain (float, optional) – Fractional prior volume stopping criterion.

  • max_ncalls (int, optional) – Maximum number of likelihood calls.

  • use_UL (bool, optional) – If True, include upper-limit terms in the likelihood.

  • loglog (bool, optional) – If True, evaluate model and data in log10 space.

  • resume (str, optional) – UltraNest resume mode.

  • ultranest_output_dir (str, optional) – This is where UltraNest writes its run files. If None ultranest_output_dir = f’ultranest_{self.model.name}’

  • show_status (bool, optional) – If True, show UltraNest progress/status.

  • posterior_samples_size (int, optional) – Number of equal-weight posterior samples to draw from weighted nested-sampling samples. If None, use all weighted points.

  • rnd_seed (int, optional) – Seed for posterior resampling.

  • use_stepsampler (bool, optional) – If True, attach a SliceSampler to the UltraNest sampler.

  • nsteps (int, optional) – Slice-sampler steps per parameter dimension. The effective value is nsteps * self.ndim. Default is 2.

  • **run_kwargs (dict) – Additional keyword arguments passed to ReactiveNestedSampler.run.

Notes

On completion, posterior samples are stored in self.samples and model parameters are reset to the mcmc best-fit point.