CosmoFit.StoredSampler¶
- class CosmoFit.StoredSampler(backend, metadata=None)[source]¶
Bases:
objectA chain read back from disk, wearing the small part of the
emcee.EnsembleSamplerinterface that CosmoFit actually asks of it.That’s the point:
Fitter.flat_samples(),.summary(),.convergence(),.best_fit(),plots.corner(), the derived-quantity posteriors and everything else read the sampler throughget_chain/get_log_prob/nwalkers/iteration. Give them one of these instead of a live sampler and they work unchanged, on a chain that may have been sampled weeks ago in another process.Read-only by construction – there is no
run. To add steps to a stored chain, go back throughFitter.run_mcmc(save=..., nsteps=<a larger total>).- Parameters:
backend (emcee.backends.Backend) – Usually an
HDFBackendopenedread_only=True.metadata (dict, optional) – The CosmoFit metadata stored with the chain.
Methods
__init__(backend[, metadata])flat_samples([burnin])Post-burn-in samples, walkers flattened together -- the same array
Fitter.flat_samples()returns.get_autocorr_time(**kwargs)get_chain(**kwargs)get_last_sample()get_log_prob(**kwargs)samples_dict([burnin])Flat samples as a dict of 1D arrays keyed by parameter name.
summary([burnin])Posterior median +/- 68% interval per parameter, in the same shape as
Fitter.summary()-- available here without constructing aFitterat all, i.e. without reading a single dataset.Attributes
acceptance_fractionburninBurn-in recorded at sampling time, used as the default by the methods below.
free_paramsParameter names, from the stored metadata.
iterationndimnwalkersrandom_state