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
1
vote
1 answer

ValueError: operands could not be broadcast together with shapes (1,2) (20,100)

I'm using emcee mcmc hammer in order to reconstruct a 1D Gaussian from 20 samples with random standard deviations. Here is the relevant part of my code: def loglike(alpha,datapoints): mu, sig = alpha return…
naomig
  • 271
  • 1
  • 7
  • 12
0
votes
0 answers

Emcee is getting stuck while while running in multiprocessing mode

I have written an mcmc code using emcee python ### MCMC Parameters # initial guesses for the free parameters initial = np.float64([1.e-13, -2]) # set no of walkers nwalkers = 100 # set no of steps nsteps = 3000 # defining the model def…
0
votes
0 answers

What decides whether the model will be accessed or not mcmc (using emcee)?

I am writing a mcmc python code using the python package emcee. The structure goes as follows ` ### MCMC Parameters # initial guesses for the free parameters initial = np.float64([1.e-13, -2]) # set no of walkers nwalkers = 100 # set no of…
0
votes
0 answers

How to work with discrete variables on emcee python?

I'm working on a project were I'm performing a model fitting and my problem is that I have 2 of 4 variables that are discrete (this means that are already generated models that I'm just able to read), so I need that when I use the…
Ian Baeza
  • 1
  • 2
0
votes
0 answers

Does anyone see the mistake/problem with my code (MCMC using emcee)?

Does anyone see the problem with my code? I am trying to set up a rather easy example of fitting some mock data to a lognormal function using emcee but MCMC does not produce a feasible fit like curve-fit. I am writing this post because after looking…
0
votes
0 answers

Log-uniform distribution for priors using emcee

I want to use emcee to minimise a function, and want to vary 3 priors a,b,c over a log-uniform distribution of many orders of magnitude, and 2 more priors d, e over a uniform distribution. What would I need to return in the log_prior(theta)…
0
votes
0 answers

Walker 'ID' number in emcee? (Python)

I am using the Emcee python package to fit some models to data. The models are created using a separate piece of software. For each step in the MCMC chain, each walker generates a new input file to the software, and then creates a 'fresh' copy of…
lucas
  • 19
  • 8
0
votes
0 answers

Create a new subdirectory for each walker - Emcee/MCMC

I am using the Emcee python package to fit some models to data. My python code is a wrapper to a separate piece of software. My code generates the input file to this software at each step in the MCMC chain. For each iteration, I need to: Copy the…
lucas
  • 19
  • 8
0
votes
0 answers

"invalid value encountered in log" just with python compiler but not with jupyter notebook

I'm trying to run a program using emcee that has a np.log function. When i run the program .py in python with conda terminal i got this error Running MCMC... /home/econtreras/Q0ANOMALIES/Q0RANDOM/Fits.py:124: RuntimeWarning: invalid value…
0
votes
0 answers

Multiprocess not recognizing defined function

I'm trying to fit a simple gaussian model to some data using the markov-chain monte carlo package EMCEE while utilizing parallel processing. I am using multiprocess instead of multiprocessing as I am working in Jupyter notebook where…
0
votes
0 answers

Multiprocessing emcee not working in Spyder (Python 3.9.7)

I'm new to this so please forgive me if I forget to add enough information. I have an MCMC code that uses emcee and that works perfectly fine in my "normal" terminal, with the Python 3.5.2 version. Recently, I started using Spyder within Anaconda…
0
votes
0 answers

Sampling a product of 4 independent functions where two of them are constant - with emcee

I need to sample from the following function: p = p1* p2* p3*p4 Where p1 and p2 are Gaussian functions with the same sigma but different means. But both p3 and p4 are equal to 1/(2*(pi)), both constant functions. p3 and p4 are defined in the…
Matthew D.
  • 311
  • 1
  • 3
  • 10
0
votes
1 answer

Python: MCMC fit to data with variable uncertainties (using lmfit)

Please bear with me as I try to explain what I'm trying to do. I'm trying fit an arctangent model to some data. I have two independent measurements in my dataset; one of these has unknown uncertainties. The model I'm trying to fit has the form: def…
0
votes
0 answers

MCMC code is very slow for even small steps

I have a problem with Python. My question is not about any problem in writing code. I have a script that has been used many times before for my calculations and my published papers. It is MCMC or Markov Chain Montecarlo (EMCEE python package). For…
Ethan
  • 180
  • 2
  • 15
0
votes
1 answer

running a python script with ptemcee (a package of Monte Carlo) in SBATCH / SLURM

I need to run a python script using sbatch / slurm The script works until the step which it must use the ptemcee (i.e. runs a monte carlo markov chain). In this step, nothing happens (as if the script fell in a infinite loop). I know that there is…