【发布时间】:2021-11-23 23:27:29
【问题描述】:
下面我绘制了信号(寿命衰减),我试图从脉冲响应函数(即除法器 (IRF))中反卷积。所以我应该让衰减更尖锐一点。 这是我查看的主题的示例,它提供了我需要的内容:
Understanding scipy deconvolve
请不要为我的代码,我只使用分频器的峰值 (IRF),而不是图像上显示的整个数组序列。
我正在使用以下代码来做到这一点:
IRF = IRF * (max(decay)/max(IRF))
# replace 0s to avoid error message
IRF = np.where(IRF == 0, 0.1, IRF)
decay = np.where(decay == 0, 0.1, decay)
# take only the quotient part of the result
deconv = scipy.signal.deconvolve(decay, IRF)[0]
# "padding" the deconvolved signal so it has the same size as the original signal
s = int((len(decay)-(len(deconv)))/2) ## difference on each side
deconv_res = np.zeros(len(decay))
end = int(len(decay)-s-1) # final index
deconv_res[s:end] = deconv
deconv = deconv_res
# convolved normalized to decay height for plotting
deconv_n = deconv * (max(decay)/max(deconv))
IRF是一个float64数组,信号是一个uint16数组。
我承认我对反卷积的数学不太熟悉,所以我盲目地尝试不同的东西,比如尝试不同的除法器函数,但没有任何结果接近预期。 我得到的最后一个结果是这样的(参见原始信号的图以及它试图去卷积的信号..)
如果我不明白 scipy.deconvolve 中的某些内容,谁能给我一些想法,这种奇怪行为的原因可能是什么,或者甚至是一些可以帮助我的高级阅读材料? 或者,如果您认为这个问题更多的是物理问题而不是编码问题,那么提出这样一个问题的更好地方?
【问题讨论】:
标签: python scipy signal-processing deconvolution