#### Category : kdtree

A KDTree is a tree indexed by N-D position in space. If I have an item with coordinate [1,2,3] and another item with coordinate [1.0001,2,3], then a KDTree would return this nearest neighbor in a single O(logN) operation. I have an algorithmic approach where I would like to sort the whole set of items in ..

For example, suppose I have created a kdtree from the points in a 2-d array. Then I run a nearest neighbor query on some point (represented as a pair of x-y coordinates) asking for the 8 nearest neighbors to that point. This returns two lists: (1) a list of 8 distances to neighbors of the ..

I am using scipy.cKDTree.query(data, n_jobs=2) in conjunction with export OMP_NUM_THREADS=2, on a machine with 2 threads per core. I would have expected there to be 200% CPU usage when the script is running, however, only 100% seems to be running. I wondered what could be the cause? This is the simple shell script (script.sh): #!/bin/sh ..

I would like to implement a restricted nearest neighbor search for each point in a data matrix X. Specifically, I would like to find the nearest neighbor of X[i,:] among the rows of X[mask_i,:], where mask_i is a logical mask depending on X[i,:]. Below is a brute force way of accomplishing this task, using the ..

I’m trying to measure the shortest euclidean distance of each point to the nearest group of points. Using below, I have 6 unique points displayed in x,y at two separate time points. I have a separate xy point recorded in x_ref, y_ref, which I pass a radius around. So for each point outside this radius, ..

I have got a list of nodes which are the collection of 3D coorinates. I’m using the following code to find the nearest coordinates based on a specific distance. nodes = translations.tolist() for i in range(len(nodes)): node = nodes[i] ix_list = kdtree.query_ball_point(node, DISTANCE) The above code results in duplication of the indices because ix_list also ..

I am trying to create a kd-tree through scipy’s KD_tree class built by objects rather than pure coordinates. The objects has a (x,y) tuple, and the tree is based upon this, but i would like to include the object itself as the node/in the node. Is there some "easy" approach to this? Had a look ..