Noise-tolerant fast peak-finding algorithm.
arrayA real vector from the maxima will be found (required).
float | NoneThe 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).
str | int | NoneControl verbosity of the logging output. If None, use the default
verbosity level. See the logging documentation and
mne.verbose() for details. Should only be passed as a keyword
argument.
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])