[Matrix-SIG] Re: Using Python or Java for data analysis

Chris Barker cbarker@jps.net
Mon, 05 Apr 1999 13:40:26 -0700

This is a reply to anthony wilson's request for comments.

First a bit about where I am coming from:

I have recently started using Python quite a bit, and like it a lot. I
am hoping that I will eventually be able to use it for numerical
analysis/number crunching in much the same way I use MATLAB now, except
with the ability to distribute apps that are cross platform (Linux,
Mac-OS, Windows, and plus ?)

I have no experience with JAVA.

First to address your questions, from the Python point of view:

>1).  File Input parsing into some usable form

Python's string handling routines make this pretty easy, and I am
starting to work on a file scanning module (something like MATLAB's
fscanf) that would make it even easier (and faster). Let me know if you
would like to work with me on this.

>2).  2 -D plotting.  This would also include interactive labeling and

This is the tough one. I have yet to find a plotting package for Python
that works on the Mac. There are a couple that look like they could be
ported without much pain (Gist, for instance), but no one seems to have
done this yet. I need this desperately!

I am thinking about a writting a plotting package build on Tkinter's
canvas, for maximum portability.  Konrad Hinsen's TkPlotCanvas is a good
start to this (it's in his Scientific package)

Does anyone know the status of the SNOW project?

>3).  X-Y labeling
see above

>4).  GUI for the calculator front end

Tkinter would make this VERY easy. 
There are nifty GUI GUI-builders for JAVA that might make it even
easier, but I've never tried them.

>5).  Numerical Analysis Support.  for data processing

NumPy has most (if not all) of what you need, and adding more would not
be too
hard. I think Python has a real advantage over JAVA here.

>6). speed

With NumPy, Python would be as fast as anything, at least for the number 
crunching which is probably the only thing that matters. Tkinter is
plenty fast.

>7). Application delivery.  Final product as an application for others to

I'd like to see this easier to do with Python. You would probably have
to distribute Python, and all the modules that you need with your
app. This might make it a bit messier than it has to be. On Linux, yopu
could make a rpm out of it, and it would be pretty easy. On the mac, you
could make an installer that would be pretty easy, or even put
everything you need into the Resource fork, and make it look like a
stand alone app.

>At the moment, I am leaning towards using Java because of the cross
>platform and new 2D API support.  But Python, I really like and its
>easier to program using Python.

Well, Python is pretty darn Cross Platform as well, with the exception
of the plotting packages. Easier to program is worth a lot!

>I would appreciate any comments on any aspect of this development.
>Please only serious commentary.  I would like to use the best language
>for the job.

Good idea!

I'd like to add two points that I think make Python a better choice:

1) Scriptability. If your app will be only a "point and click" affair,
JAVA may be a better choice, but if you use Python, you get a complete
scripting/macro language in the package! My guess is that with the kind
of analysis you are talking about, your users might very well want to
enhance/extend the capabilities of your progam, and having the Python
interpreter as part of your app would be a great way to do this. Note
that if you were to write your app in C or C++, imbedding a Python
interpretter would still be a great idea!

2) there are a lot of folks using Python for similar things already, so
you would have a whole community of people (at least me, if no-one
else!) that you could work with on at least the individual pieces of
your program, such as the plotting routines, file I/O, and perhaps some
numerical routines. You would also be contributing to a nobel effort!

By the way, if you are thinking of going with JAVA, you could also
consider just sticking with C++ and WX Windows. It's not "write once,run
anywhere" but it could be "write once, compile anywhere" if you are
carefull about it!

Good luck,


Christopher Barker,
cbarker@jps.net                      ---           ---           ---
http://www.jps.net/cbarker          -----@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Water Resources Engineering       ------   @    ------   @   ------   @
Coastal and Fluvial Hydrodynamics -------      ---------     --------