Pedagogic advice needed

Fernando Pérez fperez528 at yahoo.com
Wed Jun 19 13:44:48 EDT 2002


Jerzy Karczmarczuk wrote:

> Then I began to digest all that, and the obvious question was: why not
> Python?

Indeed :)

> 1. Does anybody here have some teaching experience in a similar context?

I've been invited to give a talk to a similar group of biology students, at 
the end of the course, and have also given informal talks on 'python for 
science' to mathematicians. My topic for the biologists was C/python 
integration, but the whole course was given to a mix of graduate/undergrads 
with no computing background. I've spoken a fair bit to the professor and his 
experience (even though this was his first time teaching it) seems to have 
been very positive.

You can find more about his course at: http://mcdb.colorado.edu/courses/6440/


> 2. Assuming that the visualisation issues, all kind of plots, graphs
>    *and animations* are very important, how would you organize with
>    Python such a work?

For this kind of work, my current solution is using python/Numeric for the 
matlab-like numerical work, with Gnuplot for normal 2d/3d plotting (I have 
available a customized interface for Gnuplot access which runs on top of M. 
Haggerty's Gnuplot.py -- http://www-heller.harvard.edu/~mhagger/download/). 
This works very well for all kinds of 'typical' scientific plotting needs.

For fancier 3d visualization needs (isosurfaces of functions of 3 variables, 
volume rendering, etc) I use the amazing MayaVi 
(http://mayavi.sourceforge.net/). It's a full featured GUI visualizer, but 
all written in python and scriptable 'from inside'. With it you'll also get 
ivtk, a very nice system for interactive use of VTK.

Here are a few quick examples of what mayavi can do (from my own stuff, 
there's plenty more out there):

http://windom.colorado.edu/~fperez/pub/topo_viz_sample.jpg -> isosurfaces and 
colormap cut planes (with and without transparency) of a 3-d slice of a 4-d 
dataset.

http://windom.colorado.edu/~fperez/pub/topo_vol_ray.jpg -> a fancy ray-traced 
volume rendering of one 3-d slice. This kind of rendering is SLOW, but gives 
pretty pictures :) You have to write your own translucency tables obviously, 
and that takes some experimenting. You can grab from there the code to make 
that image if you want to play with it 
(http://windom.colorado.edu/~fperez/pub/vtk_volume.tgz)

http://windom.colorado.edu/~fperez/pub/topo_2412.b585m008.36.1000.slices/ -> 
the full 4-d dataset sliced into a webpage. The html generation code is about 
15-20 lines of very simple python. It's a very convenient way of visualizing 
complex datasets and automatically sharing the results with ohters: all they 
need is a web browser.


> Of course I know Numeric Python, Scientific Python modules, and other
> standard stuff permitting to do all kind of graphic exercices and
> demonstrations (eg., all the wx bazar).

Do you know about SciPy ()? It is a complete 'framework' that wraps around 
Numeric to provide very impressive overall functionality.

> But I *must* avoid the low-level programming, we won't have time for that.
> We will need a reasonable complete scientific 3D plotting package usable
> by people without too much experience.

If someone is there to do the install for them, I'd say scipy could satisfy 
your needs. Installing it is a major chore right now, but once up and running 
it works very well. You need to run off of CVS though, all releaseed code is 
outdated now.

> (I checked the Obvious Suspects, the Vault of Parnassus, etc., I am veryfing
> all that stuff, but perhaps some of you know something really succulent and
> full of vitamines. I need *your experience*, NOT just standard Web links.)

Well, besides the above, I would plug here my own project IPython 
(http://windom.colorado.edu/~fperez/ipython/). It's a command-line shell much 
more powerful than the default one, with many features specifically designed 
for scientific computing work (inspired/stolen from environments like 
Mathematica and IDL). If you install it and start 'ipython -p numeric' 
(assuming you have both Numeric and Gnuplot.py installed), you'll have an 
environnment very much like Matlab. Its gnuplot access functions are enhanced 
versions of the originals in Gnuplot.py, to make day to day plotting easier 
(I use it constantly, so I do eat my own dog food :)

I use IPython everyday for exactly the kind of thing you have in mind, so 
I've tuned it to be as convenient as possible in that kind of environment. If 
you are interested in using it, I'll be glad to help you out with any snags 
you encounter.

Cheers,

f.




More information about the Python-list mailing list