[SciPy-User] Using arbitrary object as datapoints for scipy.spatial.KDTree

daniel-s dtgml1+scipy@gmail....
Sun Jun 24 06:00:27 CDT 2012


A KDTree is usually created with a list of tuples, where each tuple
represents a datapoint (ie. [(3,4,5), (6,7,8)])

Is it possible to create one using a list of your own objects?

ie. something like a list of "point" objects

class point(object):
    self.__init__(self, location):
        self.location = location

In this case self.location is what the tree would use in creating nodes and
finding neighbours.

I have tried to implement the __getitem__(self): method, but this does not

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20120624/45155164/attachment.html 

More information about the SciPy-User mailing list