mne.preprocessing.peak_finder#
- mne.preprocessing.peak_finder(x0, thresh=None, extrema=1, verbose=None)[source]#
Noise-tolerant fast peak-finding algorithm.
- Parameters
- x01d
array
A real vector from the maxima will be found (required).
- thresh
float
|None
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
.- extrema{-1, 1}
1 if maxima are desired, -1 if minima are desired (default = maxima, 1).
- verbosebool |
str
|int
|None
Control verbosity of the logging output. If
None
, use the default verbosity level. See the logging documentation andmne.verbose()
for details. Should only be passed as a keyword argument.
- x01d
- Returns
Notes
If repeated values are found the first is identified as the peak. Conversion from initial Matlab code from: Nathanael C. Yoder (ncyoder@purdue.edu)
Examples
>>> 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])