Scientific Libraries in Python

Fernando Pérez fperez528 at yahoo.com
Wed Nov 14 11:54:26 EST 2001


I'd like to draft a rough map of the problem landscape. Hopefully it will 
help us get oriented. Comments and extensions encouraged. Please note that 
the summaries and other information are straight cut'n'paste from the various 
websites.

I'm going to include a few things beyond just numerical libraries, going into 
graphing. I just don't think any system today is a realistic competitor to 
things like IDL or Matlab if it doesn't have immediate access to a 
professional quality graphical engine.

I won't bother mentioning Numeric in detail. It's obviously a given base for 
the rest.

***************

Libraries:

SciPy at http://scipy.org
-----

Summary: SciPy--an open source library of scientific tools for Python.
SciPy supplements the popular Numeric module, gathering a variety of high 
level science and engineering modules together as a single package. Within 
SciPy are modules for graphics and plotting, optimization, integration, 
special functions, signal and image processing, genetic algorithms, ODE 
solvers, and others.  There is also an experimental "compiler" that takes a 
Numeric array expression in Python and compiles it to C++ code on the fly. 

Version: SciPy 0.10 released 2001-08-20

Comment: This seems to be by consensus the horse to bet on as a base 
platform. It seems to have a great architecture and very good ideas (the 
compiler is *really* cool). But its coverage is still very patchy.


ScientificPython at http://starship.python.net/crew/hinsen/scientific.html
----------------

Summary: ScientificPython is a collection of Python modules that are useful 
for scientific computing. In this collection you will find modules that
cover basic geometry (vectors, tensors, transformations, vector and
tensor fields), quaternions, automatic derivatives, (linear)
interpolation, polynomials, elementary statistics, nonlinear
least-squares fits, unit calculations, Fortran-compatible text
formatting, 3D visualization via VRML, and two Tk widgets for simple
line plots and 3D wireframe models.

Version: 2.2

Comment: very good quality code, only covers certain things. Several people 
advocate integrating its functionality into SciPy, doing a good job of 
unformizing naming conventions (and calling the whole thing Scientific). 
Personally I tend to agree with that general idea.

GSL -- The GNU Scientific Library at http://sources.redhat.com/gsl
---------------------------------

Summary: The GNU Scientific Library (GSL) is a collection of routines for
numerical computing.  The routines are written from scratch by the GSL
team in ANSI C, and present a modern Applications Programming
Interface (API) for C programmers, while allowing wrappers to be
written for very high level languages.

Version: 1.0, released 12 November 2001

Comment: I think this should be a critical piece of the puzzle. There's a ton 
of good, difficult work already done here, it would be silly to replicate it. 
See next topic. There may be licensing issues that need to be addressed.

PyGSL at http://sourceforge.net/projects/pygsl
-----

Summary: python interface to gsl library

Version: gsl-0.0.3 May 23, 2001

Comment: this is the complement to GSL: someone has already done the python 
bindings (or is working on it, at least). So pygsl going into the main 
project would automatically give us access to gsl.

Ideally, wrappers could be generated to make ufunc versions of all the 
functions there so that  calling them on Numeric arrays could be done 
efficiently.

GMP at http://www.swox.com/gmp
---

Summary: GMP is a free library for arbitrary precision arithmetic, operating 
on signed integers, rational numbers, and floating point numbers.

Version: GMP 3.1.1 has been released (2000-10-10)

Comment: for some applications having arbitrary precision floating point is 
critical (Python already has native long ints). This is the base library, see 
next for python.

mxNumber at http://www.lemburg.com/files/python/mxNumber.html
--------

Summary: Extended Numeric Types for Python (a wrapper around GMP).

Version: 0.4.0

Comment: well, brings the (IMHO necessary) GMP into the game.


GMPY at http://gmpy.sourceforge.net
----

Summary: same as above. Appears stalled at 0.9 pre-alpha.

GMP Extension Module at http://www.amk.ca/python/code/gmp.html
--------------------

Summary: same as above, but says that GMPY is more active and complete.

Comment: either mxNumber, GMPY or GMP Ext. Mod. will do. Find the best 
currently, and make it actually work. This is fairly typical of open-source 
projects: 3 versions which half-work, and not a single complete solution.


***************

Visualization:

Janko Hauser has a nice summary page at 
http://starship.python.net/crew/jhauser/plot-res.html so I won't repeat all 
that here. I think it's a bit outdated though. So below I'm going to list the 
things I think are currently realistic tools (not every piece of python code 
under the sun that can paint a line).


gracePlot.py at http://azathoth.caltech.edu/~n8gray/code
------------

Summary: This module provides interactive 2-D plotting capabilities via the 
Grace package.

Version: 0.5

Comment: grace is a very solid tool, though it's only 2D. But I think this is 
a great model of how a full-blown tool should work: scripting access, 
convenient for interactive at the python prompt, and with a gui for plot 
fine-tuning.

Gnuplot.py at http://gnuplot-py.sourceforge.net
----------

Summary: This is a Python interface to the gnuplot plotting program.

Version: 1.5

Comment: gnuplot is pretty powerful, especially with the new additions that 
support colormaps on 3d plots. But I don't know how realistic it would be to 
extend it to volume rendering (it only does 2d surfaces in 3d).

MayaVi at http://mayavi.sourceforge.net
-----

Summary: MayaVi is a free, easy to use scientific data visualizer.  It is 
written in Python and uses the amazing Visualization Toolkit (VTK) for the 
graphics.  It provides a GUI written using Tkinter.

Version: 1.0 (I believe a new one is coming up soon).

Comment: this seems the most promising tool to me from what I've seen, though 
it's pretty 'heavyweight'. If a good interface can be made for interactive 
prompt use and python scripted control, I think it's a winner. I don't know 
how it handles 2d plots (if at all). But I tend to think it's easier to add 
2d functionality to something like this rather than growing a 2d or basic 3d 
tool into a full blown visualizer that handles volume rendering.


***************
Final comment: that's what I see as the key players at this point. 
In my ideal fantasy world, a single 'import ScientificTools' (whatever you 
want to call it) would give me python access to all the above functionality, 
with a sane overall naming structure.

Once this fantasy world is a reality, we worry about symbolic tools. I can 
live without those (using Mathematica separately) for a while. A stopgap 
solution would be a good interface to Mathematica (I've seen one, don't know 
how good it is though).

Well, this is long but hopefully useful to help a bit the decision-making.

Fire away,

f.




More information about the Python-list mailing list