Skip to content

Commit 14c9175

Browse files
committed
Set limit to number of neighbours
1 parent 428647b commit 14c9175

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pysteps/motion/lucaskanade.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ def _outlier_removal(x, y, u, v, thr, multivariate=True, k=30, verbose=False):
618618

619619
points = np.concatenate((x, y), axis=1)
620620
tree = scipy.spatial.cKDTree(points)
621-
_, inds = tree.query(points, k=k + 1)
621+
_, inds = tree.query(points, k=np.min((k + 1, points.shape[0])))
622622
keep = []
623623
for i in range(inds.shape[0]):
624624

0 commit comments

Comments
 (0)