Hello to all,
I am running emcee 3.0rc2 with the "backends" feature and when i try to access the .h5 file i get the following error:
Traceback (most recent call last):
File "testing.py", line 23, in
samples = reader.get_chain(discard=burnin, flat=True)
File "/usr/local/lib/python3.6/dist-packages/emcee/backends/backend.py", line 72, in get_chain
return self.get_value("chain", **kwargs)
File "/usr/local/lib/python3.6/dist-packages/emcee/backends/hdf.py", line 101, in get_value
raise AttributeError("You must run the sampler with "
AttributeError: You must run the sampler with 'store == True' before accessing the results
The testing.py file contains the following:
reader = emcee.backends.HDFBackend('test_ff.h5')
fname = 'test_clust_1'
burnin = 1
samples = reader.get_chain(discard=burnin, flat=True)
bs = 40
labels = ['a','b','c','$\sigma_{e}$','k']
ax = corner.corner(samples,plot_contours = True, fill_contours = True,plot_datapoints = False, \ show_titles = True, bins = bs, levels = [0.,0.6827,0.9545,0.9973],labels=labels,title_fmt=".4f")
ax.savefig(fname+'.pdf')
The call of the run_emcee is done as follows:
if extra_force == "multithreading":
with multiprocessing.Pool() as pool:
sampler = emcee.EnsembleSampler(nwalkers, ndim, lnlikelihood, \ pool=pool,backend=backends)
start = tm.time()
sampler.run_mcmc(initial, states, progress=prog_bar)
end = tm.time()
multi_time = end - start
# print("Multiprocessing took {0:.1f} seconds".format(multi_time))
Is there anyone with the same problem? Perhaps I oversee something trivial.
Anyway, thanks for your time