【问题标题】:Peak Detection in Python: How does the scipy.signal.find_peaks_cwt function work?Python 中的峰值检测:scipy.signal.find_peaks_cwt 函数如何工作?
【发布时间】:2015-09-10 01:09:30
【问题描述】:

我正在寻找一些光谱仪数据中的一些峰值,并试图使用scipy.signal.find_peaks_cwt() 函数来做到这一点。

但是,我发现的 official documentation 描述性不强,往往会在噪声中拾取虚假峰值,而有时不会在数据中拾取实际峰值。

谁能给我一个更好的解释这个函数中我可以使用的参数,包括“宽度”,或者你能告诉我一些替代方案吗?

【问题讨论】:

  • 您是否尝试查看该函数的源代码?
  • 或者甚至在您链接的描述底部的注释中?
  • 我已经阅读了注释,该帖子对于理解宽度参数非常有帮助,感谢您发布它。不过,我仍然不清楚其他可选参数,有什么想法吗?我查看了源代码,由于我对 python 还很陌生,因此很难真正从中获得一些东西。不过我会继续研究它

标签: python numpy scipy signal-processing feature-detection


【解决方案1】:

如果你的信号比较干净,我建议先使用更简单的alternatives,比如PeakUtils indexes function。代码比scipy.signal.find_peaks_cwt 更直接:

import numpy as np
from peakutils.peak import indexes
vector = [ 0, 6, 25, 20, 15, 8, 15, 6, 0, 6, 0, -5, -15, -3, 4, 10, 8, 13, 8, 10, 3, 1, 20, 7, 3, 0 ]
print('Detect peaks with minimum height and distance filters.')
indexes = indexes(np.array(vector), thres=7.0/max(vector), min_dist=2)
print('Peaks are: %s' % (indexes))

Scipy find_peaks_cwt 在存在噪声数据的情况下确实很有用,因为它使用 continuous wavelet transform

【讨论】:

    猜你喜欢
    • 2020-06-10
    • 2023-04-05
    • 2012-11-11
    • 1970-01-01
    • 2015-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多