[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Numeric/NumPy/Numarray Clarification



Chris Ashurst wrote:
I've been messing around with PyGame and the OpenGL bindings for a while
now, and I've recently begun to start seeing the light of using the array
classes from numpy for various math operation.

The thing is... Does anyone have any sort of clear idea about which package
I should have installed out of Numeric, NumPy and Numarray? They all seem to
be by the same bunch of people, but the fact that they all seem to do the
same thing, but are named differently and have no clues about them to let
you know which one does/has what bundled in with it.

For instance, in the pygame repository there's a little plasma demo that
uses RandomArray which is suppsedly in the Numeric package. I have the
Numeric package installed, but after searching through the
/usr/lib/python2.4/site-packages directory, I did not find RandomArray in
the Numeric package, but I *did* find a RandomArray2 module inside the
Numarray package. So in the code, I had to replace "from RandomArray import
*" to "from numarray.random_array.RandomArray2 import *".

Ultimately, that did the trick of solving the "missing" RandomArray import
problem, but seriously, I just want a nice, clean site-packages directory,
and just need some pointers on which bloody package I *should* have
installed, or at the very least, someone explain to me the differences
between the three apparently different packages.

Sorry for the long-windedness, but it's just kinda frustrating not knowing
if I have the "right" package installed.

Thanks :)

I can try, but will probably get it wrong.

First came Numeric. But as computers developed some found it didn't handle really large arrays well. So along came numarray, and Numeric was retired. numarray was a total rewrite of Numeric that also took advantage of the class/type merger of Python 2.2. But some found Numeric faster at handling small arrays and were reluctant to switch. So a third attempt was made to update Numeric to fixed some known issues. But this changed Numeric enough that it was introduced as a new package, numpy. numpy also includes features of numarray. numpy is advertised as the successor of both Numeric and numarray. But numpy is almost, though not entirely, backward compatible to Numeric. Things break. Also the official numpy documentation is not free. So the move to numpy has been slow.

The only solid suggestion I can make is don't bother with numarray. Pygame doesn't support it and never will. Pygame 1.8 will support both Numeric and numpy. But current pygame programs expect Numeric and may need updating to use numpy. So you will probably want both Numeric and numpy for now. Is it clear now? :-)

--
Lenard Lindstrom
<len-l@xxxxxxxxx>