Attempt to find the peaks in a 1-D array.
The general approach is to smooth vector by convolving it with wavelet(width) for each width in widths. Relative maxima which appear at enough length scales, and with sufficiently high SNR, are accepted.
New in version 0.11.0.
vector : ndarray
widths : sequence
wavelet : callable, optional
max_distances : ndarray, optional
gap_thresh : float, optional
min_length : int, optional
min_snr : float, optional
noise_perc : float, optional
This approach was designed for finding sharp peaks among noisy data, however with proper parameter selection it should function well for different peak shapes.
|[R100]||Bioinformatics (2006) 22 (17): 2059-2065. doi: 10.1093/bioinformatics/btl355 http://bioinformatics.oxfordjournals.org/content/22/17/2059.long|
>>> from scipy import signal >>> xs = np.arange(0, np.pi, 0.05) >>> data = np.sin(xs) >>> peakind = signal.find_peaks_cwt(data, np.arange(1,10)) >>> peakind, xs[peakind], data[peakind] (, array([ 1.6]), array([ 0.9995736]))