Skip to content

ENH: Monte Carlo Formatting Options (#945)#947

Merged
Gui-FernandesBR merged 9 commits into
RocketPy-Team:developfrom
khushalkottaru:enh/issue-945-monte-carlo-formats
Jun 19, 2026
Merged

ENH: Monte Carlo Formatting Options (#945)#947
Gui-FernandesBR merged 9 commits into
RocketPy-Team:developfrom
khushalkottaru:enh/issue-945-monte-carlo-formats

Conversation

@khushalkottaru

Copy link
Copy Markdown
Contributor

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
  • All tests (pytest tests -m slow --runslow) have passed locally
  • CHANGELOG.md has been updated (if relevant)

Current behavior

The MonteCarlo class only reads and writes .txt files (JSONL format, one JSON object per line) for simulation inputs, outputs, and errors. Users who want to analyze results in Excel or other tools must manually convert these files to CSV or JSON themselves.

New behavior

The MonteCarlo class can now directly export simulation results to CSV and JSON formats, and import previously exported CSV/JSON files back in. New methods:

  • export_outputs_to_csv(filename) / export_outputs_to_json(filename)
  • export_inputs_to_csv(filename, flatten=False) / export_inputs_to_json(filename)
  • export_errors_to_csv(filename, flatten=False) / export_errors_to_json(filename)

The existing .txt (JSONL) format remains the default for simulation output since it supports streaming writes. CSV/JSON are post-processing export targets. The import_outputs, import_inputs, and import_errors methods also now accept .csv and .json files in addition to .txt.

Breaking change

  • Yes
  • No

Additional information

Related to issue #945.

@khushalkottaru khushalkottaru requested a review from a team as a code owner March 31, 2026 01:57
@khushalkottaru

Copy link
Copy Markdown
Contributor Author

Will update changelog.md and docs as needed soon.

@codecov

codecov Bot commented Mar 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.00000% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.16%. Comparing base (9cf3dd4) to head (061d30f).
⚠️ Report is 78 commits behind head on develop.

Files with missing lines Patch % Lines
rocketpy/simulation/monte_carlo.py 91.00% 9 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #947      +/-   ##
===========================================
+ Coverage    80.27%   81.16%   +0.89%     
===========================================
  Files          104      113       +9     
  Lines        12769    14668    +1899     
===========================================
+ Hits         10250    11905    +1655     
- Misses        2519     2763     +244     

☔ View full report in Codecov by Harness.
📢 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.

@MateusStano MateusStano changed the base branch from master to develop May 27, 2026 00:57
@MateusStano MateusStano added Enhancement New feature or request, including adjustments in current codes Monte Carlo Monte Carlo and related contents labels May 27, 2026
@MateusStano MateusStano requested a review from Lucas-Prates May 27, 2026 01:20

@MateusStano MateusStano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. I'll wait for @Lucas-Prates approval to Merge

@Gui-FernandesBR Gui-FernandesBR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The CHANGELOG.md file needs to be updated.

Also, linters need to be solved

@Lucas-Prates

Copy link
Copy Markdown
Contributor

LGTM! :)

@Gui-FernandesBR Gui-FernandesBR force-pushed the enh/issue-945-monte-carlo-formats branch from 0d3c9a0 to f33a722 Compare June 19, 2026 02:10
Gui-FernandesBR added a commit to khushalkottaru/RocketPy that referenced this pull request Jun 19, 2026
@Gui-FernandesBR Gui-FernandesBR force-pushed the enh/issue-945-monte-carlo-formats branch from f33a722 to 061d30f Compare June 19, 2026 02:20

@Gui-FernandesBR Gui-FernandesBR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@Gui-FernandesBR Gui-FernandesBR merged commit 254c06c into RocketPy-Team:develop Jun 19, 2026
15 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request, including adjustments in current codes Monte Carlo Monte Carlo and related contents

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ENH: Support multiple export formats (CSV, JSON) in MonteCarlo class

4 participants