[SciPy-user] converting from scipy.ndarray to Numeric array

Francesc Altet falted at pytables.org
Wed Dec 7 10:52:05 CST 2005

A Dimarts 06 Desembre 2005 16:46, Stefan van der Walt va escriure:
> What is the preferred way of converting between scipy arrays and
> numarray/Numeric arrays?
> I need this in order to display images using mpl (the images are
> converted to scipy.ndarray using scipy.utils.pilutil.fromimage).

After the arrival of Numeric 24.x and numarray 1.5.x series, and
provided you are using a relatively new version of scipy (> 0.4.3),
I'd recommend you using the array protocol for doing this.

Using the conversion in Python space is easy:

numarray_array = numarray.asarray(scipy_array)
Numeric_array = Numeric.asarray(scipy_array)

If you are using C, you will have to use the array struct described in:



Francesc Altet

More information about the SciPy-user mailing list