cupyx.scipy.signal.argrelmin#

cupyx.scipy.signal.argrelmin(data, axis=0, order=1, mode='clip')[source]#

计算 data 中的相对最小值。

参数:
  • data (ndarray) – 要查找相对最小值的数组。

  • axis (int, 可选) – 用于从 data 中选择的轴。默认为 0。

  • order (int, 可选) – 用于比较以确定 comparator(n, n+x) 为 True 时,每一侧要使用的点数。

  • mode (str, 可选) – 如何处理向量的边缘。可用选项有 ‘wrap’ (环绕) 或 ‘clip’ (将溢出视为与最后一个(或第一个)元素相同)。默认为 ‘clip’。参见 cupy.take。

返回值:

extrema – 整数数组中的最小值索引。extrema[k]data 在轴 k 上的索引数组。请注意,即使 data 是一维的,返回值也是一个元组。

返回类型:

元组,元素为 ndarray

注意

此函数使用 cupy.less 作为比较器来调用 argrelextrema。因此,它要求一个值两侧都存在严格的不等式才将其视为最小值。这意味着不检测平坦的最小值(宽度大于一个样本)。对于一维 data,可以通过调用 find_peaks 并取反 data 来检测所有局部最小值,包括平坦的最小值。

示例

>>> from cupyx.scipy.signal import argrelmin
>>> import cupy
>>> x = cupy.array([2, 1, 2, 3, 2, 0, 1, 0])
>>> argrelmin(x)
(array([1, 5]),)
>>> y = cupy.array([[1, 2, 1, 2],
...               [2, 2, 0, 0],
...               [5, 3, 4, 4]])
...
>>> argrelmin(y, axis=1)
(array([0, 2]), array([2, 1]))