Noise-tolerant fast peak-finding algorithm.
A real vector from the maxima will be found (required).
The amount above surrounding data for a peak to be
identified. Larger values mean the algorithm is more selective in
finding peaks. If
None, use the default of
(max(x0) - min(x0)) / 4.
1 if maxima are desired, -1 if minima are desired (default = maxima, 1).
If repeated values are found the first is identified as the peak. Conversion from initial Matlab code from: Nathanael C. Yoder (firstname.lastname@example.org)
>>> import numpy as np >>> from mne.preprocessing import peak_finder >>> t = np.arange(0, 3, 0.01) >>> x = np.sin(np.pi*t) - np.sin(0.5*np.pi*t) >>> peak_locs, peak_mags = peak_finder(x) >>> peak_locs array([36, 260]) >>> peak_mags array([0.36900026, 1.76007351])