[SciPy-user] surface plotting

Lorenzo Isella lorenzo.isella@gmail....
Sun Dec 2 09:24:50 CST 2007


Dear All,
I refer to the text quoted below. I am interested in data representation 
and 3D plots in particular (something matplotlib is not very suitable for).

>One of the easiest ways to get things installed without eggs right now 
>is to first install the dependencies -- wxPython 2.6, python-vtk and 
>numpy and then grab the tarballs here:

  http://code.enthought.com/downloads/source/ets2.6/
>
>Untar them and build them each

 > cd enthought.traits
 > ./build.sh
 > vi/emacs install.sh
 > ./install.sh

>for all the tarballs and you should have mayavi installed.  The script 
>is broken in that it does not install the mayavi executable though -- 
>need to fix that.

In case it matters, I am running Debian testing on my box.
I tried first using eggs (with little success) and then the tarballs + 
./build.sh + ./install.sh.
Now, I am having 2 problems:
(1) if I try to re-run some old codes of mine(relying on SciPy), I get 
tons of these warnings:
/usr/lib/python2.4/site-packages/scipy/misc/__init__.py:25: 
DeprecationWarning: ScipyTest is now called NumpyTest; please update 
your code
  test = ScipyTest().test
/usr/lib/python2.4/site-packages/scipy/linalg/__init__.py:32: 
DeprecationWarning: ScipyTest is now called NumpyTest; please update 
your code
  test = ScipyTest().test
/usr/lib/python2.4/site-packages/scipy/optimize/__init__.py:17: 
DeprecationWarning: ScipyTest is now called NumpyTest; please update 
your code
  test = ScipyTest().test
/usr/lib/python2.4/site-packages/scipy/ndimage/__init__.py:40: 
DeprecationWarning: ScipyTest is now called NumpyTest; please update 
your code
  test = ScipyTest().test
/usr/lib/python2.4/site-packages/scipy/sparse/__init__.py:9: 
DeprecationWarning: ScipyTest is now called NumpyTest; please update 
your code
  test = ScipyTest().test
/usr/lib/python2.4/site-packages/scipy/io/__init__.py:20: 
DeprecationWarning: ScipyTest is now called NumpyTest; please update 
your code
  test = ScipyTest().test
/usr/lib/python2.4/site-packages/scipy/lib/__init__.py:5: 
DeprecationWarning: ScipyTest is now called NumpyTest; please update 
your code
  test = ScipyTest().test
/usr/lib/python2.4/site-packages/scipy/linsolve/umfpack/__init__.py:7: 
DeprecationWarning: ScipyTest is now called NumpyTest; please update 
your code
  test = ScipyTest().test
/usr/lib/python2.4/site-packages/scipy/linsolve/__init__.py:13: 
DeprecationWarning: ScipyTest is now called NumpyTest; please update 
your code
  test = ScipyTest().test
/usr/lib/python2.4/site-packages/scipy/interpolate/__init__.py:15: 
DeprecationWarning: ScipyTest is now called NumpyTest; please update 
your code
  test = ScipyTest().test
/usr/lib/python2.4/site-packages/scipy/special/__init__.py:22: 
DeprecationWarning: ScipyTest is now called NumpyTest; please update 
your code
  test = ScipyTest().test
/usr/lib/python2.4/site-packages/scipy/stats/__init__.py:15: 
DeprecationWarning: ScipyTest is now called NumpyTest; please update 
your code
  test = ScipyTest().test
/usr/lib/python2.4/site-packages/scipy/fftpack/__init__.py:21: 
DeprecationWarning: ScipyTest is now called NumpyTest; please update 
your code
  test = ScipyTest().test
/usr/lib/python2.4/site-packages/scipy/integrate/__init__.py:16: 
DeprecationWarning: ScipyTest is now called NumpyTest; please update 
your code
  test = ScipyTest().test
/usr/lib/python2.4/site-packages/scipy/signal/__init__.py:17: 
DeprecationWarning: ScipyTest is now called NumpyTest; please update 
your code
  test = ScipyTest().test
/usr/lib/python2.4/site-packages/scipy/maxentropy/__init__.py:12: 
DeprecationWarning: ScipyTest is now called NumpyTest; please update 
your code
  test = ScipyTest().test

Basically, ScipyTest is now, in some sense, NumpyTest. Other than that, 
the codes seem to run fine, but I hope I have not harmed my system. Does 
it have anything to do with the different versions of Python I have 
installed? Should I be worried to end up with a broken Python? That 
would be a disaster for me. What is giving rise to this new warning? Any 
suggestions here are welcome.
(2)This is less critical to me: when I try running the code snippet on
 http://www.scipy.org/Cookbook/MayaVi/mlab

import scipy

# prepare some interesting function:
def f(x, y):
    return 3.0*scipy.sin(x*y+1e-4)/(x*y+1e-4)

x = scipy.arange(-7., 7.05, 0.1)
y = scipy.arange(-5., 5.05, 0.1)

# 3D visualization of f:
from enthought.tvtk.tools import mlab
fig = mlab.figure()
s = mlab.SurfRegular(x, y, f)
fig.add(s)


this is what I get:

/usr/lib/python2.4/site-packages/scipy/misc/__init__.py:25: 
DeprecationWarning: ScipyTest is now called NumpyTest; please update 
your code
  test = ScipyTest().test

(python:13574): Gtk-CRITICAL **: gtk_widget_set_colormap: assertion 
`!GTK_WIDGET_REALIZED (widget)' failed


and no window opens. Any idea of what is going on? BTW, I actually tried 
replacing  ScipyTest with NumpyTest  in 
/usr/lib/python2.4/site-packages/scipy/misc/__init__.py:25, but then the 
code crashed badly (can give more info if needed). So, one error and the 
same warning as before. The other example I want to discuss is
(http://www.scipy.org/Cookbook/MayaVi/Surf)


import numpy
def f(x, y):
return numpy.sin(x*y)/(x*y)
x = numpy.arange(-7., 7.05, 0.1)
y = numpy.arange(-5., 5.05, 0.05)
from enthought.tvtk.tools import mlab
s = mlab.SurfRegular(x, y, f)
from enthought.mayavi.sources.vtk_data_source import VTKDataSource
d = VTKDataSource()
d.data = s.data
mayavi.add_source(d)
from enthought.mayavi.filters.warp_scalar import WarpScalar
w = WarpScalar()
mayavi.add_filter(w)
from enthought.mayavi.modules.outline import Outline
from enthought.mayavi.modules.surface import Surface
o = Outline()
s = Surface()
mayavi.add_module(o)
mayavi.add_module(s)


but again,  this is what I get:

/usr/lib/python2.4/site-packages/scipy/misc/__init__.py:25: 
DeprecationWarning: ScipyTest is now called NumpyTest; please update 
your code
  test = ScipyTest().test
So far so good
Traceback (most recent call last):
  File "3D-enthought.py", line 13, in ?
    mayavi.add_source(d)
NameError: name 'mayavi' is not defined

So, what is going on here? Mayavi is actually installed on my system...

Sorry for the long post. My main interest is point (1), i.e. to be sure 
that my python installation is still OK (and know what to do in case it 
is not). As to point (2), in the end of the day, these modules will make 
it into debian packages, won't they? So at some point installing them 
should be straightforward (at least for me; I am not very good at 
handling source and installing myself).
Many thanks

Lorenzo












More information about the SciPy-user mailing list