Python中精确的信号延迟计算
我正在尝试使用互相关计算 Python 中两个信号之间的滞后。除了非常小的时滞之外,这两个信号几乎相同。我尝试过 numpy.correlate 和 scipy.convolve (速度更快),两者都工作得相对较好,但给出了一个小错误。我开始怀疑该错误是 Python/scipy/numpy 在某处截断浮点数的结果。有谁能够在Python中进行高精度信号延迟计算吗?
此致 弗雷德里克
I'm trying to calculate the lag between two signals in Python using cross correlation. The two signals are almost identical except for a very small timelag. I've tried numpy.correlate and scipy.convolve (alot faster) and both works relatively well but gives a small error. I'm starting to suspect that the error is the result of Python/scipy/numpy truncating a float somewhere. Has anyone been able to get high accuracy signal delay calculations working in Python?
Best regards
Fredrik
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据两个信号的功率谱,由于互相关在每个滞后处没有正确归一化,您确实会得到一个小误差。这是我使用的一个小功能;它使每个滞后的重叠区域正常化,我发现它给出了准确的结果:
Depending on the power spectrum of the two signals you do get a small error due to the fact that the cross correlation is not properly normalised at each lag. Here is a little function that I use; it normallises the overlap region at each lag and I found it gives accurate results: