Advertisement
bolverk

gamma ray satellite

Jan 5th, 2016
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.88 KB | None | 0 0
  1. def main():
  2.  
  3.     import matplotlib.pyplot as plt
  4.     plt.rcdefaults()
  5.  
  6.     import numpy as np
  7.     import matplotlib.pyplot as plt
  8.     import matplotlib.path as mpath
  9.     import matplotlib.lines as mlines
  10.     import matplotlib.patches as mpatches
  11.     from matplotlib.collections import PatchCollection
  12.  
  13.     satellites = {
  14.         'fermi':{'start':2008,
  15.                  'end':2020,
  16.                  'low':10e3,
  17.                  'high':300e9},
  18.         'swift':{'start':2004,
  19.                  'end':2020,
  20.                  'low':0.2e3,
  21.                  'high':150e3},
  22.         'cgro':{'start':1991,
  23.                 'end':2000,
  24.                 'low':20e3,
  25.                 'high':30e9},
  26.         'integral':{'start':2002,
  27.                     'end':2020,
  28.                     'low':15e3,
  29.                     'high':30e6},
  30.         'hete-2':{'start':2000,
  31.                   'end':2008,
  32.                   'low':0.5e3,
  33.                   'high':400e3},
  34.         'gamma':{'start':1991,
  35.                  'end':1992,
  36.                  'low':50e6,
  37.                  'high':6e9},
  38.         'ulysses':{'start':1990,
  39.                    'end':2009,
  40.                    'low':15e3,
  41.                    'high':150e3},
  42.         'sross':{'start':1987,
  43.                    'end':2001,
  44.                    'low':20e3,
  45.                    'high':3000e3},
  46.         'eureca':{'start':1992,
  47.                    'end':1993,
  48.                    'low':6e3,
  49.                    'high':150e3},
  50.         'mars observer':{'start':1992,
  51.                          'end':1993,
  52.                          'low':0.5e6,
  53.                          'high':2e6},
  54.         'wind':{'start':1994,
  55.                 'end':2020,
  56.                 'low':15e3,
  57.                 'high':10e6},
  58.         'rxte':{'start':1995,
  59.                 'end':2012,
  60.                 'low':2e3,
  61.                 'high':250e3},
  62.         'near':{'start':1996,
  63.                 'end':2001,
  64.                 'low':0.3e6,
  65.                 'high':10e6}
  66.         }
  67.  
  68.     patches = []
  69.  
  70.     fig, ax = plt.subplots()
  71.  
  72.     for sat_id in satellites:
  73.         sat = satellites[sat_id]
  74.         patches.append(mpatches.Rectangle([sat['low'],sat['start']],
  75.                                           sat['high']-sat['low'],
  76.                                           sat['end']-sat['start'],
  77.                                           ec='none'))
  78.         ax.text(#np.sqrt(sat['low']*sat['high']),
  79.             sat['low']**0.7*sat['high']**0.3,
  80.             sat['start']*0.7+sat['end']*0.3,
  81.             sat_id)
  82.  
  83.     colors = np.linspace(0, 1, len(patches))
  84.     collection = PatchCollection(patches, cmap=plt.cm.hsv, alpha=0.3)
  85.     collection.set_array(np.array(colors))
  86.     ax.add_collection(collection)
  87.     ax.set_xscale('log')
  88.     plt.axis('equal')
  89.     ax.set_xlabel('Energy [eV]')
  90.     ax.set_ylabel('Year')
  91.     #plt.axis('off')
  92.  
  93.     plt.show()
  94.  
  95. if __name__ == '__main__':
  96.  
  97.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement