[Numpy-discussion] Proposal: scipy.spatial

Gael Varoquaux gael.varoquaux at normalesup.org
Tue Sep 30 17:34:23 EDT 2008


On Tue, Sep 30, 2008 at 05:31:17PM -0400, Anne Archibald wrote:
> T = KDTree(data)

> distances, indices = T.query(xs) # single nearest neighbor

> distances, indices = T.query(xs, k=10) # ten nearest neighbors

> distances, indices = T.query(xs, k=None, distance_upper_bound=1.0) #
> all within 1 of x

> What do you think of this interface?

k=None in the third call to T.query seems redundant. It should be
possible do put some logics so that the call is simply

distances, indices = T.query(xs, distance_upper_bound=1.0)

My 2 cents,

Gaël



More information about the NumPy-Discussion mailing list