lenstronomy.Sampling.Samplers package — lenstronomy 1.9.1 documentation

# lenstronomy.Sampling.Samplers package

## Submodules

## lenstronomy.Sampling.Samplers.base_nested_sampler module

class `lenstronomy.Sampling.Samplers.base_nested_sampler.` `NestedSampler`(likelihood_module, prior_type, prior_means, prior_sigmas, width_scale, sigma_scale)

  Bases: `object`

  Base class for nested samplers

  `log_likelihood`(*args, **kwargs)

    compute the log-likelihood given list of parameters

    Parameters: | x – parameter values
    Returns: | log-likelihood (from the likelihood module)

  `prior`(*args, **kwargs)

    compute the mapping between the unit cube and parameter cube

    Parameters: | u – unit hypercube, sampled by the algorithm
    Returns: | hypercube in parameter space

  `run`(kwargs_run)

    run the nested sampling algorithm

## lenstronomy.Sampling.Samplers.dynesty_sampler module

class `lenstronomy.Sampling.Samplers.dynesty_sampler.` `DynestySampler`(likelihood_module, prior_type='uniform', prior_means=None, prior_sigmas=None, width_scale=1, sigma_scale=1, bound='multi', sample='auto', use_mpi=False, use_pool={})

  Bases: `lenstronomy.Sampling.Samplers.base_nested_sampler.NestedSampler`

  Wrapper for dynamical nested sampling algorithm Dynesty by J. Speagle

  paper : https://arxiv.org/abs/1904.02180 doc : https://dynesty.readthedocs.io/

  `log_likelihood`(x)

    compute the log-likelihood given list of parameters

    Parameters: | x – parameter values
    Returns: | log-likelihood (from the likelihood module)

  `prior`(u)

    compute the mapping between the unit cube and parameter cube

    Parameters: | u – unit hypercube, sampled by the algorithm
    Returns: | hypercube in parameter space

  `run`(kwargs_run)

    run the Dynesty nested sampler

    see https://dynesty.readthedocs.io for content of kwargs_run

    Parameters: | kwargs_run – kwargs directly passed to DynamicNestedSampler.run_nested
    Returns: | samples, means, logZ, logZ_err, logL, results

## lenstronomy.Sampling.Samplers.multinest_sampler module

class `lenstronomy.Sampling.Samplers.multinest_sampler.` `MultiNestSampler`(likelihood_module, prior_type='uniform', prior_means=None, prior_sigmas=None, width_scale=1, sigma_scale=1, output_dir=None, output_basename='-', remove_output_dir=False, use_mpi=False)

  Bases: `lenstronomy.Sampling.Samplers.base_nested_sampler.NestedSampler`

  Wrapper for nested sampling algorithm MultInest by F. Feroz & M. Hobson papers : arXiv:0704.3704, arXiv:0809.3437, arXiv:1306.2144 pymultinest doc : https://johannesbuchner.github.io/PyMultiNest/pymultinest.html

  `log_likelihood`(args, ndim, nparams)

    compute the log-likelihood given list of parameters

    Parameters: | args – parameter values ndim – number of sampled parameters nparams – total number of parameters
    Returns: | log-likelihood (from the likelihood module)

  `prior`(cube, ndim, nparams)

    compute the mapping between the unit cube and parameter cube (in-place)

    Parameters: | cube – unit hypercube, sampled by the algorithm ndim – number of sampled parameters nparams – total number of parameters

  `run`(kwargs_run)

    run the MultiNest nested sampler

    see https://johannesbuchner.github.io/PyMultiNest/pymultinest.html for content of kwargs_run

    Parameters: | kwargs_run – kwargs directly passed to pymultinest.run
    Returns: | samples, means, logZ, logZ_err, logL, stats

## lenstronomy.Sampling.Samplers.polychord_sampler module

class `lenstronomy.Sampling.Samplers.polychord_sampler.` `DyPolyChordSampler`(likelihood_module, prior_type='uniform', prior_means=None, prior_sigmas=None, width_scale=1, sigma_scale=1, output_dir=None, output_basename='-', resume_dyn_run=False, polychord_settings=None, remove_output_dir=False, use_mpi=False)

  Bases: `lenstronomy.Sampling.Samplers.base_nested_sampler.NestedSampler`

  Wrapper for dynamical nested sampling algorithm DyPolyChord by E. Higson, M. Hobson, W. Handley, A. Lasenby

  papers : arXiv:1704.03459, arXiv:1804.06406 doc : https://dypolychord.readthedocs.io

  `log_likelihood`(args)

    compute the log-likelihood given list of parameters

    Parameters: | args – parameter values
    Returns: | log-likelihood (from the likelihood module)

  `prior`(cube)

    compute the mapping between the unit cube and parameter cube

    ‘copy=True’ below because cube can not be modified in-place (read-only)

    Parameters: | cube – unit hypercube, sampled by the algorithm
    Returns: | hypercube in parameter space

  `run`(dynamic_goal, kwargs_run)

    run the DyPolyChord dynamical nested sampler

    see https://dypolychord.readthedocs.io for content of kwargs_run

    Parameters: | dynamic_goal – 0 for evidence computation, 1 for posterior computation kwargs_run – kwargs directly passed to dyPolyChord.run_dypolychord
    Returns: | samples, means, logZ, logZ_err, logL, ns_run

## Module contents