Skip to content

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

Open
khushalkottaru wants to merge 8 commits into
RocketPy-Team:developfrom
khushalkottaru:enh/issue-945-monte-carlo-formats
Open

ENH: Monte Carlo Formatting Options (#945)#947
khushalkottaru wants to merge 8 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
Copy link
Copy Markdown

codecov Bot commented Mar 31, 2026

Codecov Report

❌ Patch coverage is 90.90909% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.17%. Comparing base (9cf3dd4) to head (0d3c9a0).
⚠️ Report is 72 commits behind head on develop.

Files with missing lines Patch % Lines
rocketpy/simulation/monte_carlo.py 90.90% 9 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #947      +/-   ##
===========================================
+ Coverage    80.27%   81.17%   +0.90%     
===========================================
  Files          104      107       +3     
  Lines        12769    13967    +1198     
===========================================
+ Hits         10250    11338    +1088     
- Misses        2519     2629     +110     

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

@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
Copy link
Copy Markdown
Member

@MateusStano MateusStano left a comment

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

Copy link
Copy Markdown
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.

The CHANGELOG.md file needs to be updated.

Also, linters need to be solved

@Lucas-Prates
Copy link
Copy Markdown
Contributor

LGTM! :)

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.

4 participants