Planet#
Function to calculate planet’s orbit and location
- planet.orbit_plot(a, e, pa, inc, planet_pos, plot_dpi, res, flip, mode, name='')#
Plot the orbit of a planet around a star.
- Parameters:
a (float) – Semi-major axis of the orbit.
e (float) – Eccentricity of the orbit.
pa (float) – Position angle of the orbit (degrees).
inc (float) – Inclination of the orbit (degrees).
planet_pos (tuple) – Planet’s position (x, y) in the specified mode.
mode (str) – Coordinate mode (“polar” or “cartesian”).
name (str) – Additional name for the saved plot file.
plot_dpi (int) – Dots per inch (DPI) for the plot.
res (int) – Number of points used for orbit calculations.
- Returns:
orbit_*.png
- planet.orbit_position(a, e, pa, inc, res)#
Calculate the Cartesian positions of points along an elliptical orbit.
- Parameters:
a (float) – Semi-major axis of the orbit.
e (float) – Eccentricity of the orbit.
pa (float) – Position angle of the orbit (degrees).
inc (float) – Inclination of the orbit (degrees).
res (int) – Number of points used for orbit calculations.
- Returns:
Arrays of x and y positions along the orbit.
- Return type:
tuple
- planet.planet_position(a, e, pa, inc, t, mode, res)#
Calculate the position of a planet in an elliptical orbit at a given time.
- Parameters:
a (float) – Semi-major axis of the orbit.
e (float) – Eccentricity of the orbit.
pa (float) – Position angle of the orbit (degrees).
inc (float) – Inclination of the orbit (degrees).
t (float) – Time value for which to calculate the planet’s position.
mode (str) – Coordinate mode (“polar” or “cartesian”) for the output.
res (int) – Number of points used for orbit calculations.
- Returns:
Planet’s position in the specified mode.
- Return type:
tuple
- planet.t_period_convert(t)#
Convert a time value to its fractional part in the interval [0, 1].
- Parameters:
t (float) – The input time value.
- Returns:
The fractional part of the input time.
- Return type:
float