RocketPy
RocketPy copied to clipboard
ENH: Simulation Save and Load in JSON Files
Pull request type
- [X] Code changes (bugfix, features)
Checklist
- [X] Tests for the changes have been added (if needed)
- [ ] Docs have been reviewed and added / updated
- [X] Lint (
black rocketpy/ tests/) has passed locally - [X] All tests (
pytest tests -m slow --runslow) have passed locally - [ ]
CHANGELOG.mdhas been updated (if relevant)
New behavior
This PR improves rocketpy encoding and introduces decoding functionalities. The way this works is:
- If the is a
to_dictorfrom_dictmethod, they are used to perform the (de)encoding; - Otherwise, a default encoding of all vars() and constructor based decoding is done.
Breaking change
- [ ] Yes
- [X] No
Additional information
PR #679 should be merged first.
Here are some of the steps that could be improved:
- [ ] Verify why the test for hybrid motor flight requires higher tolerances;
- [ ] Test if all of the atmospheric models of Environments can be decoded without requiring re-read of files or API;
- [ ] Evaluate whether we should encode outputs or only the minimum required information to decode the class from its init;
- [ ] (Optional) Expand implementation to
AirBrakes+Controllersand new classes.
Some important remarks:
- The simple getting started simulation is essentially identical comparing the store & load, the only difference is the random lag and noise from Parachute class. I could not found a simple solution to reset those and always get the same results.
Codecov Report
Attention: Patch coverage is 81.19891% with 69 lines in your changes missing coverage. Please review.
Project coverage is 76.38%. Comparing base (
7c18881) to head (5d1c585). Report is 3 commits behind head on enh/sim-encoding.
Additional details and impacted files
@@ Coverage Diff @@
## enh/sim-encoding #695 +/- ##
====================================================
+ Coverage 76.37% 76.38% +0.01%
====================================================
Files 94 94
Lines 11343 11341 -2
====================================================
Hits 8663 8663
+ Misses 2680 2678 -2
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@phmbressan , as previously discussed, can you leave only one of the #679 and #695 open please?