scipy.signal.find_peaks_cwt(vector, widths, wavelet=None, max_distances=None, gap_thresh=None, min_length=None, min_snr=1, noise_perc=10)[source]

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.

Parameters :

vector: 1-D ndarray :

widths: 1-D sequence :

Widths to use for calculating the CWT matrix. In general, this range should cover the expected width of peaks of interest.

wavelet: function :

Should take a single variable and return a 1d array to convolve with vector. Should be normalized to unit area. Default is the ricker wavelet

max_distances: 1-D ndarray,optional :

Default widths/4. See identify_ridge_lines

gap_thresh: float, optional :

Default 2. See identify_ridge_lines

min_length: int, optional :

Default None. See filter_ridge_lines

min_snr: float, optional :

Default 1. See filter_ridge_lines

noise_perc: float, optional :

Default 10. See filter_ridge_lines


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


>>> 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]
([32], array([ 1.6]), array([ 0.9995736]))

Previous topic


Next topic