Writes the system’s gravitational constant and its body table to a file that load_system() can read back. Use it to keep a set of starting conditions, or to share one with someone else. The file is plain JSON, so it can be opened in a text editor. Also available as the chained method system.save(path).
Parameters
Name
Type
Description
Default
system
OrbitSystem
The system to save.
required
path
str or path - like
The file to write, for example "my_system.json". It is overwritten if it exists.
required
Returns
Name
Type
Description
OrbitSystem
The same system, unchanged, so the call can sit in the middle of a chain.
export_bodies: Write only the body table, as a CSV file.
Notes
The file holds four entries: format (the text "pyorbiter.orbit_system"), version (1), G, and bodies, a list with one record per body giving id, mass, x, y, z, vx, vy and vz. Only the starting state is saved, not the results of a simulation.
Examples
Save a system to a temporary folder and load it again.