I'm running into an odd problem using Numpy meshgrids with the FFT functions. Specifically, either the fft2 or the ifft2 function seems to fail when used on an array built using meshgrids.
x = np.arange(-4, 4, .08)
y = np.arange(-4, 4, .08)
X, Y = np.meshgrid(x, y)
field = (X + i*Y)*np.exp(X**2 + Y**2)
As a check before I proceeded with my project, I did
fieldCheck1 = np.fft.fft2(field)
fieldCheck2 = np.fft.ifft2(fieldCheck1)
which should yield back my original array, but in fact eliminates the real part ( a plot of abs(fieldCheck2)**2 is flat zero, where originally it was a gaussian) and completely scrambles the phase information (a phase plot of fieldCheck2 looks like static instead of a phase ramp)
I've checked the documentation, but I don't see anything in there that would explain this. Any insight into the source of the problem would be helpful.



ithe imaginary unit in your environment somehow? It is1.0jin mine.^) will fail when used between a float and an int. Are you trying to exponentiate (**)?