Skip to content
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

clip progress progressbar #399

Merged
merged 1 commit into from
Feb 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion strax/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,11 @@ def _make_progress_bar(self, run_id, targets, progress_bar=True):
def _update_progress_bar(pbar, t_start, t_end, n_chunks, chunk_end):
"""Do some tqdm voodoo to get the progress bar for st.get_iter"""
if t_end - t_start > 0:
pbar.n = (chunk_end - t_start) / (t_end - t_start)
fraction_done = (chunk_end - t_start) / (t_end - t_start)
if fraction_done > .99:
# Patch to 1 to not have a red pbar when very close to 100%
fraction_done = 1
pbar.n = np.clip(fraction_done, 0, 1)
else:
# Strange, start and endtime are the same, probably we don't
# have data yet e.g. allow_incomplete == True.
Expand Down