I\'ve got a 1-D signal in which I\'m trying to find the peaks. I\'m looking to find them perfectly.
I\'m currently doing:
import scipy.signal as sign
Solved, solution:
Filter data first:
window = signal.general_gaussian(51, p=0.5, sig=20)
filtered = signal.fftconvolve(window, data)
filtered = (np.average(data) / np.average(filtered)) * filtered
filtered = np.roll(filtered, -25)
Then use angrelextrema as per rapelpy's answer.
Result:
There is a much easier solution using this function: https://gist.github.com/endolith/250860 which is an adaptation of http://billauer.co.il/peakdet.html
I've just tried with the data you provided and I got the result below. No need for pre-filtering...
Enjoy :-)
Edited after getting the raw data.
argelmax and arglextrma are out of the race.
The curve is very noisy, so you have to play with small peak width (as pv. mentioned) and the noise.
The best I found looks not very good.
import numpy as np
import scipy.signal as signal
peakidx = signal.find_peaks_cwt(y_array, np.arange(10,15), noise_perc=0.1)
print peakidx
[10, 100, 132, 187, 287, 351, 523, 597, 800, 1157, 1451, 1673, 1742, 1836]