Example Usage
pandoraspacecraft is a tool to get access to the current TLE and SPK for the NASA Pandora Smallsat. pandoraspacecraft will give you positions and velocities of the spacecraft with respect to other bodies in the solar system.
import pandoraspacecraft as psc
from astropy.time import Time
import numpy as np
import matplotlib.pyplot as plt
# Note I am enabling test mode here, if you are using this package for more than quick tests you should not enable this
psc.enable_test_mode()
To use the tool, initiate the Spacecraft object
ps = psc.PandoraSpacecraft()
ps
`pandoraspacecraft` is in test mode, and will not download new kernels. Will truncated kernels.
PandoraSpacecraft
This object has methods and properties to help you understand Pandora's orbital properties. You will need to input a time where you want these properties to be evaluated. To do this, you will use astropy.time.Time objects, or you can input times in JD.
You can find the start time of the validity range for the TLEs/SPKs of Pandora using start_time
ps.start_time
<Time object: scale='utc' format='datetime' value=2026-02-20 20:09:56.999998>
And the end time of the validity range using end_time
ps.end_time
<Time object: scale='utc' format='datetime' value=2026-02-25 11:33:59.999999>
Make sure you have the most up to date version of the package to ensure you have the most up-to-date TLEs and SPKs to work with.
Below is an example of how to get the position of Pandora. The function below makes a range of times for 20 days at the beginning of the mission.
t = Time(np.linspace(ps.start_time.jd + 0.1, ps.end_time.jd - 0.1, 50000), format='jd')
ps.get_spacecraft_position(t)
This defaults to the position with respect to the solar system barycenter. You can change the body in the function call.
ps.get_spacecraft_position(t, "earth")
There are handy plotting functions in the package to help you
ax = ps.plot_earth()
ps.plot_position(t, ax=ax);
You can get the velocity of the spacecraft too
ps.get_spacecraft_velocity(t)
The light travel time to a particular body
ps.get_spacecraft_light_travel_time(t, "earth")
The longitude and latitude of the point on earth directly below Pandora
lon, lat = ps.get_earth_subpoint(t)
lon, lat
(<Quantity [ 95.72038486, 95.57249462, 95.4230397 , ..., -68.24621495,
-68.49378697, -68.74639167] deg>,
<Quantity [-42.21583239, -42.67213994, -43.12776798, ..., -56.93742045,
-57.38897928, -57.83947763] deg>)
fig, ax = plt.subplots(dpi=150)
ax.scatter(lon.value, lat.value, s=1, c='grey')
ax.set(xlabel='Longitude [deg]', ylabel='Latitude [deg]')
[Text(0.5, 0, 'Longitude [deg]'), Text(0, 0.5, 'Latitude [deg]')]
The incidene angle of sunlight on the earth below pandora, which can be used to determine if it is "day" below pandora.
Day is where the incidence angle is less than 90 degrees
inc = ps.get_earth_illumination(t)
inc
fig, ax = plt.subplots(dpi=150)
im = ax.scatter(lon.value, lat.value, s=1, c=inc.value/90, cmap='inferno_r')
cbar = plt.colorbar(im, ax=ax)
cbar.set_ticks([inc.value.min()/90, 1, inc.value.max()/90])
cbar.set_ticklabels(["Day", "Transition", "Night"])
ax.set(xlabel='Longitude [deg]', ylabel='Latitude [deg]')
[Text(0.5, 0, 'Longitude [deg]'), Text(0, 0.5, 'Latitude [deg]')]
The period of Pandora is not fixed, because the orbit precesses and changes. You can use the get_period function to find the period as a function of time.
fig, ax = plt.subplots(dpi=150)
ax.plot(t.jd, ps.get_period(t), c='k')
ax.set(xlabel='Time [JD]', ylabel='Period [minutes]')
[Text(0.5, 0, 'Time [JD]'), Text(0, 0.5, 'Period [minutes]')]
You can also easily plot the altitude of the spacecraft in kilometers.
fig, ax = plt.subplots(dpi=150)
ax.plot(t.jd, ps.get_altitude(t), c='k')
ax.set(xlabel='Time [JD]', ylabel='Altitude [km]')
[Text(0.5, 0, 'Time [JD]'), Text(0, 0.5, 'Altitude [km]')]