Repository navigation
ENH: Implement Multivariate Rejection Sampling (MRS) - #738
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #738 +/- ##
===========================================
+ Coverage 79.11% 79.76% +0.64%
===========================================
Files 96 97 +1
Lines 11575 11877 +302
===========================================
+ Hits 9158 9474 +316
+ Misses 2417 2403 -14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This PR is ready for a first "Design Review." I would like to get your opinion if this implementation provides what you think on how the user should use the MRS. Albeit a implementation as a function seems natural, I implemented as a class because:
It currently works as follows:
I provided a quick and dirty notebook, which will be removed, just to show how the class is being used at the moment. |
766bd58 to
c45fabf
Compare
Gui-FernandesBR
left a comment
There was a problem hiding this comment.
I don't have much time so I'll be short
- The class dies after you sample the data once, this makes it pointless to have a class
- Instead I'd remove the sample dictionary from arguments.
- First read the data during initialization. Then you use a function to set the variables you are going to allow be varied. This way u can already anticipate which variables may be varied.
- We want almost instant results for a MonteCarlo simulation after using MRS.
- Other thing is that the user must supply the original pdf. Could we possile estimate this from data? (imagine 70k)
- Finally, plotting is crucial for MRS, or even tables. We'd love to see more on that later.
c45fabf to
d3ab5f2
Compare
3a3c9e6 to
8ae8826
Compare
2931c30 to
7864590
Compare
8ae8826 to
d5e65a8
Compare
d5e65a8 to
36ea7f1
Compare
|
This PR is ready for review again. Changes from last time:
For review, I recommend mostly checking the .rst documentation. Here are some previews of the comparisons if you do not have the time to compile the html: |
commented
Feb 24, 2025
|
A second comment: I made the design choice to implement the comparison methods in the
One option is, of course, to create another class for that job, but it did not seem to be the best option. |
commented
Feb 27, 2025
|
I have addressed the suggestions made by @Gui-FernandesBR, implemented unit and integration tests for the MRS, and updated the CHANGELOG. |
commented
Feb 27, 2025
|
@Lucas-Prates good work. Please squash and merge at your earliest convinience |
| plt.scatter( | ||
| original_apogee_x, | ||
| original_apogee_y, | ||
| s=5, | ||
| marker="^", | ||
| color="green", | ||
| label="Original Apogee", | ||
| ) | ||
| plt.scatter( | ||
| original_impact_x, | ||
| original_impact_y, | ||
| s=5, | ||
| marker="v", | ||
| color="blue", | ||
| label="Original Landing Point", | ||
| ) | ||
|
|
There was a problem hiding this comment.
Improve colors of the points/ellipses. Using oposite colors is probably best
There was a problem hiding this comment.
There's no such thing as "opposite colors", but matplotlib does offer a fair good guide to selecting colormaps: https://matplotlib.org/stable/users/explain/colors/colormaps.html
I suggest blue/orange or blue/red.
Ideally the user should be able to select their specific color... But I understand the current limitations.
There was a problem hiding this comment.
I will use then a "tetradic" color combination I found in this site. Here is the pallete I got, just for reference:
commented
Mar 31, 2025
|
This PR is ready again for review. Since last time: 1 - addressed the points in Stano's review about documentation and color; The most important point is 3 since it might introduce a breaking change. |
left a comment
There was a problem hiding this comment.
All looking good to me, great implementation.
I don't see the changes to flatten_dict as a problem.
Nobody is using that function right now.
Waiting for @MateusStano 's final comments so we can proceed.
left a comment
There was a problem hiding this comment.
Copilot reviewed 14 out of 21 changed files in this pull request and generated 1 comment.
Files not reviewed (7)
- .vscode/settings.json: Language not supported
- docs/notebooks/monte_carlo_analysis/monte_carlo_analysis_outputs/mrs.outputs.txt: Language not supported
- docs/reference/classes/MultivariateRejectionSampler.rst: Language not supported
- docs/reference/index.rst: Language not supported
- docs/user/index.rst: Language not supported
- docs/user/mrs.rst: Language not supported
- docs/user/sensitivity.rst: Language not supported
Comments suppressed due to low confidence (1)
rocketpy/tools.py:595
- [nitpick] Consider renaming 'flatted_dict' to 'flattened_dict' for clarity and consistency with common terminology.
flatted_dict = {}






Pull request type
Checklist
black rocketpy/ tests/) has passed locallypytest tests -m slow --runslow) have passed locallyCHANGELOG.mdhas been updated (if relevant)New behavior
This PR implements the MRS requested in #162 and described in RocketPy paper.
Breaking change
Additional information