-
Notifications
You must be signed in to change notification settings - Fork 0
/
nh_test_kem_ats.py
64 lines (42 loc) · 1.4 KB
/
nh_test_kem_ats.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
NH_TEST_KEM_ATS -- test some trajectory files
This is just a simple one-off program to do some tests on YPG's KEM flyby trajectories.
Concl of this problem: She used one NAIF ID for MU69, and the earlier trajectory I had was using a different one.
Created on Tue Jun 27 22:14:44 2017
@author: throop
"""
import math # We use this to get pi. Documentation says math is 'always available'
# but apparently it still must be imported.
import os.path
from astropy.utils import data
from astropy.wcs import WCS
import astropy
import matplotlib
import matplotlib.pyplot as plt # pyplot
from matplotlib.figure import Figure
import numpy as np
import spiceypy as sp
# HBT imports
import hbt
sp.furnsh('kernels_kem_ats.tm')
utc_start = "2019 1 Jan 06:40:00"
utc_end = "2019 1 Jan 07:20:00"
et_start = sp.utc2et(utc_start)
et_end = sp.utc2et(utc_end)
et_mid = (et_start + et_end)/2
num_dt = 500
et = hbt.frange(et_start, et_end, num_dt)
name_target = 'MU69'
name_observer = 'New Horizons'
dist = np.zeros(num_dt)
phase = np.zeros(num_dt)
for i,et_i in enumerate(et):
(state,_) = sp.spkezr(name_target, et_i, 'J2000', 'LT+S', name_observer)
dist[i] = np.sqrt(np.sum(state[0:3]**2))
plt.plot(et - et_mid, dist)
plt.xlabel('Dist [km]')
plt.ylabel('Seconds from c/a')
plt.show()
print("dist[0] = {}".format(dist))