Advertisement
Guest User

Untitled

a guest
Jul 12th, 2018
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.89 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4. GMe      = 3.986004418E+14
  5. oneday   = 23*3600 + 56*60. + 4.09
  6. twopi    = 2. * np.pi
  7. onethird = 1./3.
  8.  
  9. fname191 = 'All TLEs 2018 day 191.txt'
  10. fname192 = 'All TLEs 2018 day 192.txt'
  11.  
  12. with open (fname191, 'r') as infile:
  13.     lines191 = infile.readlines()
  14.    
  15. with open (fname192, 'r') as infile:
  16.     lines192 = infile.readlines()
  17.  
  18. L1s, L2s = lines191[0::2], lines191[1::2]
  19. pairs191 = zip(L1s, L2s)
  20.  
  21. L1s, L2s = lines192[0::2], lines192[1::2]
  22. pairs192 = zip(L1s, L2s)
  23.  
  24. data191  = []
  25. for L1, L2 in pairs191:
  26.     year = float(L1[18:20])
  27.     day  = float(L1[20:32])
  28.     nperday = float(L2[52:63])
  29.     T       = oneday/nperday
  30.     a       = (T**2 * GMe / twopi**2)**onethird
  31.     data191.append((year, day, nperday, T, a))
  32.  
  33. data192 = []
  34. for L1, L2 in pairs192:
  35.     year = float(L1[18:20])
  36.     day  = float(L1[20:32])
  37.     nperday = float(L2[52:63])
  38.     T       = oneday/nperday
  39.     a       = (T**2 * GMe / twopi**2)**onethird
  40.     data192.append((year, day, nperday, T, a))
  41.  
  42. data191 = np.array(zip(*data191))
  43. data192 = np.array(zip(*data192))
  44.  
  45. a, b = np.histogram(data191[1], bins=np.arange(0, 201, 0.2))
  46. c, d = np.histogram(data192[1], bins=np.arange(0, 201, 0.2))
  47.  
  48. if True:
  49.     plt.figure()
  50.     # plt.subplot(2, 1, 1)
  51.     plt.plot(d[1:], c, '-r')
  52.     plt.plot(b[1:], a, '-b')
  53.     plt.yscale('log')
  54.     plt.ylim(0.1, None)
  55.     plt.xlim(175, 198)
  56.     plt.title('epochs (0.2 day bins)')
  57.     plt.suptitle('TLEs issued on days 191 and 192 of 2018', fontsize=18)
  58.     plt.show()
  59.  
  60. if True:
  61.     # plt.subplot(2, 1, 2)
  62.     plt.plot(data192[1], data192[4]*0.001, '.r', markersize=2)
  63.     plt.plot(data191[1], data191[4]*0.001, '.b', markersize=3)
  64.     plt.xlim(175, 198)
  65.     plt.ylim(None, 120000)
  66.     plt.title('semimajor axis (km) versus epoch')
  67.     plt.suptitle('TLEs issued on days 191 and 192 of 2018', fontsize=18)
  68.     plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement