Looks up the real mass and orbital elements of a well-known body and passes them to add_body_keplerian(). Instead of typing out the mass, semi-major axis, eccentricity and angles by hand, give the name and the parent. Any element, or the mass, can be overridden to explore a “what if” while keeping the rest of the real values. Also available as orb.add_planet(system, ...).
The built-in values are mean orbital elements at the J2000 epoch, with angles measured from the plane of Earth’s orbit. The mass and semi-major axis are the package constants (for example orb.mass_mars and orb.distance_mars_sun).
Name
a (m)
e
i (deg)
lan (deg)
arg_pe (deg)
Mercury
5.791e10
0.2056
7.00
48.33
29.12
Venus
1.082e11
0.0068
3.39
76.68
54.88
Earth
1.496e11
0.0167
0.00
-11.26
114.21
Mars
2.279e11
0.0934
1.85
49.58
286.50
Jupiter
7.785e11
0.0489
1.30
100.46
273.87
Saturn
1.434e12
0.0565
2.49
113.72
339.39
Uranus
2.871e12
0.0457
0.77
74.23
96.99
Neptune
4.495e12
0.0113
1.77
131.72
273.19
Moon
3.844e8
0.0549
5.15
125.08
318.15
Pluto
5.906e12
0.2488
17.16
110.30
113.83
Parameters
Name
Type
Description
Default
name
str
The body to add. One of "Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Moon" or "Pluto". Case does not matter: "earth" is stored as "Earth".
required
parent
str
The name of the body being orbited, which must already be in the system. For the planets and Pluto this is normally "Sun"; for the Moon it is "Earth". Case does not matter. Must be passed by keyword.
required
nu
float
True anomaly in degrees: where the body starts along its orbit. Default 0, which is periapsis. This is the element most often changed. Use it to spread planets around their orbits instead of starting them all at closest approach.
0
a
float
Semi-major axis in meters. The default, None, uses the built-in value.
None
e
float
Eccentricity. The default, None, uses the built-in value.
None
i
float
Inclination in degrees. The default, None, uses the built-in value.
None
lan
float
Longitude of the ascending node in degrees. The default, None, uses the built-in value.
None
arg_pe
float
Argument of periapsis in degrees. The default, None, uses the built-in value.
None
mass
float
Mass in kilograms. The default, None, uses the built-in value.
None
Returns
Name
Type
Description
OrbitSystem
A new system with the body added under its standard name. The original system is not modified.
Raises
Name
Type
Description
ValueError
If parent is not in the system, if name is not one of the ten available bodies, if the body is already in the system, or if an override fails the checks in add_body_keplerian().
The elements are taken relative to whichever parent you name. The function does not check that the pairing is the real one, so add_planet("Moon", parent="Sun") puts a Moon-mass body in a Moon-sized orbit around the Sun.
Examples
The inner solar system, simulated for one year and drawn from above (three_d=False gives the flat view of the x-y plane).