I am trying to perform a twodimensional FFT in python. However, I am having trouble both with the values alternating between negative and positive sign as well as with the shape of the numerical gaussian in comparison to the analytically expected gaussian. I have also tried using fft.shift on both axes of the fft2 result matrix but this cut the gaussian in half and moved it to the sides of the coordinate system. I would really appreciate some help, thank you in advance!
import numpy as np
import scipy
import scipy.fft as fft
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
#generate data array
N=200
lim=50
px=np.linspace(-lim,lim,N)
py=px
pxpx, pypy = np.meshgrid(px,py)
pxpx_2, pypy_2 = np.meshgrid(px**2,py**2)
fnc=1/2*np.exp(-(pypy**2+pxpx**2)*np.pi/2)
ft=np.fft.fftshift(np.fft.fft2(fnc))
x = np.fft.fftshift((np.fft.fftfreq(ft.shape[0],d=2*lim/(N-1)))) # this takes an argument for the timestep
y =np.fft.fftshift(np.fft.fftfreq(ft.shape[1],d=2*lim/(N-1)))
xx, yy=np.meshgrid(x,y)
test=np.exp(-(yy**2+xx**2)*2*np.pi) #normalised, symmetrical FT (scaling by sqrt 2pi) to compare fft result with
fig = plt.figure()
ax2 = fig.add_subplot(projection='3d')
ax2.plot_wireframe(xx, yy, ft, rstride=25, cstride=25)
ax2.plot_wireframe(xx, yy, (test), rstride=11, cstride=11,color='red')
plt.show()