[SciPy-user] transition problems

Travis Oliphant oliphant.travis at ieee.org
Mon Dec 12 04:12:32 CST 2005

Christian Kristukat wrote:

>Travis Oliphant wrote:
>>Christian Kristukat wrote:
>>>I noticed that using the new core together with older packages that are based on 
>>>numeric, like the plotting module from wxPython, matplotlib, grace_np.py, etc. 
>>>is problematic since numeric seems to be unable to recognize new core arrays as 
>>>equivalent to the numeric ones. 
>>If you get a recent version (>=24.0) of Numeric then it shouldn't be a 
>>problem. One of the purposes of the array interface is to ease the 
>>transition, but only recent versions  of Numeric use it properly.  If 
>>there are problems with recent versions of Numeric and the array 
>>interface then please post them.
>Nice to hear that transition will be easy. Unfortunately I'm already using 
>Numeric 24.0. I wrote a small example using wxPython which works with Numeric 
>but doesn't with scipy.base:
You should show us the error so we can be sure, but...

This problem looks like it is with the third-party library (wx in this 
case) --- and there is no way to eliminate all such problems until 
people get behind a single library (or at least a single interface).   
This will just take people willing to make the required patches.   All 
such third-party libraries should convert to scipy_core as soon as 

Now,  it might be as simple as re-compling the library after replacing

#include Numeric/arrayobject.h
#include scipy/arrayobject.h

Or, if the third-party libraries asked Numeric to translate the object 
into a Numeric array, then they will work when compiled against Numeric 
24.x.   However,  if the library intentionally failed unless the object 
was a Numeric array (which I suspect the PolyLine function did when it 
was compiled against the Numeric C-API), then the only way to get it to 
work is to re-compile against the scipy_core library.

While the transistion is really not difficult for third-party developers 
(we managed to convert the entire scipy library very quickly), it does 
take some effort.    In the mean time, what you can do is use Numeric 
and scipy together so that before you hand off to a third-party app 
compiled against Numeric, convert your scipy array to a Numeric array 
and then use the Numeric array in the third-party app.  If you use 
array(<>, copy=0) then no copying should be done:

numeric_array = Numeric.array(scipy_array,copy=0)


numeric_array = Numeric.asarray(scipy_array)  

                  which does copy=0 by default.


More information about the SciPy-user mailing list