-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Best way to have shorter loops within larger loop #762
Comments
Judging from #755 it looks like you prefer these questions to be asked on stackoverflow. Posted here: https://stackoverflow.com/questions/56704176/tqdm-with-intervals-inside-larger-loop |
yup thanks. note
|
FYI from __future__ import division, print_function
import itertools
from math import ceil
from tqdm import tqdm
from time import sleep
total = 987
log_interval = 2
save_interval = 9
with tqdm(total=total, desc="overall") as tOverall:
with tqdm(total=ceil(total / log_interval), unit="log") as tLog:
with tqdm(total=ceil(total / save_interval), unit="save") as tSave:
for i in itertools.count(0, 1):
sleep(0.01)
if i % log_interval == 0:
#perform_logging()
tLog.update()
if i % save_interval == 0:
#save()
tSave.update()
if i + 1 == total:
break
tOverall.update()
print('\n') |
I ended up making a bit of an adjustment to this. For explanation and new version, see https://stackoverflow.com/a/56777870/4176597. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a simple usage question. I have an outer loop
and there are events that occur at intervals:
I would like to use
tqdm
to track the progress toward the next log/save/etc.Ideally,
tqdm
would print several progress bars simultaneously, a laWhat's the best way to do this? Thanks!
The text was updated successfully, but these errors were encountered: