montepython_public
montepython_public copied to clipboard
Error logger (possible new feature?)
Hi,
It'd be nice to have a record of the CosmoComputation
errors: what set of parameters cause it, which kind of error it is, etc.
Based on https://github.com/miguelzuma/montepython_zuma, I've modified compute_lkl
and io_mp.py
to save the error messages, parameters and chains (with an error code for different kind of errors), when cosmo.compute() fails. Just a quick hack, nothing fancy.
Hi Carlos
Thank you! This sounds useful. Last I spoke to Miguel he mentioned he had some better error handling for MontePython and I guess this is it? Maybe to start you could add it as an flag that you can set for runs to print errors? That way people who have i/o concerns can skip it. E.g. you could add a flag --print-errors to parser_mp.py , do you already know how to do that?
Did you test your modifications for both Py2 and Py3?
The ideal for me would be if you would set this up as changes to the current branch 3.3 (v3.3.3) and then do a pull request, then I can add it right away to v3.4, which should be out in a week or so.
Best, Thejs
Hi Thejs,
I have added the option --print-errors
and seems to work for both python2 and python3. I haven't had much time to do an exhaustive test but, so far, it seems to work ok.
I cannot fork this repo because I've already forked another fork and need it for an ongoing project at this moment. Sorry for the inconvenience. I share the patch as before. You can apply it with git am 0001-added-hi_class-error-logger.patch.txt
.
0001-added-hi_class-error-logger.patch.txt
Best, Carlos
I just created the pull request, I've come out with a way of having the different versions of MP in the same repo. Thanks, Carlos