• API
• FAQ
• Tools
• Archive
daily pastebin goal
13%
SHARE
TWEET

# Tiangong-2 orbit

a guest Jun 27th, 2018 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. class Satellite(object):
2.     def __init__(self, daynum):
3.         self.daynum = daynum
4.
5. import numpy as np
6. import matplotlib.pyplot as plt
7. from mpl_toolkits.mplot3d import Axes3D
8. from skyfield.api import Loader, EarthSatellite
9.
10. Re = 6378.137
11.
14.
16. earth   = data['earth']
18.
19. print earth.at(ts.now()).position.km   # for no reason at all
20.
21. with open('Tiangong-2 2018 TLEs.txt', 'r') as infile:
23.
24. L1s, L2s = [lines[i::2] for i in range(2)]
25.
26. sats = []
27. for L1, L2 in zip(L1s, L2s):
28.     if L1[0]=='1' and L2[0]=='2':
29.         daynum = float(L1[20:32])
30.         sat = Satellite(daynum)
31.         sats.append(sat)
32.         sat.L1, sat.L2 = L1, L2
33.         sat.satobj = EarthSatellite(L1, L2) # add the Skyfield object
34.
35. daynums     = np.array([sat.daynum for sat in sats])
36.
37. minuterange = np.arange(0, 120, 0.5)
38. dayrange    = minuterange / (60. * 24.)
39.
40. for sat in sats:
41.     sat.days  = sat.daynum + dayrange
42.     sat.tsutc = ts.utc(2018, 1, dayrange)
43.     sat.pos   = sat.satobj.at(sat.tsutc).position.km
44.     sat.r     = np.sqrt((sat.pos**2).sum(axis=0))
45.     sat.rmax  = sat.r.max()
46.     sat.rmin  = sat.r.min()
47.
48. rmaxes = np.array([sat.rmax for sat in sats])
49. rmins  = np.array([sat.rmin for sat in sats])
50.
51. if True:
52.     plt.figure()
53.     fs = 16
54.     plt.plot(daynums, rmaxes - Re)
55.     plt.plot(daynums, rmins  - Re)
56.     plt.plot(daynums, rmaxes - Re, '.k')
57.     plt.plot(daynums, rmins  - Re, '.k')
58.     plt.title('Tiangong-2 peri and apo (km) June 2018 so far', fontsize=fs)
59.     plt.xlabel('daynumber in 2018', fontsize=fs)
60.     plt.xlim(151, 180)
61.     plt.show()
62.
63. if True:
64.     plt.figure()
65.     fs = 16
66.     plt.plot(daynums, rmaxes - Re)
67.     plt.plot(daynums, rmins  - Re)
68.     plt.plot(daynums, rmaxes - Re, '.k')
69.     plt.plot(daynums, rmins  - Re, '.k')
70.     plt.title('Tiangong-2 peri and apo (km) 2018 so far', fontsize=fs)
71.     plt.xlabel('daynumber in  2018', fontsize=fs)
72.     plt.show()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top