Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/345.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用scipy在python中进行峰值检测_Python_Numpy_Scipy - Fatal编程技术网

使用scipy在python中进行峰值检测

使用scipy在python中进行峰值检测,python,numpy,scipy,Python,Numpy,Scipy,我有一个numpy数组,叫做det1,它是一个有很多峰值的信号。我想检测峰值(本地最大值)并保存值 我正在尝试: from scipy.signal import find_peaks_cwt from scipy import signal peakind = signal.find_peaks_cwt(det1, np.arange(1000,2000)) 我得到了这个错误: Traceback (most recent call last): File "mobility.py",

我有一个numpy数组,叫做det1,它是一个有很多峰值的信号。我想检测峰值(本地最大值)并保存值

我正在尝试:

from scipy.signal import find_peaks_cwt
from scipy import signal
peakind = signal.find_peaks_cwt(det1, np.arange(1000,2000))
我得到了这个错误:

Traceback (most recent call last):
  File "mobility.py", line 49, in <module>
    peakind = signal.find_peaks_cwt(det1, np.arange(1000,2000))
  File "/usr/lib/python2.7/dist-packages/scipy/signal/_peak_finding.py", line 514, in find_peaks_cwt
    cwt_dat = cwt(vector, wavelet, widths)
  File "/usr/lib/python2.7/dist-packages/scipy/signal/wavelets.py", line 357, in cwt
    output = np.zeros([len(widths), len(data)])
MemoryError
回溯(最近一次呼叫最后一次):
文件“mobility.py”,第49行,在
peakind=信号。查找峰值(第1部分,np.arange(10002000))
文件“/usr/lib/python2.7/dist packages/scipy/signal/_peak_finding.py”,第514行,在find_peaks_cwt中
cwt_dat=cwt(向量、小波、宽度)
cwt中的文件“/usr/lib/python2.7/dist packages/scipy/signal/wavelets.py”,第357行
输出=np.零([len(宽度),len(数据)])
记忆者

我做错了什么?您能推荐一种更好的方法来检测峰值吗?

您的计算机内存可能已超过可用内存(您使用的是64位还是32位Python?)。
det1
的形状是什么?非常感谢您的回答。我使用的是64位Python。det1.shape提供(20510000,)200亿任何东西都可能给你一个
内存错误
。减少你正在使用的
宽度
的数量。那么
输出
是用
len(widhts)=1000
(np.arange)和
len(data)=20510000构建的。因此,超过200亿个细胞似乎你的计算机无法处理。你可能超过了你的计算机可用内存(你是使用64位还是32位Python?)。
det1
的形状是什么?非常感谢您的回答。我使用的是64位Python。det1.shape提供(20510000,)200亿任何东西都可能给你一个
内存错误
。减少你正在使用的
宽度
的数量。那么
输出
是用
len(widhts)=1000
(np.arange)和
len(data)=20510000构建的。所以超过200亿个细胞似乎你的电脑无法处理。