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
, orNone
If not None, override default verbose level (see
mne.verbose()
and Logging documentation for more). If used, it should be passed as a keyword-argument only.
- 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])