[Discuss] SciPy and F2PY

Alan W. Irwin irwin at beluga.phys.uvic.ca
Mon Jul 23 13:47:10 PDT 2007


Many years ago the scientific community developed the Numeric extension to
Python to provide Fortran/C - like speed for operations on arrays.  Note,
that Numeric is no longer supported and its successor (under the umbrella
project SciPy at http://www.scipy.org/SciPy) is called NumPy
(http://numpy.scipy.org/).

When boning up on converting some of my Python/Numeric scripts to
Python/NumPy, I discovered another neat component of SciPy called F2py
(http://www.scipy.org/F2py).  That project allows python programmers to call
routines written in fortran (and also C).  This is great for scientific
python programmers because there are literally millions of lines of fortran
(and C) code out there that are the best in their class for solving
particular numerical problems.  F2py should allow doing lots of useful
things with the numerical results from Fortran (and C) routines including
combining results from various routines together in novel ways.

F2py is going to be immediately useful for my own research. For example,
right now I output results to disk from my FreeEOS fortran library using
special utility programmes written in fortran, then read that data into
python to plot it using the python interface to PLplot.  With F2py I will be
able to short-circuit the whole process and call FreeEOS routines directly
to get the data I need to plot.  (Note, PLplot has both fortran 77 and 95
interfaces, but I feel Python is just more flexible and powerful than either
kind of fortran which is why I always do my plotting using the python
interface to PLplot.)

My discovery of F2py has made my day.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the Discuss mailing list