Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def c1(t):
- return np.cos(pi*t*t/2)
- def s1(t):
- return np.sin(pi*t*t/2)
- def e1(t):
- return np.exp(t*t*pi*1j*0.5)
- def fren_cos_int(t):
- z = quadpy.line_segment.integrate(c1,[0.0, t],quadpy.line_segment.GaussPatterson(6))
- if len(np.shape(z))!=0:
- z = z[0,:]
- #z,e = integrate.quad(c1,0,t)
- return z
- def fren_sin_int(t):
- z = quadpy.line_segment.integrate(s1,[0.0, t],quadpy.line_segment.GaussPatterson(6))
- if len(np.shape(z))!=0:
- z = z[0,:]
- #z,e = integrate.quad(s1,0,t)
- return z
- #page 20 goodman 4th ed.
- def ft_chirp(fx,wavel,z,L):
- b = 1/(wavel*z)
- b1 = np.sqrt(2*b)
- a1 = b1 * (L/2 - (fx/b))
- a2 = b1 * (-L/2 - (fx/b))
- if len(np.shape(a1))!= 0 :
- A1 = []
- for i in a1: A1.append([i])
- A1 = np.stack(A1)
- else :
- A1 = a1
- if len(np.shape(a2))!=0:
- A2 = []
- for i in a2: A2.append([i])
- A2 = np.stack(A2)
- else :
- A2 = a2
- z = (fren_cos_int(A1) - fren_cos_int(A2)) + 1j*(fren_sin_int(A1) - fren_sin_int(A2))
- #print(np.shape(A1),np.shape(A2),np.shape(z))
- p = np.exp(-1j*pi*fx*fx/b)*(1/np.sqrt(2*b))
- return z*p
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement