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

Optimize next! in ProgressBar #53

Merged
merged 1 commit into from
Apr 4, 2024

Conversation

ytdHuang
Copy link
Member

@ytdHuang ytdHuang commented Apr 4, 2024

Optimize the display of progress bar:

  • add newline (\n) after the process is finished (100.0%)
  • use floor division operator (÷)
  • use lpad to make the display string length be fixed for the following variables:
    • percentage_100 fix string length to 5 (e.g., 5.0, 32.0, 100.0)
    • string length of values of minute and second be fixed to 2 (e.g., 00, 03, 60)

The last one makes the string length of print be exactly same for very short processes. Otherwise, the update makes the output shake.

@ytdHuang ytdHuang changed the title Optimize progress bar Optimize next! in ProgressBar Apr 4, 2024
Copy link

codecov bot commented Apr 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.00%. Comparing base (31efcf8) to head (fddfff5).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #53      +/-   ##
==========================================
- Coverage   90.00%   90.00%   -0.01%     
==========================================
  Files          18       18              
  Lines        1661     1660       -1     
==========================================
- Hits         1495     1494       -1     
  Misses        166      166              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@albertomercurio albertomercurio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@albertomercurio albertomercurio merged commit b349dd5 into qutip:main Apr 4, 2024
12 checks passed
@ytdHuang ytdHuang deleted the fix/progress_bar branch April 21, 2024 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants