exoplanet-dev / exoplanet

Fast & scalable MCMC for all your exoplanet needs!
https://docs.exoplanet.codes
MIT License
206 stars 52 forks source link

Feature request: Allow custom tqdm instance, or use tqdm.autonotebook in xo.optimize #85

Closed adrn closed 4 years ago

adrn commented 4 years ago

Is your feature request related to a problem? Please describe.

The console tqdm.tqdm progressbar can wreak havok in Jupyter notebooks if a cell is interrupted, so it is safer to use from tqdm.notebook import tqdm. The console progressbar is used internally in xo.optimize() (and maybe elsewhere?), but can't be customized.

Describe the solution you'd like Either:

  1. Add an option like progressbar=None to optimize(), to allow passing in a custom tqdm instance.
  2. Internally, use from tqdm.auto import tqdm, which automatically detects if it is being imported in a notebook or console.
  3. Both.

Let me know what you prefer - happy to open a PR if you think this is worthwile...

dfm commented 4 years ago

Sure - that would be great! It might be worth taking a look at PyMC3 too to see if you could contribute that to the sample method because the same problem will happen there.