shihyuntang / igrins_rv

Welcome to IGRINS RV, a open source pipeline for extracting radial velocity (RV) for the Immersion GRating INfrared Spectrometer (IGRINS) instrument. Please contact asa.stahl@rice.edu or sytang@lowell.edu for more detail.
https://igrins-rv.readthedocs.io
MIT License
6 stars 1 forks source link

Transition from print to logging with a progress bar #4

Closed gully closed 3 years ago

gully commented 3 years ago

Currently the code prints lots of progress information to standard out. The user may wish to get more or less information depending on their experience level. If possible, I recommend using tqdm to enable a progress bar for each of the main steps, so the user can gauge execution time at a glance. The code already uses a logger---is it feasible to migrate the print statements to logging .info()?

Output from third party packages like TelFit could be suppressed and possibly/optionally sent to the logger. For an example implementation see the lightkurve utility suppress_stdout.

shihyuntang commented 3 years ago

Hi @gully ,

Thank you for your suggestion. I tried the suppress_stdout, but was only able to remove some part of the printout. Something like these will remain:

Note: The following floating-point exceptions are signalling: IEEE_UNDERFLOW_FLAG IEEE_DENORMAL
STOP  LBLRTM EXIT 
0.48user 0.58system 0:01.07elapsed 99%CPU (0avgtext+0avgdata 7752maxresident)k
0inputs+37328outputs (0major+958minor)pagefaults 0swaps
Note: The following floating-point exceptions are signalling: IEEE_UNDERFLOW_FLAG IEEE_DENORMAL
STOP  LBLRTM EXIT 
0.57user 0.48system 0:01.06elapsed 98%CPU (0avgtext+0avgdata 7780maxresident)k
0inputs+37064outputs (0major+959minor)pagefaults 0swaps

Running exec: lblrtm

I think this is because of different ways that Telfit is calling them? Any further suggestion? Thank you!

shihyuntang commented 3 years ago

Hi @gully ,

Thank you again for the suggestion. I am able to suppress all the Telfit output by modifying the subprocess code in Telfit (see kgullikson88/Telluric-Fitter#27). Now printouts from the main_step1.py looks like:

Screen Shot 2021-04-10 at 14 52 32

I will let you know when this had been applied to all steps.

shihyuntang commented 3 years ago

Updates: Steps 1--3 are now showing with the progress bar, using the parallel tqdm pkg. Printouts in the old version will only show under DeBug mode now. Thank @gully again for this suggestion. The code looks more professional with these progress bar! (latest stable version of this update is under the JOSS_review_updates branch)