[SciPy-dev] ndimage & numpy

Jonathan Taylor jonathan.taylor at stanford.edu
Fri Mar 10 03:19:23 CST 2006


Hi all,

I spent some time today trying to get

      scipy.sandbox.ndimage

working with numpy instead of it requiring numarray (and numpy as well).....

I have found some issues with types in the ndimage extension code. For
the time being, I
have fixed these shamefully by copying things as necessary to Float64
and converting
back later -- these are the two functions in the attached file numpyfix.py.

If anyone is interested, I have put a patch here

http://www-stat.stanford.edu/~jtaylo/ndimage.patch

and attached a simple file numpyfix.py which should be placed in the

scipy/Lib/sandbox/nd_image/Lib

directory. The patch passes all but 11 unittests in

scipy.sandbox.ndimage.test

at least by my reckoning, and 10 of these are about ndimage.label (so 
effectively only one function is failing). The other failure concerns 
accuracy for gaussian_filter.

In theory, I would imagine that the fix in numpyfix.py can be rewritten
so that no actual copying
takes place, but I haven't gotten that far yet. BUT, even if I try to
call .astype, copying to something that the ndimage extension code seems
to accept, I get the same errors. This seems to mean that for an input
array

input->descr->type_num

is somehow not being set properly as I am calling it.

-- Jonathan

-- 
------------------------------------------------------------------------
I'm part of the Team in Training: please support our efforts for the
Leukemia and Lymphoma Society!

http://www.active.com/donate/tntsvmb/tntsvmbJTaylor

GO TEAM !!!

------------------------------------------------------------------------
Jonathan Taylor                           Tel:   650.723.9230
Dept. of Statistics                       Fax:   650.725.8977
Sequoia Hall, 137                         www-stat.stanford.edu/~jtaylo
390 Serra Mall
Stanford, CA 94305
-------------- next part --------------
A non-text attachment was scrubbed...
Name: numpyfix.py
Type: text/x-python
Size: 391 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-dev/attachments/20060310/cbe8a5d6/attachment.py 


More information about the Scipy-dev mailing list