Attempt to find the peaks in the given 1-D array vector.
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.
vector: 1-D ndarray :
widths: 1-D sequence :
wavelet: function :
max_distances: 1-D 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. The algorithm is as follows: 1. Perform a continuous wavelet transform on vector, for the supplied widths. This is a convolution of vector with wavelet(width) for each width in widths. See cwt 2. Identify “ridge lines” in the cwt matrix. These are relative maxima at each row, connected across adjacent rows. See identify_ridge_lines 3. Filter the ridge_lines using filter_ridge_lines.
Bioinformatics (2006) 22 (17): 2059-2065. doi: 10.1093/bioinformatics/btl355 http://bioinformatics.oxfordjournals.org/content/22/17/2059.long
>>> xs = np.arange(0, np.pi, 0.05) >>> data = np.sin(xs) >>> peakind = find_peaks_cwt(data, np.arange(1,10)) >>> peakind, xs[peakind],data[peakind] (, array([ 1.6]), array([ 0.9995736]))