[SciPy-User] Reduction of spatial with small differences

Zachary Pincus zachary.pincus at yale.edu
Thu Jul 4 17:20:19 EDT 2013


> I have an numpy.array with 3D points. Some of the points are very close to each other. Now I want reduce points they have a distance smaller than x.

You'll probably need to specify your problem a bit more clearly: what if you have an evenly-spaced array of points that are 0.9x distance apart? Should that be reduced to a single point? 

Depending on how pathological your data are, this could basically be a clustering problem. If your data are guaranteed non-pathological (all points distantly spaced except small clusters spaced within x) then all you need to do is find those clusters, which you could do by calculating the full distance matrix (exact) or with a kd-tree (fast), both available in scipy.spatial.

Zach


More information about the SciPy-User mailing list