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

Save only unique frames and use GIF frame durations from PIL #278

Merged
merged 4 commits into from
Feb 17, 2025

Conversation

stefmolin
Copy link
Owner

@stefmolin stefmolin commented Feb 17, 2025

  • Rather than creating an image for each frame, create one only for unique frames and then use PIL to set the duration for each frame when stitching together the GIF
  • Refactored DataMorpher._record_frames() to just record and not advance the frame number
  • Changed frame numbers in file names to iteration numbers
  • Add frame_numbers parameter to stitch_gif_animation() for calculating durations
  • Improve testing of stitch_gif_animation() to count frames and durations

Benefits:

  • Significant reduction in file size of resulting GIF (~0.6 MB)
  • Under one minute when just running a single job (music to heart in 53 seconds)
  • ~10 second improvement per job from Run in parallel via CLI #273
    • The majority of which was the time it took for the progress bars to start showing progress → this was the time it took for the initial frames to be created before the morphing could even start
    • Progress also starts right away now
Screenshot 2025-02-16 at 7 27 44 PM

@github-actions github-actions bot added testing Relating to the testing suite plotting Work relating to plotting module morpher Work relating to morpher module labels Feb 17, 2025
Copy link

codecov bot commented Feb 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.63%. Comparing base (81bcd6a) to head (30877fb).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #278      +/-   ##
==========================================
+ Coverage   98.58%   98.63%   +0.05%     
==========================================
  Files          81       81              
  Lines        2052     2056       +4     
  Branches      124      121       -3     
==========================================
+ Hits         2023     2028       +5     
  Misses         26       26              
+ Partials        3        2       -1     
Files with missing lines Coverage Δ
src/data_morph/morpher.py 100.00% <100.00%> (ø)
src/data_morph/plotting/animation.py 100.00% <100.00%> (+2.43%) ⬆️
tests/plotting/test_animation.py 100.00% <100.00%> (ø)
tests/test_morpher.py 100.00% <100.00%> (ø)

@stefmolin stefmolin merged commit 6eec1d7 into main Feb 17, 2025
23 checks passed
@stefmolin stefmolin deleted the io-optimizations branch February 17, 2025 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
morpher Work relating to morpher module plotting Work relating to plotting module testing Relating to the testing suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant