【问题标题】:Is there a function in python that might allow me to identify the location of this purple circle? [closed]python中是否有一个函数可以让我识别这个紫色圆圈的位置? [关闭]
【发布时间】:2021-08-26 17:55:53
【问题描述】:

我正在寻找这个紫色圆圈的位置以及在传感器开始收集数据之前存在(主要)水平滞后的不同数据集的类似情况。

有什么想法吗?

【问题讨论】:

    标签: python numpy matplotlib scipy


    【解决方案1】:

    numpy.diff 为您提供数组中每个连续项目之间的差异。它可能非常有用,但您可能需要添加一些平滑以防止噪声产生误报。这是一个易于使用的平滑函数:

    def moving_average(x, w):
        return np.convolve(x, np.ones(w), 'valid') / w
    

    (来自here

    我建议您绘制 np.diff(data) 并查看它的样子。在该图上找到紫色点会容易得多,如果您执行两次 np.diff 甚至可能更容易找到它。

    对于这种情况,我会这样做:

    purple_index = np.argmax(np.diff(data) < -1)
    

    【讨论】:

      猜你喜欢
      • 2012-08-16
      • 1970-01-01
      • 1970-01-01
      • 2020-11-25
      • 2018-12-15
      • 2022-06-29
      • 2020-11-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多