sknano.core.atoms.KDTreeAtomsMixin.query_atom_tree

KDTreeAtomsMixin.query_atom_tree(k=16, eps=0, p=2, rc=inf)[source][source]

Query atom tree for nearest neighbors distances and indices.

Parameters:

k : integer

The number of nearest neighbors to return.

eps : nonnegative float

Return approximate nearest neighbors; the kth returned value is guaranteed to be no further than (1+eps) times the distance to the real kth nearest neighbor.

p : float, 1<=p<=infinity

Which Minkowski p-norm to use. 1 is the sum-of-absolute-values “Manhattan” distance 2 is the usual Euclidean distance infinity is the maximum-coordinate-difference distance

rc : nonnegative float

Radius cutoff. Return only neighbors within this distance. This is used to prune tree searches, so if you are doing a series of nearest-neighbor queries, it may help to supply the distance to the nearest neighbor of the most recent point.

Returns:

d : array of floats

The distances to the nearest neighbors, sorted by distance.

i : array of integers

The locations of the neighbors in self.atom_tree.data. i is the same shape as d.