def frft(x, alpha):
"""
Implementation of the Fractional Fourier Transform (FRFT)
:param x: array of data to be transformed
:param alpha: parameter of FRFT
:return: FRFT(x)
"""
k = np.arange(x.size)
y = np.hstack([
x * np.exp(-np.pi * 1j * k**2 * alpha),
np.zeros(x.size, dtype=np.complex)
])
z = np.hstack([
np.exp(np.pi * 1j * k**2 * alpha),
np.exp(np.pi * 1j * (k - x.size)**2 * alpha)
])
G = fftpack.ifft(
fftpack.fft(y, overwrite_x=True) * fftpack.fft(z, overwrite_x=True),
overwrite_x=True
)
return np.exp(-np.pi * 1j * k**2 * alpha) * G[:x.size]
# generate the desired momentum grid
fourier_transform.py 文件源码
python
阅读 15
收藏 0
点赞 0
评论 0
评论列表
文章目录