bundles / scipy 1.17.1 / scipy / signal / _peak_finding / argrelmin
function
scipy.signal._peak_finding:argrelmin
Signature
def argrelmin ( data , axis = 0 , order = 1 , mode = clip ) Summary
Calculate the relative minima of data.
Parameters
data: ndarrayArray in which to find the relative minima.
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. Available options are 'wrap' (wrap around) or 'clip' (treat overflow as the same as the last (or first) element). Default 'clip'. See numpy.take.
Returns
extrema: tuple of ndarraysIndices of the minima 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
This function uses argrelextrema with np.less as comparator. Therefore, it requires a strict inequality on both sides of a value to consider it a minimum. This means flat minima (more than one sample wide) are not detected. In case of 1-D data find_peaks can be used to detect all local minima, including flat ones, by calling it with negated data.
Array API Standard Support
argrelmin has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable SCIPY_ARRAY_API=1 and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.
==================== ==================== ==================== Library CPU GPU ==================== ==================== ==================== NumPy ✅ n/a CuPy n/a ⛔ PyTorch ⛔ ⛔ JAX ⛔ ⛔ Dask ⛔ n/a ==================== ==================== ====================
See
dev-arrayapifor more information.
Examples
import numpy as np from scipy.signal import argrelmin x = np.array([2, 1, 2, 3, 2, 0, 1, 0]) argrelmin(x) y = np.array([[1, 2, 1, 2], [2, 2, 0, 0], [5, 3, 4, 4]]) argrelmin(y, axis=1)✓
See also
Aliases
-
scipy.signal.argrelmin