Open mkelley opened 2 years ago
I noticed this recently too because I was trying to propagate an orbit to multiple Time objects and it would just hang mysteriously:
from astropy.time import Time
from sbpy.data import Orbit
orbit = Orbit.from_horizons('Ceres')
orbit["orbtype"] = "KEP"
print(orbit['orbtype'])
# propagate the orbit forward to 2026 with openorb
times = Time(['2024-06-06','2025-06-06','2026-06-06'])
future_orbit = orbit.oo_propagate(times)
print(future_orbit['orbtype'])
Silly hack is to do one timestep at a time and drop (or overwrite) the orbtype:
# propagate the orbit forward to 2026 with openorb
times = Time(['2024-06-06','2025-06-06','2026-06-06'])
for i in range(len(times)):
print(i)
future_orbit = orbit.oo_propagate(times[i]) # propagate the orbit one time step
del future_orbit.table["orbtype"] # orbtype is added as int, sbpy freaks out so delete the orbtype and then _to_oo works it out
statevec = future_orbit.oo_transform('CART') # transform from orbital elements to cartesian
print(statevec.table[["epoch","x","y","z"]])
Output
Instead of 2.0, it should have been COM.