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

Sturla Molden sturla at molden.no
Sat Jul 14 13:36:45 EDT 2012


I have traced down the bug, it was related to an array being altered 
inplace instead of copied.

I have also taken out two other bugs related to C long (and Python int) 
being 32 bit on Windows 64.

I still get four fails on Win 64. They are there in Patrick's code as 
well, so they are related to his coding.

An update is commited here:

https://github.com/sturlamolden/scipy/blob/master/scipy/spatial/ckdtree.pyx


Sturla



D:\kd-tree\20120714-cKDTree>python test.py
..............................................................................................................................FFFF...
======================================================================
FAIL: test.test_onetree_query_compiled(<ckdtree.cKDTree object at 
0x000000000583AE18>, 0.1)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
     self.test(*self.arg)
   File "D:\kd-tree\20120714-cKDTree\test.py", line 570, in 
check_onetree_query
     assert_(s == T.query_pairs(d))
   File "C:\Python27\lib\site-packages\numpy\testing\utils.py", line 34, 
in assert_
     raise AssertionError(msg)
AssertionError

======================================================================
FAIL: test.test_onetree_query_compiled(<ckdtree.cKDTree object at 
0x000000000583AE18>, 0.001)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
     self.test(*self.arg)
   File "D:\kd-tree\20120714-cKDTree\test.py", line 570, in 
check_onetree_query
     assert_(s == T.query_pairs(d))
   File "C:\Python27\lib\site-packages\numpy\testing\utils.py", line 34, 
in assert_
     raise AssertionError(msg)
AssertionError

======================================================================
FAIL: test.test_onetree_query_compiled(<ckdtree.cKDTree object at 
0x000000000583AE18>, 1e-05)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
     self.test(*self.arg)
   File "D:\kd-tree\20120714-cKDTree\test.py", line 570, in 
check_onetree_query
     assert_(s == T.query_pairs(d))
   File "C:\Python27\lib\site-packages\numpy\testing\utils.py", line 34, 
in assert_
     raise AssertionError(msg)
AssertionError

======================================================================
FAIL: test.test_onetree_query_compiled(<ckdtree.cKDTree object at 
0x000000000583AE18>, 1e-06)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
     self.test(*self.arg)
   File "D:\kd-tree\20120714-cKDTree\test.py", line 570, in 
check_onetree_query
     assert_(s == T.query_pairs(d))
   File "C:\Python27\lib\site-packages\numpy\testing\utils.py", line 34, 
in assert_
     raise AssertionError(msg)
AssertionError

----------------------------------------------------------------------
Ran 133 tests in 4.351s

FAILED (failures=4)



Den 14.07.2012 13:17, skrev Ralf Gommers:
>
> I took your edits and committed them as a diff to Patricks last 
> commit. Then I added a few style fixes: 
> https://github.com/rgommers/scipy/tree/fixes-sturla. The best way to 
> get this in would be for Patrick to add these commits to his branch so 
> they show up in his PR (after finding a bug, see below).
>
> I did some testing (python 2.6, 32-bit, OS X 10.6), I get one test 
> failure with Sturla's edits. Patrick's branch given me no failures.
>
>  ======================================================================
> FAIL: test_kdtree.test_count_neighbors_compiled.test_multiple_radius
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File 
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/nose-1.1.2-py2.6.egg/nose/case.py", 
> line 197, in runTest
>     self.test(*self.arg)
>   File 
> "/Users/rgommers/Code/scipy/scipy/spatial/tests/test_kdtree.py", line 
> 496, in test_multiple_radius
>     assert_equal(self.T1.count_neighbors(self.T2, r), result)
>   File "/Users/rgommers/Code/numpy/numpy/testing/utils.py", line 313, 
> in assert_equal
>     raise AssertionError(msg)
> AssertionError:
> Items are not equal:
>  ACTUAL: 6
>  DESIRED: 54
>
> The actual and desired numbers change due to random numbers without a 
> seed being used, but it fails consistently. The missing seed is no 
> real problem here, because the code simply does the same twice; it 
> only tests if the "r" input to count_neighbors is correctly vectorized.
>
> Ralf
>
>
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20120714/1ac5fa2d/attachment.html>


More information about the SciPy-Dev mailing list