Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Simulation Save and Load in JSON Files #695

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

phmbressan
Copy link
Collaborator

@phmbressan phmbressan commented Sep 22, 2024

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)

New behavior

This PR improves rocketpy encoding and introduces decoding functionalities. The way this works is:

  • If the is a to_dict or from_dict method, they are used to perform the (de)encoding;
  • Otherwise, a default encoding of all vars() and constructor based decoding is done.

Breaking change

  • Yes
  • 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 + Controllers and 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.

@phmbressan phmbressan added the Enhancement New feature or request, including adjustments in current codes label Sep 22, 2024
@phmbressan phmbressan added this to the Release v1.X.0 milestone Sep 22, 2024
@phmbressan phmbressan self-assigned this Sep 22, 2024
@phmbressan phmbressan requested a review from a team as a code owner September 22, 2024 15:28
Copy link

codecov bot commented Sep 22, 2024

Codecov Report

Attention: Patch coverage is 82.79070% with 37 lines in your changes missing coverage. Please review.

Project coverage is 76.21%. Comparing base (c21e2d1) to head (022fa57).
Report is 11 commits behind head on develop.

Files with missing lines Patch % Lines
rocketpy/environment/environment.py 63.04% 17 Missing ⚠️
rocketpy/motors/tank_geometry.py 68.42% 6 Missing ⚠️
rocketpy/_encoders.py 90.90% 4 Missing ⚠️
rocketpy/motors/tank.py 89.47% 2 Missing ⚠️
rocketpy/rocket/parachute.py 88.23% 2 Missing ⚠️
rocketpy/simulation/flight.py 60.00% 2 Missing ⚠️
rocketpy/motors/motor.py 66.66% 1 Missing ⚠️
...cketpy/rocket/aero_surface/fins/elliptical_fins.py 66.66% 1 Missing ⚠️
rocketpy/rocket/components.py 50.00% 1 Missing ⚠️
rocketpy/rocket/rocket.py 95.23% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #695      +/-   ##
===========================================
+ Coverage    76.06%   76.21%   +0.14%     
===========================================
  Files           99       99              
  Lines        11278    11486     +208     
===========================================
+ Hits          8579     8754     +175     
- Misses        2699     2732      +33     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@GabrielBarberini GabrielBarberini left a comment

Choose a reason for hiding this comment

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

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
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

2 participants