[Numpy-discussion] numpy/Numeric co-existence

Robert Kern robert.kern at gmail.com
Tue Aug 22 14:49:17 CDT 2006


James Boyle wrote:
> I have some codes which require a Numeric array and others which 
> require a numpy array.
> I have no control over either code, and not the time to convert all to 
> numpy if I did.
> The problem is this - say I have a routine that returns a numpy array 
> as a result and I wish to do something to this array using a code that 
> uses Numeric.  Just passing the numpy array to the numeric code does 
> not work. In my case the Numeric code thinks that the numpy float is a 
> long int, this is not good. So what does one do in the interim? There 
> are some legacy codes which will never be converted to numpy.
> 
> I have seen discussion as to how to convert Numeric -> numpy, but not 
> how the two can play together. I can appreciate the strong desire to 
> eliminate having two systems, but the practical aspects of getting 
> things done must also be considered.
> 
> I am using numpy 1.0b1 and Numeric 23.7 .

Upgrade to Numeric 24.2 and use Numeric.asarray(numpy_array) and 
numpy.asarray(numeric_array) at the interfaces between your codes.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco





More information about the Numpy-discussion mailing list