Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.11 KB | None | 0 0
  1.     import numpy as np
  2.     import matplotlib.pyplot as plt
  3.  
  4.     ym         = np.linspace(-1.2, 1.2, 201)
  5.     fhubble    = 2.4*2.35
  6.     fspy       = 2.4*1.2
  7.     xmax       = 3.9
  8.  
  9.     fhubble_tot = 2.4*24
  10.     fspy_tot    = 2.4*8
  11.  
  12.     xhubble    = -np.sqrt(fhubble**2 - ym**2) + fhubble
  13.     xspy       = -np.sqrt(fspy**2    - ym**2) + fspy
  14.     xmax_h     = xhubble.max()
  15.     xmax_s     = xspy.max()
  16.  
  17.     pts1_hubble    = [[xmax, xmax_h, 1.00*fhubble], [ 1.2,  1.2,  0.00*1.2]]
  18.     pts2_hubble    = [pts1_hubble[0],               [-y for y in pts1_hubble[1]]]
  19.  
  20.     pts3_hubble    = [[xmax, xmax_h, 0.67*fhubble], [ 1.2,  1.2,  0.33*1.2]]
  21.     pts4_hubble    = [pts3_hubble[0],               [-y for y in pts3_hubble[1]]]
  22.  
  23.     pts1_spy       = [[xmax, xmax_s, 1.00*fspy],    [ 1.2,  1.2,  0.00*1.2]]
  24.     pts2_spy       = [[xmax, xmax_s, 1.00*fspy],    [-1.2, -1.2, -0.00*1.2]]
  25.  
  26.     pts3_spy       = [[xmax, xmax_s, 0.86*fspy],    [ 1.2,  1.2,  0.14*1.2]]
  27.     pts4_spy       = [[xmax, xmax_s, 0.86*fspy],    [-1.2, -1.2, -0.14*1.2]]
  28.  
  29.     #
  30.  
  31.     pts5_hubble    = [pts3_hubble[0] + [pts3_hubble[0][-1]-0.33*fhubble_tot],
  32.                       pts3_hubble[1] + [0]]
  33.     pts6_hubble    = [pts5_hubble[0],               [-y for y in pts5_hubble[1]]]
  34.  
  35.     pts5_spy       = [pts3_spy[0]    + [pts3_spy[0][-1]-0.14*fspy_tot],
  36.                       pts3_spy[1]    + [0]]
  37.     pts6_spy       = [pts5_spy[0],                  [-y for y in pts5_spy[1]]   ]
  38.  
  39.  
  40.     pts_hubble = [pts1_hubble, pts2_hubble, pts3_hubble, pts4_hubble,
  41.                   pts5_hubble, pts6_hubble]
  42.     pts_spy    = [pts1_spy,    pts2_spy,    pts3_spy,    pts4_spy,
  43.                   pts5_spy,    pts6_spy   ]
  44.  
  45.     if True:
  46.         plt.figure()
  47.         plt.plot(xhubble, ym, '-b', linewidth=2)
  48.         plt.plot(xspy,    ym, '-r', linewidth=2)
  49.  
  50.         if True:
  51.             for x, y in pts_hubble[:2] + pts_spy[:2]:
  52.                 plt.plot(x[1:], y[1:], '-k', linewidth=1.0)
  53.             plt.plot(np.zeros_like(ym),    ym, '-k', linewidth=2)
  54.  
  55.         if False:
  56.             for x, y in pts_hubble[2:] + pts_spy[2:]:
  57.                 plt.plot(x, y, '-k', linewidth=1.0)
  58.            
  59.         plt.xlim(-0.5, 6.0)
  60.         plt.show()
  61.  
  62.     if True:
  63.         plt.figure()
  64.         plt.plot(xhubble, ym, '-b', linewidth=2)
  65.         plt.plot(xspy,    ym, '-r', linewidth=2)
  66.  
  67.         if False:
  68.             for x, y in pts_hubble[:2] + pts_spy[:2]:
  69.                 plt.plot(x, y, '-k', linewidth=0.5)
  70.  
  71.         if True:
  72.             for x, y in pts_hubble[2:] + pts_spy[2:]:
  73.                 plt.plot(x, y, '-k', linewidth=1.0)
  74.            
  75.         plt.xlim(-0.5, 4.0)
  76.         plt.show()
  77.  
  78.     if True:
  79.         plt.figure()
  80.         plt.plot(xhubble, ym, '-b', linewidth=2)
  81.         plt.plot(xspy,    ym, '-r', linewidth=2)
  82.  
  83.         if False:
  84.             for x, y in pts_hubble[:2] + pts_spy[:2]:
  85.                 plt.plot(x, y, '-k', linewidth=0.5)
  86.  
  87.         if True:
  88.             for x, y in pts_hubble[2:] + pts_spy[2:]:
  89.                 plt.plot(x, y, '-k', linewidth=1.0)
  90.            
  91.         plt.xlim(-16., 5.0)
  92.         plt.ylim(-5.0, 5.0)
  93.         plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement