Why does numerix import numpy.oldnumeric instead of numpy?

Hi,

With numpy 1.0b5 and a recent matplotlib from svn (rev 2761), and
numerix set to numpy, I'm getting errors like this:

Python 2.4.3 (#1, Apr 7 2006, 10:54:33)
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

from pylab import *
eye(3)

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/numpy/oldnumeric/mlab.py", line 24, in eye
    m = nn.equal(nn.subtract.outer(nn.arange(N), nn.arange(M)),-k)
NameError: global name 'nn' is not defined

Somehow numerix is getting the eye function from
numpy.oldnumeric.mlab, and it's not working. Maybe this is a numpy
bug, but apparently the eye function that you get from numpy does
work:

from numpy import *
eye(3)

array([[ 1., 0., 0.],
       [ 0., 1., 0.],
       [ 0., 0., 1.]])

eye.__module__

'numpy.lib.twodim_base'

It seems that numerix is importing oldnumeric on purpose, but why is
this?

···

--
Jouni

Hi,

With numpy 1.0b5 and a recent matplotlib from svn (rev 2761), and
numerix set to numpy, I'm getting errors like this:

Python 2.4.3 (#1, Apr 7 2006, 10:54:33)
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> from pylab import *
>>> eye(3)

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packa
ges/numpy/oldnumeric/mlab.py", line 24, in eye m =
nn.equal(nn.subtract.outer(nn.arange(N), nn.arange(M)),-k) NameError:
global name 'nn' is not defined

Somehow numerix is getting the eye function from
numpy.oldnumeric.mlab, and it's not working. Maybe this is a numpy
bug,

It is a numpy bug.

but apparently the eye function that you get from numpy does

work:
>>> from numpy import *
>>> eye(3)

array([[ 1., 0., 0.],
       [ 0., 1., 0.],
       [ 0., 0., 1.]])

>>> eye.__module__

'numpy.lib.twodim_base'

It seems that numerix is importing oldnumeric on purpose, but why is
this?

The eye function in oldnumeric does not work, and we import from there to
allow transparent compatibility between numpy, Numeric and numarray.

···

On Friday 08 September 2006 10:11, Jouni K Seppanen wrote:

And it has been fixed as of svn 3139.

···

On Friday 08 September 2006 10:29, Darren Dale wrote:

On Friday 08 September 2006 10:11, Jouni K Seppanen wrote:
> Hi,
>
> With numpy 1.0b5 and a recent matplotlib from svn (rev 2761), and
> numerix set to numpy, I'm getting errors like this:
>
> Python 2.4.3 (#1, Apr 7 2006, 10:54:33)
> [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> from pylab import *
> >>> eye(3)
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pac
>ka ges/numpy/oldnumeric/mlab.py", line 24, in eye m =
> nn.equal(nn.subtract.outer(nn.arange(N), nn.arange(M)),-k) NameError:
> global name 'nn' is not defined
>
> Somehow numerix is getting the eye function from
> numpy.oldnumeric.mlab, and it's not working. Maybe this is a numpy
> bug,

It is a numpy bug.

Darren Dale wrote:

···

On Friday 08 September 2006 10:29, Darren Dale wrote:

On Friday 08 September 2006 10:11, Jouni K Seppanen wrote:

Hi,

With numpy 1.0b5 and a recent matplotlib from svn (rev 2761), and
numerix set to numpy, I'm getting errors like this:

Python 2.4.3 (#1, Apr 7 2006, 10:54:33)
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

from pylab import *
eye(3)

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pac
ka ges/numpy/oldnumeric/mlab.py", line 24, in eye m =
nn.equal(nn.subtract.outer(nn.arange(N), nn.arange(M)),-k) NameError:
global name 'nn' is not defined

Somehow numerix is getting the eye function from
numpy.oldnumeric.mlab, and it's not working. Maybe this is a numpy
bug,

It is a numpy bug.

And it has been fixed as of svn 3139.

I should note, that you can install SVN version of NumPy without changing matplotlib. The 0.87.5 release should work for all of the 1.0 and 1.0.X releases of NumPy

-Travis