[SciPy-Dev] ndimage and from __future__ import division

Christopher Hanley chanley@stsci....
Sun Apr 25 11:49:39 CDT 2010


Hi,

As many of you likely know STScI forks the scipy version of ndimage
for  distribution with our code when we make STSCI_PYTHON releases.
We do this for ease of installation reasons since some of our code
still depends on ndimage from the days when if was distributed with
numarray.

In preparation for our next release we are preparing to support Python
2.6 with __future__ division.  Since I was one of the last STScI folks
to touch scipy I was tasked with looking into how ndimage would work
with "from __future__ import division" added.   All of the existing
tests pass with the exception of 2:

[redcedar:~] chanley% python
Python 2.5.4 (r254:67916, Nov  5 2009, 16:32:32)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ndimage
>>> ndimage.test()
.....................................................................................................................................................................................................F............F...................................................................................................................../Users/chanley/dev/ssb/site-packages/lib/python/ndimage/interpolation.py:429:
DeprecationWarning: integer argument expected, got float
 for ii in range(size):
.................................................................
======================================================================
FAIL: generic filter 1
----------------------------------------------------------------------
Traceback (most recent call last):
 File "/Users/chanley/dev/ssb/site-packages/lib/python/ndimage/test/test_ndimage.py",
line 1154, in test_generic_filter01
   self.failUnless(diff(r1, r2) < eps)
AssertionError

======================================================================
FAIL: geometric transform 13
----------------------------------------------------------------------
Traceback (most recent call last):
 File "/Users/chanley/dev/ssb/site-packages/lib/python/ndimage/test/test_ndimage.py",
line 1628, in test_geometric_transform13
   self.failUnless(diff(out, [1, 1, 1, 1]) < eps)
AssertionError

----------------------------------------------------------------------
Ran 393 tests in 0.729s

FAILED (failures=2)
>>>

I am actively looking into this issue and will happily add any fixes I
come up with back to the scipy.ndimage code base.  Since I am not too
familiar with all of the algorithms being used in ndimage it is not
readily clear to me which functions are assuming integer division.  If
any ndimage experts out there can look at these tests and instantly
know which functions are implicitly assuming integer division please
let me know.  Otherwise I will keep plugging away on my own.  I was
just hoping this might be obvious to someone.

Thank you for your time and help,
Chris



-- 
Christopher Hanley
Senior Systems Software Engineer
Space Telescope Science Institute
3700 San Martin Drive
Baltimore MD, 21218
(410) 338-4338


More information about the SciPy-Dev mailing list