Issue
Motivation:
I've seen this algorithm described, and I'd rather not reinvent the wheel if a standard implementation exists. I've also learned that if there is a scipy/numpy implementation, it is usually much faster than anything I can roll myself in python.
Algorithm Description
I have a large number of points on the plane (several million). Starting with a large box that encompasses all the points, I'd like to continuously subdivide the box into equal area sub-boxes. The subdivision continues recursively while there are at least 1,000 points in the sub-box. The algorithm returns a tree that describes the subdivisions and the mapping of the points to each leaf node of the tree.
What is the name of this algorithm (something like divide and conquer?), and is there a standard method of doing it when given a 2D numpy array of points?
Solution
It's called a quadtree partition. As far as Python code, see this thread.
As per the comment by Joe Kington, take a look at scipy.spatial.KDTree
and/or scipy.spatial.cKDTree
.
Answered By - Ted Hopp
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.