-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_horizon.py
55 lines (43 loc) · 1.48 KB
/
test_horizon.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
#!/usr/bin/python3
import numpy as np
from scipy.linalg import norm
from spiceypy import spiceypy as spice
from lincov import SpiceLoader
from lincov.horizon import covariance
import matplotlib.pyplot as plt
if __name__ == '__main__':
body_id = 301
sc_id = -5440
loader = SpiceLoader('spacecraft')
start, end = loader.coverage(sc_id)
distances = []
rx = []
ry = []
rz = []
sun = []
r_pix = []
for tt in np.arange(start, end, 100.0):
R, d = covariance(tt, 301, fov = 18 * np.pi/180.0, fpa_size = 2048, spacecraft_id = sc_id, statistics = True)
distances.append(d['rho'])
rx.append(R[0,0])
ry.append(R[1,1])
rz.append(R[2,2])
sun.append(d['sun_angle'])
r_pix.append(d['r_pix'])
fig, axes = plt.subplots(4,1, squeeze=True, sharex=True)
axes[0].scatter(distances, np.sqrt(np.array(rx)), s=1)
axes[1].scatter(distances, np.sqrt(np.array(ry)), s=1)
axes[2].scatter(distances, np.sqrt(np.array(rz)), s=1)
#axes[3].scatter(distances, np.array(sun) * 180/np.pi, s=1)
axes[3].scatter(distances, r_pix, s=1)
for ii in range(0,3):
axes[ii].grid(True)
#axes[ii].set_yscale('log')
axes[0].set_ylabel('x sigma (km)')
axes[1].set_ylabel('y sigma (km)')
axes[2].set_ylabel('z sigma (km)')
#axes[3].set_ylabel('sun angle (deg)')
axes[3].set_ylabel('pixels taken up')
axes[3].grid(True)
axes[3].set_xlabel("distance from moon (km)")
plt.show()