An Adaptative Parallel Tempering wrapper for emcee 3 for personal use
Project description
Reddemcee
An Adaptative Parallel Tempering wrapper for emcee 3 for personal use, which someone in the community might find useful on it's own.
Overview
Reddemcee is simply a wrapper for the excellent MCMC implementation emcee, that contains an adaptative parallel tempering version of the sampler, according to Vousden et al. implementation. It's coded in such a way that minimal differences in input are required, and it's fully compatible with emcee (v. 3.1.3).
Dependencies
This code makes use of:
- Numpy
- pandas
- tqdm (https://pypi.python.org/pypi/tqdm)
- emcee (https://github.com/dfm/emcee)
Most of them come with conda, if some are missing they can be easily installed with pip.
Installation
In the console type in your work folder
pip install reddemcee
Usage
Please refer to the test file in the tests folder.
import numpy as np
import reddemcee
def log_like(x, ivar):
return -0.5 * np.sum(ivar * x ** 2)
def log_prior(x):
return 0.0
ndim, nwalkers = 5, 100
ntemps = 5
ivar = 1. / np.random.rand(ndim)
p0 = list(np.random.randn(10, nwalkers, ndim))
sampler = reddemcee.PTSampler(nwalkers, ndim, log_like, log_prior, logl_args=[ivar])
sampler.run_mcmc(p0, 2000)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for reddemcee-0.4.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0b3a558b9732eeff0bdc940042f2cfc985971c2a845a5e0445ac1a1ede949b1 |
|
MD5 | 9ee7c44c247d56a0918ce3c3aeda7ddf |
|
BLAKE2b-256 | ba295e36487ddc37d6628930e62bfbb648a057a3bf09cb1410b84f96f4daee03 |