cupyx.scipy.signal.argrelmax#
- cupyx.scipy.signal.argrelmax(data, axis=0, order=1, mode='clip')[源代码]#
计算 data 的相对最大值。
- 参数:
- 返回:
extrema – 整数数组中最大值的索引。
extrema[k]
是 data 的轴 k 的索引数组。请注意,即使 data 是一维的,返回值也是一个元组。- 返回类型:
tuple 的 ndarrays
另请参阅
注意
此函数使用
argrelextrema
并以cupy.greater
作为比较器。因此,要将其视为最大值,它需要值两侧都存在严格的不等式。这意味着不会检测到平坦的最大值(宽度超过一个样本)。对于一维 data,可以使用find_peaks
来检测所有局部最大值,包括平坦的最大值。示例
>>> from cupyx.scipy.signal import argrelmax >>> import cupy >>> x = cupy.array([2, 1, 2, 3, 2, 0, 1, 0]) >>> argrelmax(x) (array([3, 6]),) >>> y = cupy.array([[1, 2, 1, 2], ... [2, 2, 0, 0], ... [5, 3, 4, 4]]) ... >>> argrelmax(y, axis=1) (array([0]), array([1]))