我正在尝试对各种晶格模式进行傅立叶变换,但是我在第一个测试中得到的结果没有意义。
作为第一个示例,我想对具有三角形对称性的形状进行傅立叶变换。
产生的傅立叶变换也应该具有3倍的旋转对称性,但是我看到一些具有正方形对称性的东西,所以我知道这是不正确的。
import numpy as np
import matplotlib.pyplot as plt
def PlaneWave(x,y,amp,wavelength,angle):
"""
plane wave propagating in the x-y plane
Amplitude = amp
wavelength = wavelength
propagation angle (relative to +x) = angle
on the grid x,y
"""
return amp*np.exp(1j *2*np.pi/wavelength * (x *np.cos(angle) + y*np.sin(angle) ) )
def TLattice(x,y,amp,wavelength):
"""
compute the intensity profile of a 3-beam triangular lattice with in-plane polarization
"""
angle=np.pi/6
B1 = PlaneWave(x,y,amp,wavelength,angle )
angle=angle+np.pi*2/3
B2 = PlaneWave(x,y,amp,wavelength,angle )
angle=angle+np.pi*2/3
B3 = PlaneWave(x,y,amp,wavelength,angle )
return np.abs(B1+B2+B3)**2
size=5
dx=0.05
[xx,yy] = np.meshgrid(np.arange(-size,size,dx),np.arange(-size,size,dx))
pot = TLattice(xx,yy,4,1)
pot_fft =np.fft.fftshift(np.fft.fft2(pot))
f, (ax1,ax2) =plt.subplots(2)
f.suptitle('Comparing a triangular lattice and its FFT')
ax1.imshow(np.abs(pot))
ax1.set_title('triangular lattice')
ax2.imshow(np.log(np.abs(pot_fft)**2))
ax2.set_title('FFT should also show 3-fold rotational symmetry')
f.show()