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: make rocketpy classes json serializable #522

Open
Gui-FernandesBR opened this issue Jan 12, 2024 · 0 comments
Open

ENH: make rocketpy classes json serializable #522

Gui-FernandesBR opened this issue Jan 12, 2024 · 0 comments
Assignees
Labels
Enhancement New feature or request, including adjustments in current codes

Comments

@Gui-FernandesBR
Copy link
Member

Is your feature request related to a problem? Please describe.

Exporting rocketpy classes to a json file is something that the user currently cannot do so easily.
The get_instance_attributes (see below) function already made an important advance to export all the attributes of an instance to a dictionary, but that doesn't mean we can always save these dictionaries to json files.

Exporting objects as json files might be the easiest way of saving a rocketpy simulation without having to plot tons of data and plots.

def get_instance_attributes(instance):

Describe the solution you'd like

  • Add to_json, to_serializable or __json__ methods to the important classes of RocketPy, allowing the
  • Alternatively, the jsonpickle package can be used to perform a quick encode/decode with any of the rocketpy classes, as already done in the EnvironmentAnalysis class.
    def save(self, filename="env_analysis_dict"):

Additional context

As far as I know there's no convention on Python regarding the name of the method

@Gui-FernandesBR Gui-FernandesBR added the Enhancement New feature or request, including adjustments in current codes label Jan 12, 2024
@Gui-FernandesBR Gui-FernandesBR added this to the Release v1.X.0 milestone Jan 12, 2024
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

No branches or pull requests

2 participants