ekaterinailin / AltaiPony

Find flares in Kepler and TESS light curves. Notebooks for quickstart inside.
https://altaipony.readthedocs.io
MIT License
26 stars 10 forks source link

update progressbar for sample_flare_recovery #72

Open toihr opened 2 years ago

toihr commented 2 years ago

What needs to be created or improved?

two updates for the progressbar i want to propose. First the ability to turn of the progressbar and secondly make the progressbar only singular line and not space filling.

Can you provide an example?

currently calling

flcd, fakeflc = flcd.sample_flare_recovery(inject_before_detrending=False, 
                                          iterations=50, fakefreq=0.01, ampl=[1e-4, 0.02],
                                           dur=[.001/6., 0.01/6.]
                                      )

causes a massive output which is especially distracting when working in a jupyter notebook, if you go for 1000 iterations or more you have significant scrolling time.

  0%|                                                                         |NumExpr defaulting to 4 threads.
Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
  2%|#                                                                        |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
  4%|##                                                                       |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
  6%|####                                                                     |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
  8%|#####                                                                    |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 10%|#######                                                                  |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 12%|########                                                                 |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 14%|##########                                                               |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 16%|###########                                                              |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 18%|#############                                                            |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 20%|##############                                                           |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 22%|################                                                         |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 24%|#################                                                        |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 26%|##################                                                       |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 28%|####################                                                     |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 30%|#####################                                                    |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 32%|#######################                                                  |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 34%|########################                                                 |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 36%|##########################                                               |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 38%|###########################                                              |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 40%|#############################                                            |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 42%|##############################                                           |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 44%|################################                                         |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 46%|#################################                                        |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 48%|###################################                                      |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 50%|####################################                                     |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 52%|#####################################                                    |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 54%|#######################################                                  |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 56%|########################################                                 |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 58%|##########################################                               |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 60%|###########################################                              |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 62%|#############################################                            |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 64%|##############################################                           |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 66%|################################################                         |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 68%|#################################################                        |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 70%|###################################################                      |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 72%|####################################################                     |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 74%|######################################################                   |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 76%|#######################################################                  |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 78%|########################################################                 |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 80%|##########################################################               |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 82%|###########################################################              |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 84%|#############################################################            |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 86%|##############################################################           |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 88%|################################################################         |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 90%|#################################################################        |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 92%|###################################################################      |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 94%|####################################################################     |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 96%|######################################################################   |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
 98%|#######################################################################  |Found 1 candidate(s) in the (0,606) gap.
Found 1 candidate(s) in the (606,1169) gap.
100%|#########################################################################|

What is the goal / expected behaviour?

I expect a usable argument for example like this:

flcd, fakeflc = flcd.sample_flare_recovery(inject_before_detrending=False, 
                                          iterations=50, fakefreq=0.01, ampl=[1e-4, 0.02],
                                           dur=[.001/6., 0.01/6.] , progress=False
                                      )

which will supress the progressbar. And in the case of progress being true a progressbar that is single line as such;

76%|████████████████████████        | 7568/10000 [00:33<00:10, 229.00it/s]
ekaterinailin commented 2 years ago

This might be a similar problem to this: https://github.com/tqdm/tqdm#faq-and-known-issues