Cannot save results table
wrijupan opened this issue · 3 comments
Hello,
I am trying to save the results of a model fitting using naima.save_results_table
. But after the burn-in and run phase it displays this error message :
INFO: Saving results table in ./results_ssc_fit/data_fit_table_results.ecsv [naima.analysis] {...} File "/Users/wriju/miniconda3/envs/cta/lib/python3.6/site-packages/naima/analysis.py", line 295, in save_results_table nblobs = len(sampler.blobs[-1][0]) TypeError: object of type 'NoneType' has no len()
Then I tried again to re-run without any change in the code (i.e. same prior function, same initial parameter vector, same no. of walkers, burn-in and run steps etc) and the error message is no longer displayed the second time and the code executes smoothly.
Is this due to convergence problem due to less number of samples?
The method to check how many blobs are returned for each sampling step is overly simple in save_results_table
, and here it failed because the last sample returned a probability of -Inf
and the blobs were not stored. I'll make the logic to check the blob number bit more robust.
Thanks for the catch, @wrijupan!
On review, I'm not sure why this has happened, since whenever the log probability is -Inf
emcee will not store the result of the sample, and that is the only case when a blob from the model will be None
.