Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_ift2():
data = numpy.zeros((10, 10))
ift_data = fouriertransform.ift2(data, 1.)
assert ift_data.shape == data.shape
mag = float(outputSpacing)/inputSpacing
#Observation Plane Co-ords
x2,y2 = numpy.meshgrid( outputSpacing*numpy.arange(-N/2,N/2),
outputSpacing*numpy.arange(-N/2,N/2) )
r2sq = x2**2 + y2**2
#Quadratic phase factors
Q1 = numpy.exp( 1j * k/2. * (1-mag)/z * r1sq)
Q2 = numpy.exp(-1j * numpy.pi**2 * 2 * z/mag/k*fsq)
Q3 = numpy.exp(1j * k/2. * (mag-1)/(mag*z) * r2sq)
#Compute propagated field
outputComplexAmp = Q3 * fouriertransform.ift2(
Q2 * fouriertransform.ft2(Q1 * inputComplexAmp/mag,inputSpacing), df1)
return outputComplexAmp
mag = float(outputSpacing)/inputSpacing
#Observation Plane Co-ords
x2,y2 = numpy.meshgrid( outputSpacing*numpy.arange(-N/2,N/2),
outputSpacing*numpy.arange(-N/2,N/2) )
r2sq = x2**2 + y2**2
#Quadratic phase factors
Q1 = numpy.exp( 1j * k/2. * (1-mag)/z * r1sq)
Q2 = numpy.exp(-1j * numpy.pi**2 * 2 * z/mag/k*fsq)
Q3 = numpy.exp(1j * k/2. * (mag-1)/(mag*z) * r2sq)
#Compute propagated field
outputComplexAmp = Q3 * fouriertransform.ift2(
Q2 * fouriertransform.ft2(Q1 * inputComplexAmp/mag,inputSpacing), df1)
return outputComplexAmp