bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / signal / _peak_finding / argrelextrema
function
scipy.signal._peak_finding:argrelextrema
source: build-install/usr/lib/python3.14/site-packages/scipy/signal/_peak_finding.py:198
Signature
def argrelextrema(data, comparator, axis = 0, order = 1, mode = clip)Summary
Calculate the relative extrema of data.
Parameters
data: ndarrayArray in which to find the relative extrema.
comparator: callableFunction to use to compare two data points. Should take two arrays as arguments.
axis: int, optionalAxis over which to select from
data. Default is 0.order: int, optionalHow many points on each side to use for the comparison to consider
comparator(n, n+x)to be True.mode: str, optionalHow the edges of the vector are treated. 'wrap' (wrap around) or 'clip' (treat overflow as the same as the last (or first) element). Default is 'clip'. See numpy.take.
Returns
extrema: tuple of ndarraysIndices of the maxima in arrays of integers.
extrema[k]is the array of indices of axiskofdata. Note that the return value is a tuple even whendatais 1-D.
Notes
Examples
import numpy as np from scipy.signal import argrelextrema x = np.array([2, 1, 2, 3, 2, 0, 1, 0]) argrelextrema(x, np.greater) y = np.array([[1, 2, 1, 2], [2, 2, 0, 0], [5, 3, 4, 4]]) argrelextrema(y, np.less, axis=1)✓
(array([0, 2]), array([2, 1]))
See also
Aliases
scipy.signal.argrelextrema