koe_plot

ssapy.plotUtils.koe_plot(r, v, t=<Time object: scale='utc' format='iso' value=['2025-01-01 00:00:00.000' '2025-01-01 00:59:57.946'  '2025-01-01 01:59:55.893' ... '2025-12-31 22:00:04.107'  '2025-12-31 23:00:02.054' '2026-01-01 00:00:00.000']>, elements=['a', 'e', 'i'], save_path=False, body='Earth')[source][source]

Plot Keplerian orbital elements over time for a given trajectory.

Parameters: - r (array-like): Position vectors for the orbit. - v (array-like): Velocity vectors for the orbit. - t (array-like, optional): Time array for the plot, given as a sequence of astropy.time.Time objects or a Time object with np.linspace. Default is one year of hourly intervals starting from “2025-01-01”. - elements (list of str, optional): List of orbital elements to plot. Options include ‘a’ (semi-major axis), ‘e’ (eccentricity), and ‘i’ (inclination). Default is [‘a’, ‘e’, ‘i’]. - save_path (str, optional): Path to save the generated plot. If not provided, the plot will not be saved. Default is False. - body (str, optional): The celestial body for which to calculate the orbital elements. Options are ‘Earth’ or ‘Moon’. Default is ‘Earth’.

Returns: - fig (matplotlib.figure.Figure): The figure object containing the plot. - ax1 (matplotlib.axes.Axes): The primary axis object used in the plot.

The function calculates orbital elements for the given position and velocity vectors, and plots these elements over time. It creates a plot with two y-axes: one for the eccentricity and inclination, and the other for the semi-major axis. The x-axis represents time in decimal years.

Example usage: ``` import numpy as np from astropy.time import Time from your_module import koe_plot

# Example data r = np.array([[[1, 0, 0], [0, 1, 0]]]) # Replace with actual data v = np.array([[[0, 1, 0], [-1, 0, 0]]]) # Replace with actual data t = Time(“2025-01-01”, scale=’utc’) + np.linspace(0, int(1 * 365.25), int(365.25 * 24))

koe_plot(r, v, t, save_path=’orbital_elements_plot.png’) ```