Skip to content

Conversation

Copy link

Copilot AI commented Nov 27, 2025

Pull request type

  • Code changes (bugfix, features)

Checklist

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

Current behavior

_MonteCarloPlots.all() can only display histograms interactively. No option to save to disk, unlike ellipses(save=True) and other plot methods in RocketPy that support filename parameter.

New behavior

Added filename parameter to _MonteCarloPlots.all() following the established pattern used in _FlightPlots:

  • Uses show_or_save_plot() helper for consistent behavior
  • When saving multiple keys, appends key name to filename stem (e.g., histogram.pnghistogram_apogee.png)
# Save single histogram
monte_carlo.plots.all(keys="apogee", filename="output/histogram.png")
# → output/histogram_apogee.png

# Save multiple histograms
monte_carlo.plots.all(keys=["apogee", "x_impact"], filename="output/results.png")
# → output/results_apogee.png, output/results_x_impact.png

# Display without saving (unchanged)
monte_carlo.plots.all()

Breaking change

  • No

Additional information

Closes #761

Also refactored _post_test_file_cleanup() in test file to use list-based approach for maintainability.

Original prompt

This section details on the original issue you should resolve

<issue_title>ENH: Save _MonteCarloPlots.all plots to disk</issue_title>
<issue_description>Is your feature request related to a problem? Please describe.

The histograms generated by by MonteCarlo simulations (e.g. monte_carlo_simulation.plots.all()) cannot be saved because the function is missing a save boolean (like the ellipses function already has, e.g. monte_carlo_simulation.plots.ellipses(save=True)).

Describe the solution you'd like

Add save functionality to _MonteCarloPlots.all

Additional context

Other plots in RocketPy, e.g. _FlightPlots.linear_kinematics_data, have a filename parameter instead of a save boolean. Please consider whether it would make sense to adapt MonteCarlo-related plot functions to allow specifying the filename as well.
</issue_description>

<agent_instructions>Please read the instructions file. Check out the rocketpy/plots folder to understand how we organize our plots.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@Gui-FernandesBR @nalquas copilot has opened a PR to tackle this issue. Let's follow #848 now

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
@Gui-FernandesBR Gui-FernandesBR linked an issue Nov 27, 2025 that may be closed by this pull request
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
Copilot AI changed the title [WIP] Add save functionality to MonteCarloPlots.all method ENH: Add save functionality to _MonteCarloPlots.all method Nov 27, 2025
Copilot finished work on behalf of Gui-FernandesBR November 27, 2025 16:24
@Gui-FernandesBR Gui-FernandesBR marked this pull request as ready for review November 27, 2025 16:27
@Gui-FernandesBR Gui-FernandesBR requested a review from a team as a code owner November 27, 2025 16:27
@Gui-FernandesBR
Copy link
Member

@copilot please add this PR to the CHANGELOG.md file!

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
Copy link
Author

Copilot AI commented Nov 27, 2025

@copilot please add this PR to the CHANGELOG.md file!

Added to CHANGELOG.md in commit 92a4f36.

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.

LGTM

Copilot finished work on behalf of Gui-FernandesBR November 27, 2025 16:31
@codecov
Copy link

codecov bot commented Nov 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.37%. Comparing base (9cf3dd4) to head (92a4f36).
⚠️ Report is 10 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #884      +/-   ##
===========================================
+ Coverage    80.27%   80.37%   +0.09%     
===========================================
  Files          104      106       +2     
  Lines        12769    13007     +238     
===========================================
+ Hits         10250    10454     +204     
- Misses        2519     2553      +34     

☔ 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.

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.

Amazing!

@Gui-FernandesBR Gui-FernandesBR merged commit 0c8790e into develop Nov 27, 2025
18 checks passed
@Gui-FernandesBR Gui-FernandesBR deleted the copilot/add-save-functionality-to-montecarlo-plots branch November 27, 2025 16:47
@github-project-automation github-project-automation bot moved this from Backlog to Closed in LibDev Roadmap Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

ENH: Save _MonteCarloPlots.all plots to disk

2 participants