From: Frank G. <fgi...@hm...> - 2002-04-10 16:04:25
|
Anybody out there used the Numeric Python package with Jython? I've tried installing it by substituting 'jython' for 'python' in the installation instructions, but it fails for lack of a 'distutils' package. I'd really appreciate any help you can give me in getting up and running with this. My boss thinks Perl/CGI is the best way to go on my new project, particularly since it can take advantage of the Perl Data Language (PDL) and its high-performance numeric functionality. I really want to show him that Jython is at least a viable alternative, but for that I need some kind of high-performance numerical capabilities (it *doesn't* have to be as fast as C, or even close, just faster than using lists as matrices/vectors). Thanks, Frank Gibbons PhD, Computational Biologist, Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA. Tel: 617-432-3555 Fax: 617-432-3557 http://llama.med.harvard.edu/~fgibbons |
From: Frank G. <fgi...@hm...> - 2002-04-10 17:54:46
|
Jeff, >As you found, you can't do that. Anything that relies on C extensions >to Python won't work in Jython. Thanks for explaining. What about this: I'm specifically interested in using the FFT package from Numeric. The core code is just an f2c-translated version of the original FORTRAN code, with some hand-tweaking. Has anyone out there used SWIG to build a Java interface to that? (I came to Jython through SWIG, and I've used SWIG to interface C and Perl, but not C and Java. C/Perl was pretty straightforward once I got going, how different it C/Java?) On a related matter, I had assumed that anything I couldn't find in Jython or Java, I could just write in C, then SWIG it into Python and call it from there. It sounds like you're saying that's not possible.... :( >There are nearly 500 static methods in the class with all sorts of >permutations of arguments for one-, two-, and three-dimensional >arrays with ranges, etc. As I mentioned above, and perhaps I could have been more clear in my initial question, it's not enough simply to create arrays, I need to be able to operate on them with functions: trigonometric (sin, cos, atan), statistical (average, stdev), FFT, in addition to general purpose things like log, exp, and general array arithmetic. I'm generally interested in one-dimensional arrays. All suggestions welcome. Frank Gibbons PhD, Computational Biologist, Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA. Tel: 617-432-3555 Fax: 617-432-3557 http://llama.med.harvard.edu/~fgibbons |
From: Michel P. <mi...@di...> - 2002-04-12 08:39:45
|
On Wednesday 10 April 2002 07:57 pm, Frank Gibbons wrote: > Jeff, > > >As you found, you can't do that. Anything that relies on C extensions > >to Python won't work in Jython. > > Thanks for explaining. What about this: I'm specifically interested in > using the FFT package from Numeric. I don't know much about this subject, but I'd be suprised if there wasn't something like Numeric written in Java that is at least comparible in functionality and faster than the Python Numeric implementation. A quick google search found this interesting page: http://math.nist.gov/javanumerics/ -Michel |
From: Paul M. <p.m...@sn...> - 2002-04-10 17:59:48
|
----- Original Message ----- From: "Frank Gibbons" <fgi...@hm...> To: "Jython Users' Group" <jyt...@li...> Sent: Wednesday, April 10, 2002 12:07 PM Subject: [Jython-users] Numeric Jython? > Anybody out there used the Numeric Python package with Jython? I've tried > installing it by substituting 'jython' for 'python' in the installation > instructions, but it fails for lack of a 'distutils' package. > > I'd really appreciate any help you can give me in getting up and running > with this. My boss thinks Perl/CGI is the best way to go on my new project, > particularly since it can take advantage of the Perl Data Language (PDL) > and its high-performance numeric functionality. > > I really want to show him that Jython is at least a viable alternative, but > for that I need some kind of high-performance numerical capabilities (it > *doesn't* have to be as fast as C, or even close, just faster than using > lists as matrices/vectors). > Tim Hochberg had reimplemented some of Numeric's functionality for Jython, but it looks like it hasn't been updated in a while - see here: http://starship.python.net/~hochberg/ However, this begs the question - is there a particular reason you want to use Jython rathern than CPython in this context? If one alternative is Perl/CGI I can imagine that a Python/CGI solution would be just as effective (and readable too!) --Paul --------------------------------------- Paul M. Magwene, Ph.D. Postdoctoral Fellow Dept. of Ecology and Evolutionary Biology Yale University |
From: Samuele P. <pe...@in...> - 2002-04-10 18:11:55
|
From: Paul M. <p.m...@sn...> > > Tim Hochberg had reimplemented some of Numeric's functionality for Jython, > but it looks like it hasn't been updated in a while - see here: > http://starship.python.net/~hochberg/ there is also a more recent (too recent?) similar effort, <sf.net/projects/jnumerical> > > However, this begs the question - is there a particular reason you want to > use Jython rathern than CPython in this context? If one alternative is > Perl/CGI I can imagine that a Python/CGI solution would be just as effective > (and readable too!) > I agree, for simple startup time considerations Jython rhymes well with servlets not CGI. regards. |
From: Kevin J. B. <kev...@bi...> - 2002-04-10 18:25:26
|
Frank Gibbons wrote: > > Thanks for explaining. What about this: I'm specifically interested in > using the FFT package from Numeric. The core code is just an > f2c-translated version of the original FORTRAN code, with some > hand-tweaking. Has anyone out there used SWIG to build a Java interface > to that? (I came to Jython through SWIG, and I've used SWIG to interface > C and Perl, but not C and Java. C/Perl was pretty straightforward once I > got going, how different it C/Java?) I haven't used SWIG much since the Java support got going, but it should be very much the same as using SWIG w/ C & Perl (or with C and CPython) > On a related matter, I had assumed that anything I couldn't find in > Jython or Java, I could just write in C, then SWIG it into Python and > call it from there. It sounds like you're saying that's not possible.... :( Sounds like you've got two concepts here: 1- SWIG into Java and call from Jython 2- SWIG into Python and call from C Python If you're writing things in C, usually you'll be happier calling them from CPython. > As I mentioned above, and perhaps I could have been more clear in my > initial question, it's not enough simply to create arrays, I need to be > able to operate on them with functions: trigonometric (sin, cos, atan), > statistical (average, stdev), FFT, in addition to general purpose things > like log, exp, and general array arithmetic. I'm generally interested in > one-dimensional arrays. Sounds like you'll be happiest just using C Python and Numeric... From your description of your project (alternative = Perl/CGI, high-performance numeric is desirable), you may want to consider C Python & Numeric rather than Jython, and possibly Medusa/Bobo... kb |
From: Frank G. <fgi...@hm...> - 2002-04-10 21:26:31
|
Thanks for the feedback, Jeff. Iterating over large loops using Math.sin might work for me, I was just hoping to avoid having to code it myself ;) And there's always that performance hit associated with calling Java for each element of a long vector, as compared with a package-based solution which passes the whole thing in at one fell swoop. I mean, I don't need it to be super fast right now, but using extensions can make it a whole lot faster. >Some of our 500 methods do sin, cos, etc. Java provides basic trig >functions, we just loop over the array and call the Java function. >It's just the iteration over the array that is very slow from Jython. > > public static void sin(int n1, float[] rx, float[] ry) { > for (int i1=0; i1<n1; ++i1) ry[i1] = Math.sin(rx[i1]); > } Thanks to Samuele for the pointer to JNumeric on SourceForge. I downloaded that, gave it a whirl, found a few bugs, reported 'em. I don't think it's ready for primetime yet. If I were more familiar with Jython/Python internals, I might try my hand there, since they seemed like they might be easy to fix. But I just can't afford the time investment right now. For right now, I may just forego the seductive Swing GUI, and retreat to CPython. On the bright side, it sure is nice to start up fast like CPython! :) --Frank PhD, Computational Biologist, Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA. Tel: 617-432-3555 Fax: 617-432-3557 http://llama.med.harvard.edu/~fgibbons |
From: Frank G. <fgi...@hm...> - 2002-04-10 19:09:35
|
>However, this begs the question - is there a particular reason you want to >use Jython rathern than CPython in this context? If one alternative is >Perl/CGI I can imagine that a Python/CGI solution would be just as effective >(and readable too!) Yes, good question. The particular reasons I wanted to use Jython were the following (no particular order): * access to Swing classes, I'd like to have a decent GUI. I know about TkInter, but see next point. * ability to compile into Java bytecode, and ultimately to put everything into a single JAR for distribution - the idea of having a single platform to support is very attractive. My software is targeted toward users who will not generally be capable or permitted to install Python on their machines. They will probably not be Linux users either. But they'll likely have a JVM onboard. Reasons I wanted to use Python (and these definitely are of lower priority than the Jython reasons above): * readability of code, in particular no need to cast references like this: @list = @{$array_ref} * cleaner OO syntax Reasons why I may (reluctantly) go back to using Perl: * high-performance numerical support available in PDL * ease of extensibility using SWIG, to fill gaps in available packages * lack of justification for 'babelizing' the lab where I work (Perl is the lingua franca, though Java and C are used too). I need a good reason to move towards Python, as outlined in the above points. Right now, it's starting to look like the readability/syntax issues are the only ones I can rely on. I will check out the Hochberg link, thanks to those who mentioned it. Frank Gibbons PhD, Computational Biologist, Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA. Tel: 617-432-3555 Fax: 617-432-3557 http://llama.med.harvard.edu/~fgibbons |
From: Paul M. <p.m...@sn...> - 2002-04-11 05:14:26
|
I was just reading up on JPE ( http://jpe.sourceforge.net/ ) - this seems like it might be an interesting way to weave together java, python, and c code. Any experience/feedback from Jython users? --Paul |
From: Paul M. <p.m...@sn...> - 2002-04-11 05:15:37
|
DESCRIPTION: ----------- disipyl is an object-oriented wrapper around the DISLIN plotting library. DISLIN is a powerful and flexible multiplatform (Win32, Unix, Linux, etc.) library designed for displaying scientific data. DISLIN's author, Helmut Michels, has made available a DISLIN plotting extension for the Python programming language (see http://www.linmpi.mpg.de/dislin/ for more details). disipyl provides a set of classes which represent various aspects of DISLIN plots, as well as providing some easy to use classes for creating commonly used plot formats (e.g. scatter plots, histograms, 3-D surface plots). A major goal in designing the library was to facilitate interactive data exploration and plot creation. Documentation, a tutorial, and a demo program are included. The library has been tested on Win32, Linux, and FreeBSD, but I anticipate that it should work on any platform which can make use of Python, NumPy, and the DISLIN python extensions. Feedback, comments, and critique are gladly accepted (email: pau...@ya...). VERSION: ------- This is release 0.6 of disipyl. CHANGES: ------- New in this release: * support for plot interaction (record plot coordinates via mouse clicks) * new mechanism for quering disipyl objects about the options they support * cleanup of data/option setting mechanisms for disiypl objects * Jython support (when DISLIN java library available - most but not all classes) * updated documentation and tutorial URL: ---- You can find disipyl at: http://pantheon.yale.edu/~pmm34/disipyl.html |