bilby.bilby_mcmc.proposals.StretchProposal

class bilby.bilby_mcmc.proposals.StretchProposal(priors, weight=1, subset=None, scale=2)[source]

Bases: BaseProposal

The Goodman & Weare (2010) Stretch proposal for an MCMC chain

Implementation of the Stretch proposal using a sample drawn from the chain. We assume the form of g(z) from Equation (9) of [1].

References

[1] Goodman & Weare (2010)

https://ui.adsabs.harvard.edu/abs/2010CAMCS…5…65G/abstract

__init__(priors, weight=1, subset=None, scale=2)[source]
__call__(chain, likelihood=None, priors=None)[source]

Call self as a function.

Methods

__init__(priors[, weight, subset, scale])

apply_boundaries(point)

apply_periodic_boundary(key, val)

apply_reflective_boundary(key, val)

check_dependencies([warn])

Check the dependencies required to use the proposal

propose(chain)

Propose a new point

Attributes

acceptance_ratio

accepted

n

rejected

static check_dependencies(warn=True)[source]

Check the dependencies required to use the proposal

Parameters:
warn: bool

If true, print a warning

Returns:
check: bool

If true, dependencies exist

propose(chain)[source]

Propose a new point

This method must be overwritten by implemented proposals. The propose method is called by __call__, then boundaries applied, before returning the proposed point.

Parameters:
chain: bilby.core.sampler.bilby_mcmc.chain.Chain

The chain to use for the proposal

Returns:
proposal: bilby.core.sampler.bilby_mcmc.Sample

The proposed point

log_factor: float

The natural-log of the additional factor entering the acceptance probability to ensure detailed balance. For symmetric proposals, a value of 0 should be returned.