Advertisement
Guest User

Untitled

a guest
Feb 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. def c1(t):
  2. return np.cos(pi*t*t/2)
  3.  
  4. def s1(t):
  5. return np.sin(pi*t*t/2)
  6.  
  7. def e1(t):
  8. return np.exp(t*t*pi*1j*0.5)
  9.  
  10. def fren_cos_int(t):
  11. z = quadpy.line_segment.integrate(c1,[0.0, t],quadpy.line_segment.GaussPatterson(6))
  12. if len(np.shape(z))!=0:
  13. z = z[0,:]
  14. #z,e = integrate.quad(c1,0,t)
  15. return z
  16.  
  17. def fren_sin_int(t):
  18. z = quadpy.line_segment.integrate(s1,[0.0, t],quadpy.line_segment.GaussPatterson(6))
  19. if len(np.shape(z))!=0:
  20. z = z[0,:]
  21. #z,e = integrate.quad(s1,0,t)
  22. return z
  23.  
  24. #page 20 goodman 4th ed.
  25. def ft_chirp(fx,wavel,z,L):
  26. b = 1/(wavel*z)
  27. b1 = np.sqrt(2*b)
  28. a1 = b1 * (L/2 - (fx/b))
  29. a2 = b1 * (-L/2 - (fx/b))
  30. if len(np.shape(a1))!= 0 :
  31. A1 = []
  32. for i in a1: A1.append([i])
  33. A1 = np.stack(A1)
  34. else :
  35. A1 = a1
  36. if len(np.shape(a2))!=0:
  37. A2 = []
  38. for i in a2: A2.append([i])
  39. A2 = np.stack(A2)
  40. else :
  41. A2 = a2
  42. z = (fren_cos_int(A1) - fren_cos_int(A2)) + 1j*(fren_sin_int(A1) - fren_sin_int(A2))
  43. #print(np.shape(A1),np.shape(A2),np.shape(z))
  44. p = np.exp(-1j*pi*fx*fx/b)*(1/np.sqrt(2*b))
  45. return z*p
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement