Skip to main content

Function reference

System setup

Create a system and add bodies to it. Every OrbitSystem method below is also available as a function that takes the system first, for example orb.add_planet(system, "Earth", parent="Sun").

create_system Create a new, empty orbital system.
load_solar_system Load the solar system, ready to simulate.
OrbitSystem.add_sun Add the Sun to a system.
OrbitSystem.add_body Add a body by its position and velocity.
OrbitSystem.add_body_keplerian Add a body using Keplerian orbital elements.
OrbitSystem.add_planet Add a known solar system body by name.
OrbitSystem.remove_body Remove one or more bodies from a system.
OrbitSystem.get_bodies Get the body table of a system as a DataFrame.
OrbitSystem A set of bodies and the gravitational constant that binds them.

Simulation

Run the N-body simulation.

simulate_system Integrate a system forward in time.
continue_simulation Run on from a simulation’s last state and append the new rows.
system_from_simulation Rebuild a system from one time step of a simulation.
calc_acceleration Gravitational acceleration of every body due to every other body.

Analysis

Reference frames, orbital elements, and conserved quantities.

shift_reference_frame Re-center a simulation on one body, or on the center of mass.
get_orbital_elements Osculating orbital elements of one body about another at every time step.
get_energy Total kinetic, potential and mechanical energy at every time step.
get_momentum Total linear momentum at every time step.
get_angular_momentum Total angular momentum about the origin at every time step.
conserved_quantities Energy, momentum and angular momentum at every step, with relative errors.

Visualization

Plot and animate a simulation.

plot_orbits Plot the full trajectory of every body.
plot_orbits_3d Plot the full trajectory of every body in interactive 3D.
plot_system Plot where every body is at a single time.
plot_system_3d Plot where every body is at a single time in interactive 3D.
animate_system Animate the system over time.
animate_system_3d Animate the system over time in interactive 3D.

pandas or polars

Choose the kind of DataFrame pyorbiter returns.

set_backend Choose the DataFrame library pyorbiter returns.
get_backend The DataFrame library pyorbiter currently returns by default.
run_settings The settings of the run that produced a simulation.

Save and export

Save systems and export body data.

save_system Save a system to a JSON file.
load_system Load a system from a JSON file.
export_bodies Export the body table of a system to a CSV file.