Created
November 29, 2012 22:52
-
-
Save dfm/4172449 to your computer and use it in GitHub Desktop.
for jsick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import emcee | |
def lnprob(x, ivar): | |
return -0.5 * np.array([np.sum(ivar * x ** 2), ]) | |
ndim, nwalkers = 10, 100 | |
ivar = 1. / np.random.rand(ndim) | |
p0 = [np.random.rand(ndim) for i in range(nwalkers)] | |
sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob, args=[ivar]) | |
sampler.run_mcmc(p0, 1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment