pysal.lib.weights.min_threshold_distance

pysal.lib.weights.min_threshold_distance(data, p=2)[source]

Get the maximum nearest neighbor distance.

Parameters:
data : array

(n,k) or KDTree where KDtree.data is array (n,k) n observations on k attributes

p : float

Minkowski p-norm distance metric parameter: 1<=p<=infinity 2: Euclidean distance 1: Manhattan distance

Returns:
nnd : float

maximum nearest neighbor distance between the n observations

Examples

>>> from pysal.lib.weights.util import min_threshold_distance
>>> import numpy as np
>>> x, y = np.indices((5, 5))
>>> x.shape = (25, 1)
>>> y.shape = (25, 1)
>>> data = np.hstack([x, y])
>>> min_threshold_distance(data)
1.0