Skip to content

Conversation

@Bizo883
Copy link

@Bizo883 Bizo883 commented Nov 30, 2025

Pull request type

  • Code changes (bugfix, features)
  • Code maintenance (refactoring, formatting, tests)
  • ReadMe, Docs and GitHub updates
  • Other (please describe):

Checklist

  • Tests for the changes have been added (if needed)
  • Docs have been reviewed and added / updated
  • Lint (black rocketpy/ tests/) has passed locally
  • All tests (pytest tests -m slow --runslow) have passed locally
  • CHANGELOG.md has been updated (if relevant)

Current behavior

Currently provides only static plots for motor propellant mass and tank fluid volumes.

New behavior

This PR introduces new animation features for motors and tanks:

--Motor animations
A new method animate_propellant_mass() creates an animation of propellant mass decreasing over time.

--Tank animations
A new method animate_fluid_volume() animates liquid volume and gas volume evolution simultaneously.

--Animation saving helper
Added show_or_save_animation() in plot_helpers.py, providing a interface for saving or displaying animations.

--Unit tests
Added test_show_or_save_animation ensuring correct behavior for .gif output and error handling of unsupported formats.

Breaking change

  • Yes
  • No

Additional information

Enter text here...

@codecov
Copy link

codecov bot commented Nov 30, 2025

Codecov Report

❌ Patch coverage is 23.18841% with 53 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.04%. Comparing base (9cf3dd4) to head (2f87bef).
⚠️ Report is 13 commits behind head on develop.

Files with missing lines Patch % Lines
rocketpy/plots/tank_plots.py 8.82% 31 Missing ⚠️
rocketpy/plots/motor_plots.py 12.00% 22 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #894      +/-   ##
===========================================
- Coverage    80.27%   80.04%   -0.23%     
===========================================
  Files          104      106       +2     
  Lines        12769    13077     +308     
===========================================
+ Hits         10250    10468     +218     
- Misses        2519     2609      +90     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Gui-FernandesBR
Copy link
Member

Great one!!!

Copilot finished reviewing on behalf of Gui-FernandesBR November 30, 2025 21:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds animation capabilities to RocketPy's plotting functionality, enabling users to visualize motor propellant mass and tank fluid volume changes over time as animated GIFs. The implementation introduces two new animation methods and a helper function to support animation saving/display, following the existing patterns in the codebase for plot methods.

Key Changes

  • Added show_or_save_animation() helper function to provide a consistent interface for saving or displaying matplotlib animations (similar to existing show_or_save_plot() and show_or_save_fig())
  • Implemented animate_propellant_mass() method for motors to visualize propellant mass depletion over burn time
  • Implemented animate_fluid_volume() method for tanks to visualize liquid and gas volume evolution simultaneously

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
rocketpy/plots/plot_helpers.py Added show_or_save_animation() helper function supporting .gif format with fps parameter and validation
rocketpy/plots/motor_plots.py Added animate_propellant_mass() method to create animated visualization of motor propellant mass over time
rocketpy/plots/tank_plots.py Added animate_fluid_volume() method to animate liquid and gas volume changes in tanks
tests/unit/test_plots.py Added unit test for show_or_save_animation() covering both show and save behaviors
CHANGELOG.md Updated with new enhancement entry for animation features

Copy link
Member

@Gui-FernandesBR Gui-FernandesBR left a comment

Choose a reason for hiding this comment

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

Overall the code looks pretty good. I believe it is one of the best PRs I have received lately.

Something I would like to see here before approving is some examples of the plots you have generated. Would you mind sharing us a few screenshots/screen records?

Also, did you verify if your new methods works on jupyter notebooks?

@Gui-FernandesBR Gui-FernandesBR linked an issue Dec 1, 2025 that may be closed by this pull request
@Bizo883
Copy link
Author

Bizo883 commented Dec 1, 2025

propellant_mass
tank_liquid
Here are two examples.One is for animate_propellant_mass and another one is for animate_fluid_volume.And they can work on jupyter notebooks.I've tried it.

@Gui-FernandesBR
Copy link
Member

@Bizo883 can you solve linters and codecoverage issues?

image

FYI: https://docs.rocketpy.org/en/latest/development/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

ENH: Improve tanks and motors visualizations

2 participants