Skip to content

Instantly share code, notes, and snippets.

@dfm
Created November 29, 2012 22:52
Show Gist options
  • Save dfm/4172449 to your computer and use it in GitHub Desktop.
Save dfm/4172449 to your computer and use it in GitHub Desktop.
for jsick
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