bilby.bilby_mcmc.chain.Chain

class bilby.bilby_mcmc.chain.Chain(initial_sample, burn_in_nact=1, thin_by_nact=1, fixed_discard=0, autocorr_c=5, min_tau=1, fixed_tau=None, tau_window=None, block_length=100000)[source]

Bases: object

__init__(initial_sample, burn_in_nact=1, thin_by_nact=1, fixed_discard=0, autocorr_c=5, min_tau=1, fixed_tau=None, tau_window=None, block_length=100000)[source]

Object to store a single mcmc chain

Parameters:
initial_sample: bilby.bilby_mcmc.chain.Sample

The starting point of the chain

burn_in_nact, thin_by_nactint (1, 1)

The number of autocorrelation times (tau) to discard for burn-in and the multiplicative factor to thin by (thin_by_nact < 1). I.e burn_in_nact=10 and thin_by_nact=1 will discard 10*tau samples from the start of the chain, then thin the final chain by a factor of 1*tau (resulting in independent samples).

fixed_discard: int (0)

A fixed minimum number of samples to discard (can be used to override the burn_in_nact if it is too small).

autocorr_c: float (5)

The step size of the window search used by emcee.autocorr when estimating the autocorrelation time.

min_tau: int (1)

A minimum value for the autocorrelation time.

fixed_tau: int (None)

A fixed value for the autocorrelation (overrides the automated autocorrelation time estimation). Used in testing.

tau_window: int (None)

Only calculate the autocorrelation time in a trailing window. If None (default) this method is not used.

block_length: int

The incremental size to extend the array by when it runs out of space.

__call__(*args, **kwargs)

Call self as a function.

Methods

__init__(initial_sample[, burn_in_nact, ...])

Object to store a single mcmc chain

append(sample)

get_1d_array(key)

key_to_idx(key)

plot([outdir, label, priors, all_samples])

Attributes

current_sample

fixed_discard

minimum_index

This calculates a minimum index from which to discard samples

minimum_index_adapt

minimum_index_proposal

nsamples

nsamples_last

random_sample

samples

tau

The maximum ACT over all parameters

tau_dict

Calculate a dictionary of tau (ACT) for every parameter

tau_last

Return the last-calculated tau if it exists, else inf

tau_nocache

Calculate tau forcing a recalculation (no cached tau)

thin

property minimum_index

This calculates a minimum index from which to discard samples

A number of methods are provided for the calculation. A subset are switched off (by if False statements) for future development

property tau

The maximum ACT over all parameters

property tau_dict

Calculate a dictionary of tau (ACT) for every parameter

property tau_last

Return the last-calculated tau if it exists, else inf

property tau_nocache

Calculate tau forcing a recalculation (no cached tau)