[SciPy-user] Installation on dual opteron ...

Arnd Baecker arnd.baecker at web.de
Wed Sep 28 03:34:32 CDT 2005


On Wed, 28 Sep 2005, Arnd Baecker wrote:

[...]
> Then scipy builds and installs fine, but ...
>
> In [1]: from scipy import *
> In [2]: x=arange(10.0)
> In [3]: xplt.plg(x)
> ---------------------------------------------------------------------------
> exceptions.ImportError                               Traceback (most

It seems that this is an old-fellow again,
http://www.scipy.net/pipermail/scipy-user/2004-October/003496.html
related to slice3.py in scipy.xplt and Numeric,
as already
  from scipy.xplt import *
fails (see below for the full error message).

To test this:

import Numeric
print Numeric.__version__
import arrayfns
x=Numeric.array([[0, 0, 0, 1], [1, 1, 1, 0]])
y=Numeric.array([[0,  1], [0,  1], [1,  0], [1,  0]])
print x.typecode()
print y.typecode()
arrayfns.find_mask(x, y)

gives on my normal desktop machine:

In [1]:import Numeric
In [2]:print Numeric.__version__
23.8
In [3]:import arrayfns
In [4]:x=Numeric.array([[0, 0, 0, 1], [1, 1, 1, 0]])
In [5]:y=Numeric.array([[0,  1], [0,  1], [1,  0], [1,  0]])
In [6]:print x.typecode()
l
In [7]:print y.typecode()
l
In [8]:arrayfns.find_mask(x, y)
Out[8]:array([1, 0, 1, 0],'i')


However, on the one where `scipy.xplt import *` fails I get:

In [1]: import Numeric
In [2]: print Numeric.__version__
24.0b2
In [3]: import arrayfns
In [4]: x=Numeric.array([[0, 0, 0, 1], [1, 1, 1, 0]])
In [5]: y=Numeric.array([[0,  1], [0,  1], [1,  0], [1,  0]])
In [6]: print x.typecode()
l
In [7]: print y.typecode()
l
In [8]: arrayfns.find_mask(x, y)
---------------------------------------------------------------------------
exceptions.TypeError                     Traceback (most recent call last)
/home/abaecker/<console>
TypeError: Array can not be safely cast to required type


If one uses instead:

In [9]: arrayfns.find_mask(x.astype("b"), y.astype("b"))

it works fine.

No idea what the reason (64 Bit?) for this changed behaviour
of Numeric is.

The solution/workaround is:

  in slice3.py, routine _construct3
  change
    mask = find_mask (below, _node_edges3 [itype])
  to
    mask = find_mask (below.astype("b"), _node_edges3 [itype].astype("b"))

With this plotting with scipy.xplt works fine.

Best,

Arnd








In [11]: from scipy.xplt import *
---------------------------------------------------------------------------
exceptions.TypeError                                 Traceback (most
recent call last)

/home/abaecker/<console>

/scr/python3/lib/python2.4/site-packages/scipy/xplt/__init__.py
     43 if maxheight is None:
     44     maxheight = 768
     45
---> 46 from Mplot import *
     47

/scr/python3/lib/python2.4/site-packages/scipy/xplt/Mplot.py
   1009 _dheight=6*inches
   1010
-> 1011 import colorbar
   1012 def imagesc_cb(z,cmin=None,cmax=None,xryr=None,_style='default',
   1013
zlabel=None,font='helvetica',fontsize=16,color='black',

/scr/python3/lib/python2.4/site-packages/scipy/xplt/colorbar.py
      7 from arrayfns import *
      8 from gist import *
----> 9 from slice3 import *
     10
     11 def nice_levels (z, n = 8) :

/scr/python3/lib/python2.4/site-packages/scipy/xplt/slice3.py
   1579 #
------------------------------------------------------------------------
   1580
-> 1581 _poly_permutations4 = _construct3 (0)
   1582 _poly_permutations5 = _construct3 (1)
   1583 _poly_permutations6 = _construct3 (2)

/scr/python3/lib/python2.4/site-packages/scipy/xplt/slice3.py in
_construct3(itype)
   1573    # For some reason the node edges for a cell need to be in
different order
   1574    # here than in slice3 to get the correct results. Hence
_node_edges3.
-> 1575    mask = find_mask (below, _node_edges3 [itype])
   1576
   1577    return construct3 (mask, itype)

TypeError: Array can not be safely cast to required type



More information about the SciPy-user mailing list