Another Bug in KDTree

There appears to be a bug in KDTree.query_ball_point, when using integer points neighbor points that lie on the radius are not always returned. Eg, with a 4x4 grid
import scipy.spatial points = [(0, 0), (0, 1), (0, 2), (0, 3), \ ... (1, 0), (1, 1), (1, 2), (1, 3), \ ... (2, 0), (2, 1), (2, 2), (2, 3), \ ... (3, 0), (3, 1), (3, 2), (3, 3)] kd=scipy.spatial.KDTree(points) kd.query_ball_point((2,0),1) [8, 9, 12]
points = [(0.0, 0.0), (0.0, 1.0), (0.0, 2.0), (0.0, 3.0), \ ... (1.0, 0.0), (1.0, 1.0), (1.0, 2.0), (1.0, 3.0), \ ... (2.0, 0.0), (2.0, 1.0), (2.0, 2.0), (2.0, 3.0), \ ... (3.0, 0.0), (3.0, 1.0), (3.0, 2.0), (3.0, 3.0)]
kd=scipy.spatial.KDTree(points) kd.query_ball_point((2,0),1) [4, 8, 9, 12]

Has anyone been able to verify this bug? or know if it's already documented somewhere? Thanks, Charlie. On Wed, Jan 19, 2011 at 5:31 PM, Charles R. Schmidt <schmidtc@gmail.com> wrote:
There appears to be a bug in KDTree.query_ball_point, when using integer points neighbor points that lie on the radius are not always returned.
Eg, with a 4x4 grid
import scipy.spatial points = [(0, 0), (0, 1), (0, 2), (0, 3), \ ... (1, 0), (1, 1), (1, 2), (1, 3), \ ... (2, 0), (2, 1), (2, 2), (2, 3), \ ... (3, 0), (3, 1), (3, 2), (3, 3)] kd=scipy.spatial.KDTree(points) kd.query_ball_point((2,0),1) [8, 9, 12]
points = [(0.0, 0.0), (0.0, 1.0), (0.0, 2.0), (0.0, 3.0), \ ... (1.0, 0.0), (1.0, 1.0), (1.0, 2.0), (1.0, 3.0), \ ... (2.0, 0.0), (2.0, 1.0), (2.0, 2.0), (2.0, 3.0), \ ... (3.0, 0.0), (3.0, 1.0), (3.0, 2.0), (3.0, 3.0)]
kd=scipy.spatial.KDTree(points) kd.query_ball_point((2,0),1) [4, 8, 9, 12]

On Wed, Jan 26, 2011 at 12:32 AM, Charles R. Schmidt <schmidtc@gmail.com>wrote:
Has anyone been able to verify this bug? or know if it's already documented somewhere?
Same output on my system, looks like a bug. I don't think it's documented anywhere, could you open a ticket for it? Thanks, Ralf
Thanks, Charlie.
On Wed, Jan 19, 2011 at 5:31 PM, Charles R. Schmidt <schmidtc@gmail.com> wrote:
There appears to be a bug in KDTree.query_ball_point, when using integer points neighbor points that lie on the radius are not always returned.
Eg, with a 4x4 grid
import scipy.spatial points = [(0, 0), (0, 1), (0, 2), (0, 3), \ ... (1, 0), (1, 1), (1, 2), (1, 3), \ ... (2, 0), (2, 1), (2, 2), (2, 3), \ ... (3, 0), (3, 1), (3, 2), (3, 3)] kd=scipy.spatial.KDTree(points) kd.query_ball_point((2,0),1) [8, 9, 12]
points = [(0.0, 0.0), (0.0, 1.0), (0.0, 2.0), (0.0, 3.0), \ ... (1.0, 0.0), (1.0, 1.0), (1.0, 2.0), (1.0, 3.0), \ ... (2.0, 0.0), (2.0, 1.0), (2.0, 2.0), (2.0, 3.0), \ ... (3.0, 0.0), (3.0, 1.0), (3.0, 2.0), (3.0, 3.0)]
kd=scipy.spatial.KDTree(points) kd.query_ball_point((2,0),1) [4, 8, 9, 12]
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-dev
participants (2)
-
Charles R. Schmidt
-
Ralf Gommers