nasa / dorado-scheduling

Dorado observation planning and scheduling simulations
Other
22 stars 8 forks source link

Use SpiceyPy to evaluate TESS orbit #83

Closed lpsinger closed 2 years ago

lpsinger commented 2 years ago

UVEX is considering a TESS-like orbit. The TESS orbit cannot be accurately described by a TLE due to lunar perturbations.

lpsinger commented 2 years ago

@bwgref, can you review this please?

codecov[bot] commented 2 years ago

Codecov Report

Merging #83 (80b64c4) into main (4077571) will increase coverage by 0.84%. The diff coverage is 83.72%.

:exclamation: Current head 80b64c4 differs from pull request most recent head 93e7852. Consider uploading reports for the commit 93e7852 to get more accurate results Impacted file tree graph

@@            Coverage Diff             @@
##             main      #83      +/-   ##
==========================================
+ Coverage   28.78%   29.62%   +0.84%     
==========================================
  Files          35       38       +3     
  Lines        1779     1809      +30     
==========================================
+ Hits          512      536      +24     
- Misses       1267     1273       +6     
Impacted Files Coverage Δ
dorado/scheduling/units/__init__.py 100.00% <ø> (ø)
dorado/scheduling/orbit/base.py 70.00% <70.00%> (ø)
dorado/scheduling/orbit/spice.py 80.95% <80.95%> (ø)
dorado/scheduling/__init__.py 100.00% <100.00%> (ø)
dorado/scheduling/mission.py 93.75% <100.00%> (ø)
dorado/scheduling/orbit/__init__.py 100.00% <100.00%> (ø)
dorado/scheduling/orbit/tle.py 93.10% <100.00%> (ø)
dorado/scheduling/tests/test_orbit.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4077571...93e7852. Read the comment docs.

bwgref commented 2 years ago

Sanity test seems to work.

from importlib import resources from astropy.time import Time from astropy import units as u from dorado.scheduling.orbit import Spice from astropy.utils.data import get_pkg_data_filename import numpy as np from astropy.constants import R_earth from matplotlib import pyplot as plt orbit = Spice( 'MGS SIMULATION', 'https://archive.stsci.edu/missions/tess/models/TESS_EPH_PRE_LONG_2021252_21.bsp', 'https://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/earth_000101_220110_211018.bpc', 'https://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/pck00010.tpc')

t = Time('2021-10-31 00:00') + np.arange(128) 0.25u.day orb = orbit(t) r_alt = [np.sqrt(o.x2 + o.y2 + o.z**2) for o in orb.itrs ] rE = [r / R_earth.to(u.km) for r in r_alt] ax = plt.figure().subplots() ax.plot(t.mjd, rE) ax.set_xlabel('MJD') ax.set_ylabel('Altitude in Re') plt.show()

Produces the following, image, which has the right periodicity and the apogee/perigee that we expect for TESS-like orbits

image