joshspeagle / dynesty

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

Terminalout #110

Closed JohannesBuchner closed 5 years ago

JohannesBuchner commented 5 years ago

Here is an experiment to avoid scrambled terminal outputs when the terminal is not large enough.

https://stackoverflow.com/questions/566746/how-to-get-linux-console-window-width-in-python

On python2.7, one may want to install https://pypi.python.org/pypi/backports.shutil_get_terminal_size, but this code should gracefully continue if it is not available.

joshspeagle commented 5 years ago

This looks like a nice quality-of-life improvement. I'll try to merge this once I get a chance.

bek0s commented 5 years ago

After upgrading to the latest dynesty version which includes this update, I get nothing at PyCharm's output tab. Debian Testing + Python 3.7 + PyCharm 2018.3 community edition

joshspeagle commented 5 years ago

Okay, looks like this request may have introduced some weird behavior. I'll try to see if I can locate the problem, but otherwise the pip install version should be clean.

JohannesBuchner commented 5 years ago

@bek0s, what does shutil.get_terminal_size(fallback=(80, 25)) return for you?

bek0s commented 5 years ago

Hi @JohannesBuchner,

If I print the output of the above command I get os.terminal_size(columns=80, lines=25), regardless which version of dynesty I am using.

Thanks