Questions tagged [emcee]

emcee is an affine-invariant Markov chain Monte Carlo (MCMC) ensemble sampler.

emcee is a Python implementation of the affine-invariant ensemble sampler for Markov chain Monte Carlo (mcmc) proposed by Goodman & Weare (2010).

The code is available online under the MIT License.

63 questions
0
votes
1 answer

Multiprocessing the Python module 'emcee', but not all available cores on the machine are being used

I am parallelizing emcee using multiprocessing module as stated in the emcee document. However, htop shows that the program keeps using a limited number of cores (26-27). The computer I am running my code on has 80 available cores and I would like…
0
votes
1 answer

ValueError: Probability function returned NaN when using emcee package

I am using the emcee package to determine the optimal parameters of a measured dataset that should follow a Poisson distribution. The code I use is def lnL_Poisson(theta,x,y,yerr): logA,beta = theta A = 10**logA model = the Poisson…
Mike
  • 51
  • 5
0
votes
0 answers

Emcee with gaussian prior gives NaN

I've been using emcee to sampel my parameter, at first my prior were all uniform def logprior_BAO(theta): A, B, C, D, epsilon, rd = theta if A > 0 and B > 0 and C > 0 and D > 0 and epsilon > -5 and 146.96<=rd<=147.58: return 0.0 return…
0
votes
1 answer

How to properly paralleize a blackbox likelihood in emcee

I am currently using the emcee package to get MCMC samples using the tutorial https://emcee.readthedocs.io/en/stable/tutorials/parallel/. The serial version of the code works but is slow so I want to use the parallelizing technique to speed up the…
0
votes
0 answers

emcee MCMC Sampling... Small set of walkers not converging?

I'm running mcmc on a simulation where I know the true parameter values. Suppose I use 100 walkers and 10,000 steps in the chain. The bulk of the walkers converge to the correct parameter values, but ~3 walkers (out of the 100) just trail off into…
Jsn
  • 107
  • 6
0
votes
1 answer

emcee EnsembleSampler object has no attribute get_chain

I am having trouble accessing the values generated from emcee using the get_chain() method. My code is provided below: import numpy as np import emcee def log_prob(x): return -np.sum(x**2) p0 = np.array(np.random.randn(12, 1)) sampler =…
0
votes
1 answer

Error when trying to use MPI with emcee on a slurm cluster

Hi and thanks for your help already! I am trying to get emcee to run using mpi on a Slurm cluster, but when I launch my code, it returns an error after a few minutes, with a big error described lower, that seems to revolve around the 'Invalid…
Yohann
  • 11
  • 1
0
votes
1 answer

index 2 is out of bounds

I have the following code which is about constraining the parameters. I get this error when I run the code: samples[:, 2] = np.exp(samples[:, 2]) IndexError: index 2 is out of bounds for axis 1 with size 2 Any Help Please, How should I do to fix…
Bob
  • 39
  • 1
  • 10
0
votes
2 answers

emcee - why values outside of prior space

I am specifying my priors to be none negative in the following way: def lnprior(theta): sig,mu = theta if 0.01 < sig < 2.0 and 0.01 < mu < 1.0: return(0.0) return(-np.inf) I then follow the cookbook on the emcee web page: def…
Sebastiano1991
  • 867
  • 1
  • 10
  • 26
0
votes
1 answer

Walkers in emcee not exploring parameter space?

First of all: apologies for the lack of code and rather vague descriptions; the code I'm using is 1000+ lines long and I'm not sure what parts of it would be helpful to post. I'm using emcee to do some Bayesian parameter estimation. My code uses 50…
rrose
  • 69
  • 1
  • 4
0
votes
0 answers

Sampling a Boltzmann Distribution using Python's emcee

I'm a beginner at python and am learning to use MCMC sampling methods, using python's emcee package. As a beginner exercise I want to sample a Maxwell-Boltzmann Distribution. I have an example code which samples a Gaussian, defined through the…
0
votes
1 answer

use emcee to sample probability distribution functions?

I have two arrays (pdf_#), each containing the probability for a parameter (val_#). How can I sample from these distributions to create a joint posterior distribution (i.e. like in the corner plot here)? For emcee it looks like I can only pass…
user2520932
  • 83
  • 2
  • 7
0
votes
2 answers

Retry until no RuntimeWarning

I'm trying to fit a curve to some data using MCMC. Due to the nature of my particular problem, occasionally (1/5 times running the code) some singularities are encountered and the code raises me a RuntimeWarning and proceeds to give a wrong…
Anna
  • 85
  • 8
0
votes
1 answer

Fitting with monte carlo in python

I use a python package called emcee to fit a function to some data points. The fit looks great, but when I want to plot the value of each parameter at each step I get this: In their example (with a different function and data points) they get…
Silviu
  • 749
  • 3
  • 7
  • 17
0
votes
2 answers

Using multiprocessing in emcee library inside a class

I have tried to use emcee library to implement Monte Carlo Markov Chain inside a class and also make multiprocessing module works but after running such a test code: import numpy as np import emcee import scipy.optimize as op # Choose the "true"…
Dalek
  • 4,168
  • 11
  • 48
  • 100