傅立叶截止后跳转

时间:2018-10-25 17:17:19

标签: python filter kernel filtering fft

在实施傅立叶截止滤波器后,我很难解释这些跳跃。 我已经通过以下功能实现了它:

def sharp2dZTh(u, rPos, deltaThR, deltaZ, th, z):
    kTh=np.fft.fftfreq(len(th), d=th[1]-th[0]) 
    kZ=np.fft.fftfreq(len(z), d=z[1]-z[0])
    kThC=1/deltaThR 
    kZC=1/deltaZ   
    g=np.outer(np.heaviside(kThC-abs(2*kTh/rPos),1),np.heaviside(kZC-abs(2*kZ),1))
    uFiltered=np.fft.ifft2(np.fft.fft2(u)*g)
    return uFiltered.real

在将上述功能从[LxMxN]数组转换为[L]数组后取平均值时,橙色线会导致: high frequent jumps in "sharp"/orange lines

u是输入变量(数组),rPos是常数,deltaThR和deltaZ是滤波器宽度(常数),th和z是位置参数(两个数组)。 其他两个过滤器(Box和Gauss)仅以不同的内核(脚本中的g函数)以类似的方式实现,但是它们没有显示任何特定行为。甚至保留“ rPos”的除法。

奇怪的是,通过省略上面给定代码中的“ rPos”,所有跳转都消失了:

def sharp2dZTh(u, rPos, deltaThR, deltaZ, th, z): 
    kTh=np.fft.fftfreq(len(th), d=th[1]-th[0]) 
    kZ=np.fft.fftfreq(len(z), d=z[1]-z[0])
    kThC=1/deltaThR 
    kZC=1/deltaZ   
    g=np.outer(np.heaviside(kThC-abs(2*kTh),1),np.heaviside(kZC-abs(2*kZ),1))
    uFiltered=np.fft.ifft2(np.fft.fft2(u)*g)
    return uFiltered.real

也许你们中的一些人对此有一个机智的解释?

最好, 丹

0 个答案:

没有答案