【发布时间】:2019-03-10 00:20:05
【问题描述】:
我的代码检测到低于阈值的所有点,然后定位起点和终点。
below = np.where(self.data < self.threshold)[0]
startandend = np.diff(below)
startpoints = np.insert(startandend, 0, 2)
endpoints = np.insert(startandend, -1, 2)
startpoints = np.where(startpoints>1)[0]
endpoints = np.where(endpoints>1)[0]
startpoints = below[startpoints]
endpoints = below[endpoints]
这里的 np.where() 函数之后我并没有真正得到 [0] 的使用
【问题讨论】:
-
试试
print(below)和[0]看看有什么不同。这些事情你可以很容易地调查自己