baudren / montepython_public

Public repository for the Monte Python Code
MIT License
65 stars 116 forks source link

montepython info fails with chains obtained using --update option #48

Closed ajcuesta closed 9 years ago

ajcuesta commented 9 years ago

Hi,

I was trying out the new --update option in v.2.2.0 (which I'm very excited about!) and I'm running some Planck2015 chains as a test. However when running montepython info in the output chains I got the following error:

ValueError: invalid literal for float(): 0.49]

I looked it up in the chain file, and I found that the line causing the error was this comment in the middle of the chain file:

# After 121 accepted steps: update proposal with R-1 = [ 0.92  0.5   0.3   0.44  2.21  0.77  0.38  0.53  0.71  0.13  0.76  0.83  0.56  0.34  0.32  0.48  0.32  0.23  0.24  0.43  0.11  0.16  0.13  1.64  0.77  
0.39  0.13  0.31  0.2   0.58  0.18  0.31  1.41  0.8   0.78  0.78  0.31  0.43  0.49]

Not sure if the expected behavior is to include such comments in the chain files, but the problem here is that the commented line itself is broken into two lines, therefore montepython info did not find any problem with the first line (which starts with a '#' sign), but it did found a problem when reading the second line (which starts from "0.39" and ends with "0.49]" ).

Anyway, I guess the fix for this is simple but I wanted to flag it anyway before more people encounter the same error.

Thanks, and congrats on the new version!! Antonio J. Cuesta

lesgourg commented 9 years ago

Thanks Antonio for pointing this out! The fact that something like: [hash] After 121 accepted steps: update proposal with R-1 = 0.92 is written to the chains is normal - this is a trick allowing the "info" mode to find when chains become Markovian, and also, it is a useful information (so with a "> grep 'steps' *txt" the user can get a full log of the evolution of R-1 and of the covmat updates). But you shoudl see here only the maximum R-1, not the full array, this is a bug. We will correct it tomorrow morning (Wednesday 26) in a 2.2.1.

ajcuesta commented 9 years ago

Thanks for the lightning-fast response!!