卷积与使用Scipy解卷积 [英] Convolution & Deconvolution using Scipy
问题描述
我正在尝试使用Python计算反卷积。我有一个信号让我们说f(t),它是由窗函数说g(t)所绕开的。是否有一些直接方法可以计算去卷积,以便我可以获取原始信号?
I am trying to compute Deconvolution using Python. I have a signal let say f(t) which is the convoluted by the window function say g(t). Is there some direct way to compute the deconvolution so I can get back the original signal?
例如f(t)= exp(-t ** 2/3);高斯函数
和g(t)=梯形函数
For instance f(t) = exp(-t**2/3); Gaussian function and g(t) = Trapezoidal function
预先感谢您的建议。
推荐答案
这是解析问题还是数字问题?
Is this an analytical or numerical problem?
如果是数字,请使用scipy.signal.devconvolve: http://docs.scipy.org/doc/scipy/reference/ generate / scipy.signal.deconvolve.html
If it's numerical, use scipy.signal.devconvolve: http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.deconvolve.html
从文档中:
>>> from scipy import signal
>>> sig = np.array([0, 0, 0, 0, 0, 1, 1, 1, 1,])
>>> filter = np.array([1,1,0])
>>> res = signal.convolve(sig, filter)
>>> signal.deconvolve(res, filter)
(array([ 0., 0., 0., 0., 0., 1., 1., 1., 1.]),
array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]))
否则,如果您想使用解析解决方案,则可能使用了错误的工具。
Otherwise, if you want an analytic solution, you might be using the wrong tool.
只是将来使用Google的提示,当您谈论卷积时,操作通常/通常是卷积而不是卷积,请参阅https://english.stackexchange.com/questions/64046/convolve-vs-convolute
Additionally, just a tip for future google-ing, when you're talking about convolution, the action is usually/often "convolved" not "convoluted", see https://english.stackexchange.com/questions/64046/convolve-vs-convolute
这篇关于卷积与使用Scipy解卷积的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!