[SciPy-Dev] Enhancements to scipy.spatial.cKDTree

Patrick Varilly patvarilly at gmail.com
Fri Jul 6 19:36:50 EDT 2012


Dear all,

I've recently been putting together a wrapper around scipy.spatial.KDTree
to transparently handle periodic boundary conditions that are common in
analyzing the results of molecular simulations (
https://github.com/patvarilly/periodic_kdtree).  In the process, I've
started enhancing some of scipy.spatial.cKDTree by adding a Cythonized
query_ball_point method.  A pull request is here

https://github.com/scipy/scipy/pull/262

Two things I have noticed are that the interfaces to the KDTree and cKDTree
query() methods aren't quite in line, and that it wouldn't take a whole lot
of extra effort to Cythonize the rest of KDTree.  The innards of the code
could also be reorganized a bit to make it easier for other people to
extend these classes.  For the periodic kd-trees, for example, I had to
jump through a few hoops, and ended up with two different codebases for
wrapping KDTree's and cKDTree's, which is not ideal.

I was writing to gauge if there's actually any interest in cleaning up
KDTrees and Cythonizing the rest of the KDTree interface.  If so, I'd be
willing to put a bit of effort into doing so.  A delicate question that
comes up is whether anyone relies on the subtle differences between
KDTree.query() and cKDTree.query() (e.g., passing k = None), so that
bringing the two interfaces exactly in line with each other would break
existing code.  How is this issue usually dealt with?

All the best,

Patrick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20120707/3e8f9a73/attachment.html>


More information about the SciPy-Dev mailing list