joshspeagle / dynesty

Dynamic Nested Sampling package for computing Bayesian posteriors and evidences
https://dynesty.readthedocs.io/
MIT License
347 stars 76 forks source link

Adding support for tqdm for printing progress #152

Closed dfm closed 5 years ago

dfm commented 5 years ago

This pull request should remain backwards compatible, but it adds support for using tqdm for displaying progress if it's installed.

The benefit of this is that tqdm plays nice and doesn't swamp stderr. I did a simple test and this reduces the output from 1,330,315 characters written to stderr (over 6185 iterations) to 5,076 characters for a model that is fast to evaluate. I've found that in some simple test cases (especially in Jupyter notebooks) just the I/O of the progress bar can dominate the computational load and this should help reduce that effect.

Feel free to ignore if its not something that you're interested in!

joshspeagle commented 5 years ago

Definitely interested and this looks like a very nice quality-of-life improvement. Merging this in now. Thanks!