zblz / naima

Derivation of non-thermal particle distributions through MCMC spectral fitting
http://naima.readthedocs.io
BSD 3-Clause "New" or "Revised" License
45 stars 53 forks source link

Consulting the code #215

Closed zhiyuanpei closed 3 years ago

zhiyuanpei commented 3 years ago

Hi all,

I am a new beginner in naima code. However, I face a problem when I run one of examples "Fitting a minimal radiative model" but an error occurs, may I ask does anyone know how to figure it out?

"Progress of the run: 0 percent (0 of 100 steps)

Traceback (most recent call last):

File "/Users/matt/Desktop/code/model.py", line 53, in

interactive=False,

File "//anaconda3/lib/python3.7/site-packages/naima/core.py", line 556, in run_sampler

sampler, pos = get_sampler(**kwargs)

File "//anaconda3/lib/python3.7/site-packages/naima/core.py", line 517, in get_sampler

sampler, pos = _run_mcmc(sampler, p0, nburn)

File "//anaconda3/lib/python3.7/site-packages/naima/core.py", line 161, in _run_mcmc

npars = out[0].shape[-1]

TypeError: 'State' object is not subscriptable"

zblz commented 3 years ago

Hi!

From the error message, t send like you have emcee version 3 installed. The latest release of naima does not support emcee 3, and if you install naima again (pip install naima) emcee should be downgraded.

I am working on adding emcee 3 support in PR #214, but it's not ready yet.

zhiyuanpei commented 3 years ago

Thanks for your response, now the problem has been solved after ...pip install naima.