[Pythonmac-SIG] First Experience, Unix Python vs. MacPython and Science
Johann Hibschman
johann@surfbest.net
Wed, 20 Feb 2002 22:16:04 -0800
On Wednesday, February 20, 2002, at 09:04 AM, Lizardo H. C. M. Nunes
wrote:
>
> That's my first experience with Python. I'm a Doctorate Student in
> Physics and mainly a Fortran guy, I'm interested about using Python as
> a research tool, specially for number crushing. I hope you can help me
> providing pointers.
Good luck. I used Unix python as a cornerstone of a computational
project.
> I've got the source files for "Unix" Python 2.2. It built like a charm
> and passed all tests after "limit stacksize 2048". Now I want to
> rebuild it with readline support and whatever modules you think I
> should use. Also, I'd like to hear from you about the
> "--enable-framework option", is it a good idea? Should I create a
> Python.app via "./Mac/OSX" ?
Readline is pretty good. I wouldn't use the --enable-framework option.
I've not been able to get it to work. I end up with a framework
containing some binaries that I can't get to execute from the command
line, due to path issues. (Perhaps the ObjC [bundle pathForResource:
ofType:] methods could be used to make the binaries smarter? I've done
something like that for a Lua Framework. But that's a digression.)
If I were you, I'd stick with Unix python. It's just easier, if you
already have unix experience. (I was migrating code between a Solaris
machine and my Mac, so it was a natural fit for me.)
> Science packages:
>
> I've seen a couple of packages that I'm interested about, specially
> numpy and scipy.
>
> I really couldn't understand "What is" and "how to install" numpy. I
> thought it was some kind of "wrapper" for the Fortran LAPACK and BLAS
> routines among others, but it is surprisingly lite, only 3.3 MB when
> uncompressed.
Check out numpy.sourceforge.net (I think). They give some data on it.
Basically, all numpy does at the core is provide a dense numeric array
type which implements basic operations. They take up less memory than
python lists would, run faster, have clever slicing behavior, and let
you do elementwise operations quickly.
Think Matlab or IDL arrays.
By default, there's not much support for LAPACK. I'm sure someone has
it somewhere. I actually didn't do that much matrix math, just lots of
elementwise, so I don't have much experience with that.
There is some way to use the native BLAS functions with Numpy. It's a
configuration option, which assumes that you have your own
native-optimized BLAS routines already installed. If not, it gives just
generic support. The generic support was good enough for me, so I
didn't look into native BLAS.
I don't know about scipy. I've used a few of Konrad Hinsen's scientific
modules, mostly the array IO ones.
I hope that's enough to point you in the right direction. I had a lot
of fun using Python to drive C++ computational codes, but I'm not a real
Fortran guru.
--Johann