BUG: avoid scalar statistics for structured Monte Carlo results - #1146
Open
ting-hong-shieh wants to merge 1 commit into
Open
BUG: avoid scalar statistics for structured Monte Carlo results#1146ting-hong-shieh wants to merge 1 commit into
ting-hong-shieh wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1146 +/- ##
===========================================
+ Coverage 82.18% 83.32% +1.14%
===========================================
Files 122 130 +8
Lines 16355 17076 +721
===========================================
+ Hits 13441 14229 +788
+ Misses 2914 2847 -67 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request type
Closes #1145.
Current behavior
MonteCarlo.set_processed_results()sends all collected output values to NumPy's scalar aggregation functions. Equal-shaped lists and arrays are flattened into a single distribution, while ragged or empty values raise before results can finish loading.At merge base
cb6106a717207dd8fc2dfe1446d80ff75022f21b:[[1, 2], [3, 4]]2.5np.array([1, 2])values2.5[[1], [2, 3]]ValueError[]IndexErrorNew behavior
Summary statistics are calculated only when every observation is a real-valued scalar. Structured, non-numeric, boolean, mixed, and empty results remain unchanged in
results; their existing five-elementprocessed_resultstuple is(None, None, None, None, None).The tuple shape and scalar result behavior remain unchanged.
At head
0c93bf7058222e4997df52981d45a9da4ad25e17, all four inputs above return the five-Nonetuple without changing their raw values.Verification
.venv/bin/python -m pytest tests/unit/simulation/test_monte_carlo.py -k set_processed_results -q: 9 passed.venv/bin/python -m pytest tests/unit/simulation/test_monte_carlo.py tests/integration/simulation/test_monte_carlo.py -m 'not slow' -q: 50 passed, 5 deselected.venv/bin/ruff check rocketpy/simulation/monte_carlo.py tests/unit/simulation/test_monte_carlo.py: passed.venv/bin/ruff format --check rocketpy/simulation/monte_carlo.py tests/unit/simulation/test_monte_carlo.py: passedgit diff --check: passedThe slow Monte Carlo simulation matrix was not run locally.
Environment: RocketPy 1.13.0; Python 3.12.6; NumPy 2.5.2; SciPy 1.18.0; pytest 9.1.1; Ruff 0.16.3; macOS 26.5.2 arm64.
Breaking change