From fredrik_lundh@ivab.se Wed Apr 3 09:07:26 1996 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Wed, 3 Apr 1996 11:07:26 +0200 Subject: [PYTHON MATRIX-SIG] Errors when importing the Numeric module Message-ID: <9604030907.AA05551@arnold.image.ivab.se> Just built Python 1.3 with NumericPython 0.31. Can anyone explain the following... (ok, the first two lines are obviously test stuff left in UserArray.py, but the exception)? Python 1.3 (Apr 2 1996) [C] Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import Numeric UserArray([1,2,3], 'l') UserArray([0.841470956802,0.909297406673,0.141120001674], 'f') Traceback (innermost last): File "", line 1, in ? File "/usr/local/lib/python/numeric/Numeric.py", line 9, in ? import string, types, math File "/usr/local/lib/python/types.py", line 12, in ? if vars(__builtins__).has_key('complex'): TypeError: vars() argument must have __dict__ attribute When importing it again, everything works fine. BTW, it seems as if a Matrix<->PIL interface consists of ~2 lines of code for each direction. Watch this space for info. /F ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From Rob.Hooft@EMBL-Heidelberg.de Wed Apr 3 10:23:39 1996 From: Rob.Hooft@EMBL-Heidelberg.de (Rob Hooft) Date: Wed, 3 Apr 1996 12:23:39 +0200 Subject: [PYTHON MATRIX-SIG] Comparisons Message-ID: <199604031023.MAA02513@nu.EMBL-Heidelberg.DE> Hi, I just subscribed to this list this week, and have spend a few evenings reading the 1.8MB archive.... I haven't even compiled the software yet, and still I'd like to mention something that surprised me in the discussions so far. Repeatedly there has been a discussion about "<" and ">" comparisons for Array objects. Why can that not be implemented in the "dictionary" way? It just needs to be made recursive. Like: a (message from Rob Hooft on Wed, 3 Apr 1996 12:23:39 +0200) Message-ID: <9604031100.AA22601@arnold.image.ivab.se> Rob wrote: > I'll be trying to compile 0.35 soon. And I'll better do the same. Please ignore my previous bug report! (unless the problem is still there with the 0.35 release...). /F ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From fredrik_lundh@ivab.se Wed Apr 3 11:25:19 1996 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Wed, 3 Apr 1996 13:25:19 +0200 Subject: [PYTHON MATRIX-SIG] ANNOUNCE: A minimal Matrix<->PIL interface Message-ID: <9604031125.AA20167@arnold.image.ivab.se> If someone would like to fool around with the Python Imaging Library and the Numerical extension at the same time, here's a really minimal interface between these two libraries. A little more checking should of course be added, to make sure that the image isn't multiband, and that the array really contains unsigned 8-bit integers, but at least you'll get the idea :-) /F -------------------------------------------------------------------- import Image, Numeric def ImageToArray(i): a = Numeric.array(i._tostring(), "b") a.shape = i.size[1], i.size[0] return a def ArrayToImage(a): i = Image.new("L", (a.shape[1], a.shape[0])) i._fromstring(a.toString()) return i # "If you cannot do it in 8 lines of Python, it is probably # not worth doing." -------------------------------------------------------------------- The current PIL distribution can be found at: http://www.python.org/sigs/image-sig/Imaging-0.0.tar.gz http://www.python.org/sigs/image-sig/Imaging-0.1-handbook-draft.ps.gz Release 0.1 of the library will be available real soon now (it would be nice if at least someone had any comments on the current release, though :-) ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From fredrik_lundh@ivab.se Wed Apr 3 11:42:26 1996 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Wed, 3 Apr 1996 13:42:26 +0200 Subject: [PYTHON MATRIX-SIG] Re: [PYTHON IMAGE-SIG] ANNOUNCE: A minimal Matrix<->PIL interface In-Reply-To: <9604031125.AA20167@arnold.image.ivab.se> (message from Fredrik Lundh on Wed, 3 Apr 1996 13:25:19 +0200) Message-ID: <9604031142.AA10297@arnold.image.ivab.se> BTW, have anyone written a 2D FFT module for the Matrix library? /F ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From hinsenk@ere.umontreal.ca Wed Apr 3 12:08:17 1996 From: hinsenk@ere.umontreal.ca (Konrad HINSEN) Date: Wed, 3 Apr 1996 07:08:17 -0500 Subject: [PYTHON MATRIX-SIG] Comparisons In-Reply-To: <199604031023.MAA02513@nu.EMBL-Heidelberg.DE> (message from Rob Hooft on Wed, 3 Apr 1996 12:23:39 +0200) Message-ID: <199604031208.HAA28780@cyclone.ERE.UMontreal.CA> > > Repeatedly there has been a discussion about "<" and ">" comparisons > for Array objects. Why can that not be implemented in the "dictionary" > way? It just needs to be made recursive. Like: > > a (a[0] (a[0]==b[0] and (a[1] .... It probably can be implemented in such a way, but why? For what application would this definition be useful? ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsenk@ere.umontreal.ca Departement de chimie | Tel.: +1-514-343-6111 ext. 3953 Universite de Montreal | Fax: +1-514-343-7586 C.P. 6128, succ. Centre-Ville | Deutsch/Esperanto/English/Nederlands/ Montreal (QC) H3C 3J7 | Francais (phase experimentale) ------------------------------------------------------------------------------- ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From hinsenk@ere.umontreal.ca Wed Apr 3 13:00:17 1996 From: hinsenk@ere.umontreal.ca (Konrad HINSEN) Date: Wed, 3 Apr 1996 08:00:17 -0500 Subject: [PYTHON MATRIX-SIG] Re: [PYTHON IMAGE-SIG] ANNOUNCE: A minimal Matrix<->PIL interface In-Reply-To: <9604031142.AA10297@arnold.image.ivab.se> (message from Fredrik Lundh on Wed, 3 Apr 1996 13:42:26 +0200) Message-ID: <199604031300.IAA00757@cyclone.ERE.UMontreal.CA> > > BTW, have anyone written a 2D FFT module for the Matrix library? Or 1D, or 3D? Or, better yet, anyD? ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsenk@ere.umontreal.ca Departement de chimie | Tel.: +1-514-343-6111 ext. 3953 Universite de Montreal | Fax: +1-514-343-7586 C.P. 6128, succ. Centre-Ville | Deutsch/Esperanto/English/Nederlands/ Montreal (QC) H3C 3J7 | Francais (phase experimentale) ------------------------------------------------------------------------------- ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From Rob.Hooft@EMBL-Heidelberg.de Wed Apr 3 13:04:53 1996 From: Rob.Hooft@EMBL-Heidelberg.de (Rob Hooft) Date: Wed, 3 Apr 1996 15:04:53 +0200 Subject: [PYTHON MATRIX-SIG] Comparisons In-Reply-To: <199604031208.HAA28780@cyclone.ERE.UMontreal.CA> References: <199604031023.MAA02513@nu.EMBL-Heidelberg.DE> <199604031208.HAA28780@cyclone.ERE.UMontreal.CA> Message-ID: <199604031304.PAA24794@nu.EMBL-Heidelberg.DE> >>>>> "KH" == Konrad HINSEN writes: >> Repeatedly there has been a discussion about "<" and ">" >> comparisons for Array objects. Why can that not be implemented in >> the "dictionary" way? It just needs to be made recursive. Like: >> >> a> .... KH> It probably can be implemented in such a way, but why? For what KH> application would this definition be useful? It would allow sorting an Array of transformation matrices, which then allows some sort of binary search to see whether a certain transformation is in there. Of course, a hash value could be used as well in this case (is that implemented? Arrays are not hasheable, as they are mutable, isn't it?), but there might be other uses for comparisons. As I said I haven't even compiled the software yet, so risking that I'm quoting outdated information: I think Guido has said that there is no provision for comparisons to generate exceptions yet. The implementation I proposed might be a reasonable one to convert (a References: <199603281411.JAA26035@cyclone.ERE.UMontreal.CA> Message-ID: <199604031434.JAA05935@python.org> >>>>> "KH" == Konrad HINSEN writes: KH> The recently introduced slice notation (a:b etc.) has greatly improved KH> readability of slice indexing, but is has also lead to the disappearance KH> of the old Slice() objects (they are still there, but are not accepted KH> as indices any more) and thereby important functionality: it is no KH> longer possible to construct index expressions containing slices KH> dynamically. KH> There are basically three possible solutions: KH> 1) Make the : notation legal everywhere. That would make slice objects KH> first-class objects like anything else in Python. You could create KH> them, assign them to variables, make them elements of lists, tuples, KH> or arrays, etc. It would then make sense to make them real sequence KH> objects that can be subscripted, used in for-loops, converted to KH> lists or tuples etc. KH> 2) Reintroduce the old Slice() notation for the new slice objects. KH> The consequences would be the same as above, but with a less KH> uniform syntax. I don't really see the point of doing this. KH> 3) Keep slice objects restricted to index expressions, but create KH> some way to make them act on a dynamically specified axis. Then KH> the example given above could be handled by iteratively indexing KH> along the axes. Less elegant, but better than nothing. KH> My personal favourite is 1), and I can't see any disadvantage in KH> this. But that makes me think about why slice objects were restricted KH> to subscripts in the first place. Was there a good reason for that, or KH> was it just the desire to make the smallest possible change to Python KH> syntax? There are problems with this as I found when initially considering such a possibility. If ":" notation is allowed wherever a "test" expression can occur then there can be ambiguity with statements where ":" is used to introduce a compound statement, i.e. in "for" or "if" statements. I think that we will have to go with option (2). However, the interface to Slice() should change to duplicate ":" rather than have the old interface. Chris ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From da@maigret.cog.brown.edu Wed Apr 3 15:33:28 1996 From: da@maigret.cog.brown.edu (David Ascher) Date: Wed, 3 Apr 1996 10:33:28 -0500 (EST) Subject: [PYTHON MATRIX-SIG] Re: [PYTHON IMAGE-SIG] ANNOUNCE: A minimal Matrix<->PIL interface In-Reply-To: <199604031300.IAA00757@cyclone.ERE.UMontreal.CA> from "Konrad HINSEN" at Apr 3, 96 08:00:17 am Message-ID: <199604031533.KAA04418@maigret> > > > > BTW, have anyone written a 2D FFT module for the Matrix library? > > Or 1D, or 3D? Or, better yet, anyD? I have a module which is an interface to the fft routines used by TELA (they are basically a C translation of FFTPACK). I haven't released it because I hadn't finished porting the AnyD to 1D TELA code into Python. Since it looks like I won't have the time to do much related to Python in the next three weeks, I'm willing to let it out, with the caveat that it hasn't been tested. Does anyone know who to contact about getting permission to release a file from the tela library? I'll assume it's ok for now, but I'd like to get an official ok sometime. http://maigret.cog.brown.edu/python/fft has the files you need: fftpackmodule.c, and the fftpack files from the TELA distribution. If someone wants to finish the fft.ct -> fft.py conversion, please do, and let me know about it. I've included my first stab at the translation on the web page. --david PS: Let me know about bugs and bug fixes, of course. ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From hinsenk@ere.umontreal.ca Wed Apr 3 17:30:25 1996 From: hinsenk@ere.umontreal.ca (Konrad HINSEN) Date: Wed, 3 Apr 1996 12:30:25 -0500 Subject: [PYTHON MATRIX-SIG] Slices In-Reply-To: <199604031432.JAA07404@cyclone.ERE.UMontreal.CA> (message from Chris Chase S1A on Wed, 3 Apr 1996 09:41:26 -0500) Message-ID: <199604031730.MAA23822@cyclone.ERE.UMontreal.CA> > There are problems with this as I found when initially considering > such a possibility. If ":" notation is allowed wherever a "test" > expression can occur then there can be ambiguity with statements where > ":" is used to introduce a compound statement, i.e. in "for" or "if" > statements. I see. That's of course a good argument. > I think that we will have to go with option (2). However, the > interface to Slice() should change to duplicate ":" rather than have > the old interface. But that is rather difficult with standard function-call syntax. Another idea: introduce an object "index_expression" that can be indexed to get an equivalent expression. Then i = index_expression[2:4,...] a[i] would be equivalent to a[2:4,...] There would be no new syntax to learn; although users might have to know that index expressions are really tuples if they want to do something that is not possible with standard indexing. ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsenk@ere.umontreal.ca Departement de chimie | Tel.: +1-514-343-6111 ext. 3953 Universite de Montreal | Fax: +1-514-343-7586 C.P. 6128, succ. Centre-Ville | Deutsch/Esperanto/English/Nederlands/ Montreal (QC) H3C 3J7 | Francais (phase experimentale) ------------------------------------------------------------------------------- ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From guido@CNRI.Reston.VA.US Wed Apr 3 18:27:01 1996 From: guido@CNRI.Reston.VA.US (Guido van Rossum) Date: Wed, 03 Apr 1996 13:27:01 -0500 Subject: [PYTHON MATRIX-SIG] Slices In-Reply-To: Your message of "Wed, 03 Apr 1996 12:30:25 EST." <199604031730.MAA23822@cyclone.ERE.UMontreal.CA> References: <199604031730.MAA23822@cyclone.ERE.UMontreal.CA> Message-ID: <199604031827.NAA09584@monty> > Another idea: introduce an object "index_expression" that can be > indexed to get an equivalent expression. Then > i = index_expression[2:4,...] > a[i] > would be equivalent to > a[2:4,...] Very clever. The index_expression object would simply package all its arguments and return them as a Slice() object. Way to go! --Guido van Rossum URL: ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From jjh@Goldilocks.LCS.MIT.EDU Wed Apr 3 18:44:35 1996 From: jjh@Goldilocks.LCS.MIT.EDU (James Hugunin) Date: Wed, 3 Apr 96 13:44:35 EST Subject: [PYTHON MATRIX-SIG] Slices Message-ID: <9604031844.AA15163@baribal.LCS.MIT.EDU.LCS.MIT.EDU> From: hinsenk@ere.umontreal.ca (Konrad HINSEN) Another idea: introduce an object "index_expression" that can be indexed to get an equivalent expression. Then i = index_expression[2:4,...] a[i] would be equivalent to a[2:4,...] There would be no new syntax to learn; although users might have to know that index expressions are really tuples if they want to do something that is not possible with standard indexing. Anybody who's interested in this idea can do the following under v0.35. import Numeric index_expression = Numeric.__slice_generating_class() -Jim ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From hinsenk@ere.umontreal.ca Wed Apr 3 18:57:08 1996 From: hinsenk@ere.umontreal.ca (Konrad HINSEN) Date: Wed, 3 Apr 1996 13:57:08 -0500 Subject: [PYTHON MATRIX-SIG] Slices Message-ID: <199604031857.NAA00933@cyclone.ERE.UMontreal.CA> While putting my recent suggestion into an existing application, I noticed that a somewhat better definition is: class _index_expression_class: def __getitem__(self, item): if type(item) != type(()): return (item,) else: return item index_expression = _index_expression_class() This version always returns a tuple, even if the index is a single number. That makes it easier to write code that strings together index expressions. ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsenk@ere.umontreal.ca Departement de chimie | Tel.: +1-514-343-6111 ext. 3953 Universite de Montreal | Fax: +1-514-343-7586 C.P. 6128, succ. Centre-Ville | Deutsch/Esperanto/English/Nederlands/ Montreal (QC) H3C 3J7 | Francais (phase experimentale) ------------------------------------------------------------------------------- ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From hinsenk@ere.umontreal.ca Wed Apr 3 18:49:51 1996 From: hinsenk@ere.umontreal.ca (Konrad HINSEN) Date: Wed, 3 Apr 1996 13:49:51 -0500 Subject: [PYTHON MATRIX-SIG] Slices In-Reply-To: <199604031827.NAA09584@monty> (message from Guido van Rossum on Wed, 03 Apr 1996 13:27:01 -0500) Message-ID: <199604031849.NAA00321@cyclone.ERE.UMontreal.CA> > > Another idea: introduce an object "index_expression" that can be > > indexed to get an equivalent expression. Then > > i = index_expression[2:4,...] > > a[i] > > would be equivalent to > > a[2:4,...] > > Very clever. The index_expression object would simply package all its > arguments and return them as a Slice() object. Way to go! I actually realized that the implementation is completely trivial: class _index_expression_class: def __getitem__(self, item): return item index_expression = _index_expression_class() Now let's try it: from Numeric import * a = array([[1,2,3],[6,5,4]]) i = index_expression[..., 1:3] print i print a[i] Output: (..., Slice(1, 3, 1)) 2 3 5 4 It works! Let's just put that into Numeric and be happy... ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsenk@ere.umontreal.ca Departement de chimie | Tel.: +1-514-343-6111 ext. 3953 Universite de Montreal | Fax: +1-514-343-7586 C.P. 6128, succ. Centre-Ville | Deutsch/Esperanto/English/Nederlands/ Montreal (QC) H3C 3J7 | Francais (phase experimentale) ------------------------------------------------------------------------------- ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From hohn@math.utah.edu Wed Apr 10 03:05:30 1996 From: hohn@math.utah.edu (Michael Hohn) Date: Tue, 9 Apr 1996 20:05:30 -0600 (MDT) Subject: No subject Message-ID: <199604100205.UAA28261@blab01.math.utah.edu> help archive ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From hansbo@math.chalmers.se Sat Apr 20 23:54:32 1996 From: hansbo@math.chalmers.se (Peter Hansbo) Date: Sun, 21 Apr 1996 00:54:32 +0200 (MET DST) Subject: [PYTHON MATRIX-SIG] Whereabouts of numerical python Message-ID: <199604202254.AAA29610@monet.math.chalmers.se> Hi there! Allow me to introduce myself: I am a finite element researcher at a Swedish university. One of the projects I have been involved in is a FE GUI for teaching purposes, with automatic mesh generation and different adaptive solvers, see http://www.math.chalmers.se/Research/Femlab/femlab.html Now I have found this thing called Python, and it really makes me want to get out of the F77/F90/C/C++ straightjackets. However, speed issues force me to consider C extensions. Then I notice the work of this SIG, with promises of just 10 percent overhead in floating point arithmetic, which I can live with. My question now is just this: can I put my hands on a beta version of the numerical python? Regards Peter Hansbo ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From michael@actrix.gen.nz Sun Apr 21 00:35:30 1996 From: michael@actrix.gen.nz (Michael Hamilton) Date: Sun, 21 Apr 1996 11:35:30 +1200 (NZST) Subject: [PYTHON MATRIX-SIG] NetCDF and matrix extensions? Message-ID: I was wondering if anyone has a NetCDF module that uses the matrix extension. I made some tentative enquiries in this direction earlier, in comp.lang.python, and was pleased to see that some things were pending. Unfortunately I accidentally blew away some email when I upgraded my Linux box, so I've lost the info. So... Is anything available? I have a project that could use this stuff right now. My objective is to demonstrate a small application written using NetCDF in the next week or two? I'm quite happy to collect and build beta code - so long as it mostly works, and so long as the future changes to the matrix support won't require me to totally rewrite my code (I don't mind minor rewrites). My other alternatives are perl and Tcl, but I'd like an environment that fosters readable/maintainable scripts. Thanks. --- Michael Hamilton (Happy Linux user since 0.11) http://www.actrix.gen.nz/users/michael ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From tschwal@artinet.de Sun Apr 21 09:18:58 1996 From: tschwal@artinet.de (Tom Schwaller) Date: Sun, 21 Apr 1996 10:18:58 +0200 (MET DST) Subject: [PYTHON MATRIX-SIG] NetCDF and matrix extensions? In-Reply-To: Message-ID: Some time ago I contacted a person which made some remarks about it in the newsgroup and he told me to make it public as soon as possible. Unfortunately I do not remember his name. I suggest to post your message in the newsgroup, I'm sure we will get some answers. As far as I can see he wrote the wrapper code for the NetCFD API, nothing more. Tom (do not use et@appl-math.tu-muenchen.de anymore, I'm working for the German Linux Journal now! :-) ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From tschwal@artinet.de Sun Apr 21 09:29:02 1996 From: tschwal@artinet.de (Tom Schwaller) Date: Sun, 21 Apr 1996 10:29:02 +0200 (MET DST) Subject: [PYTHON MATRIX-SIG] Whereabouts of numerical python In-Reply-To: <199604202254.AAA29610@monet.math.chalmers.se> Message-ID: Concernig FEM stuff with Python, you should check ftp://ftp.appl-math.tu-muenchen.de/pub/et/ delaunaymodule-0.33.c.gz trimodule.tgz I once considered to pythonify femlab, but now that you are with us, you should give it a try yourself, would be very nice to have a FEM package with Python. Which needs much more design issues to be solved compared to the matrixmodule. BTW My Mail of the last 3 week (also the one from the matrix and other sigs) is lost, did I miss something? Tom German Linux Journal ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From hansbo@math.chalmers.se Mon Apr 22 13:23:47 1996 From: hansbo@math.chalmers.se (Peter Hansbo) Date: Mon, 22 Apr 1996 14:23:47 +0200 (MET DST) Subject: [PYTHON MATRIX-SIG] Numerical P. in standard dist.? Message-ID: <199604221223.OAA18644@monet.math.chalmers.se> One of the important things with Python is the excellent portability. Now, Numerical python at sls-ftp.lcs.mit.edu is a Unix-variant, which is natural, seeing as mot numerical work is done on workstations. Unfortunately I do a lot of developing on a Mac, which raises the following question: has it been decided when and if Numerical Python will be a part of the standard distribution? What timespan is to be expected? P. ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From demars@netcom.com Mon Apr 22 17:15:33 1996 From: demars@netcom.com (Dennis C. De Mars) Date: Mon, 22 Apr 1996 09:15:33 -0700 Subject: [PYTHON MATRIX-SIG] Numerical P. in standard dist.? Message-ID: >One of the important things with Python >is the excellent portability. Now, Numerical python >at sls-ftp.lcs.mit.edu is a Unix-variant, which >is natural, seeing as mot numerical work is done >on workstations. Unfortunately I do a lot of developing >on a Mac, which raises the following question: >has it been decided when and if Numerical Python will be >a part of the standard distribution? What timespan is >to be expected? I would guess that the folks who are doing this work are not going to put it into the standard distribuition until it is ready for release; right now Numerical Python is still a work in progress. (However, if there is a target date for putting this stuff into the standard distribution, I'd like to hear it too!) However, there is nothing to stop you from taking the standard distribution source (which include Mac build files) and the source for Numerical Python and creating your own build. That's what I did. BTW, the Mac version itself is in a state of flux due to changes to support Tk and Mac native system calls. However, I expect this to settle down soon and it should be possible to create a "grand unified" Mac build that supports Numerical Python _and_ Tk. - Dennis D. ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From hinsenk@ERE.UMontreal.CA Tue Apr 23 22:37:55 1996 From: hinsenk@ERE.UMontreal.CA (Konrad HINSEN) Date: Tue, 23 Apr 1996 17:37:55 -0400 Subject: [PYTHON MATRIX-SIG] Plotting with Mathematica Message-ID: <199604232137.RAA21300@cyclone.ERE.UMontreal.CA> While we are all waiting for a good plotting package for Python, I offer a simplistic, but very convenient temporary solution to those who have Mathematica and run Unix. The following module is hardly documented, not carefully designed, and completely unsupported, but it works for me. # Interface to Mathematica for plotting # # Written by Konrad Hinsen # last revision: 1996-4-23 import os, regsub, tempfile # Class representing a Mathematica process class Mathematica: def __init__(self, progname = 'math'): self.progname = progname self.script = '' self.font = "Courier" self.textsize = 10 def clear(self): self.script = '' def execute(self): scriptfile = tempfile.mktemp() file = open(scriptfile, 'w') file.write(self.script) file.close() os.system(self.progname + ' -record "" <' + scriptfile + ' >/dev/null') os.unlink(scriptfile) def command(self, command): self.script = self.script + command def backup(self, n): self.script = self.script[:-n] def defineVariable(self, name, array): self.command(name + ' = ') self.command(formatValue(array)) self.command('\n') def setFont(self, font, size): self.font = font self.textsize = size def displayOptions(self): s = 'DefaultFont->{"' + self.font + '",' + \ formatValue(self.textsize) + '}' return s def plot(self, data): s = 'Show[' for dataset in data: s = s + 'ListPlot[' + formatValue(dataset) + \ ', PlotJoined->True, DisplayFunction->Identity, ' + \ self.displayOptions() + '], ' s = s + 'DisplayFunction->$DisplayFunction]\n' self.command(s) def contourPlot(self, xaxis, yaxis, data, contours=None): s = 'Show[ContourGraphics[' + formatValue(data.transpose()) \ + ', MeshRange->' \ + formatValue([[xaxis[0], xaxis[-1]], [yaxis[0], yaxis[-1]]]) \ + ', ContourShading->False' if contours: s = s + ', Contours->' + formatValue(contours) s = s + ', ' + self.displayOptions() + ']]\n' self.command(s) # Format scalars, arrays, and nested lists for Mathematica def formatValue(x): is_sequence = 1 try: x[0] except: is_sequence = 0 if is_sequence: s = '{' for e in x: s = s + formatValue(e) + ', ' s = s[:-2] + '}' else: if type(x) == type(''): s = '"' + x + '"' elif type(x) == type(0): s = `x` elif type(x) == type(0.): s = regsub.sub('e','*10^', `x`) elif type(x) == type(0.j): s = '(' + regsub.sub('e','*10^', `x.real`) + \ '+' + regsub.sub('e','*10^', `x.imag`) + 'I)' else: raise TypeError, 'Unknown type ' + `type(x)` return s # Simple plot functions def plot(*data): m = Mathematica() m.plot(data) m.execute() def contourPlot(xaxis, yaxis, data, contours=None): m = Mathematica() m.contourPlot(xaxis, yaxis, data, contours) m.execute() # These examples are all the documentation you will get! if __name__ == '__main__': from Numeric import * from umath import * plot([4,6,5,3]) plot([(3,6.8),(4,4.2),(5,0.5)]) x = arange(10) y = arange(15) data = x[:, NewAxis]*sin(y/2.) contourPlot(x, y, data, arange(0.,10.,0.1)) ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsenk@ere.umontreal.ca Departement de chimie | Tel.: +1-514-343-6111 ext. 3953 Universite de Montreal | Fax: +1-514-343-7586 C.P. 6128, succ. Centre-Ville | Deutsch/Esperanto/English/Nederlands/ Montreal (QC) H3C 3J7 | Francais (phase experimentale) ------------------------------------------------------------------------------- ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From steve@estel.uindy.edu Wed Apr 24 16:30:23 1996 From: steve@estel.uindy.edu (Steve Spicklemire) Date: Wed, 24 Apr 96 10:30:23 -0500 Subject: [PYTHON MATRIX-SIG] URNG module.... Message-ID: <9604241530.AA00917@estel.uindy.edu> Hi folkx, I was trying to use the MLab.py stuff and I realized I needed the URNG module for part of it... (well I suppose I could cut that out.. but I thought I'd try here first..). Upon trying to build URNG on my NeXT 3.2 system I get: ld: Undefined symbols: _drand48 _seed48 _lcong48 *** Exit 1 Stop. *** Exit 1 Stop. Where can I find these.. is there more source I need to get? thanks, -steve ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From tim@lassi.ece.uiuc.edu Wed Apr 24 22:54:13 1996 From: tim@lassi.ece.uiuc.edu (tim@lassi.ece.uiuc.edu) Date: Wed, 24 Apr 1996 16:54:13 -0500 Subject: [PYTHON MATRIX-SIG] strange slice behaviour Message-ID: <199604242157.RAA16303@python.org> I just recently subscribed to the matrix-sig, so I appologize if this has gone over allready (I've tried to look over the archive, but its rather large.) Thanks to everyone for putting Numerical Python together - it looks great. I have a 2D array and I slice it, it works fine for non-zero length slices, but behaves strangely (IMHO) for zero length slices. It works fine for 1D arrays though... >>> from Numeric import * >>> a = array([[1,2,3],[4,5,6],[7,8,9]]) >>> a 1 2 3 4 5 6 7 8 9 >>> a[0:2,1] # OK 2 5 >>> a[0:1,1] # OK 2 >>>>>> a[0:0,1] # This is strange !!! 2 5 8 >>> b = array([1,2,3]) >>> b 1 2 3 >>> b[0:0] # Oops this breaks the PrettyPrinter Traceback (innermost last): File "", line 1, in ? File "/usr/local/lib/python/numeric/PrettyPrinter.py", line 28, in arrayToString max_str_len = max(len(str(maximum.reduce(data))), ArrayError: can't take anything from an empty array >>> >>> b[0:0].shape # This gives what I'd expect. (0,) Is this the expected behaviour? If it is, does anyone know of a nice workaround to get the behaviour I'd expect (i.e., a zero size matrix)? Thanks, -- -tim +--------------------------------------------------------------------+ | Tim Hochberg Ultrahigh Speed Digital Electronics Lab | | tim@lassi.ece.uiuc.edu University of Illinois | | http://dogbert.ece.uiuc.edu/~tim (217) 333-6014 | +--------------------------------------------------------------------+ ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From hinsenk@ERE.UMontreal.CA Wed Apr 24 22:27:56 1996 From: hinsenk@ERE.UMontreal.CA (Konrad HINSEN) Date: Wed, 24 Apr 1996 17:27:56 -0400 Subject: [PYTHON MATRIX-SIG] FFT Message-ID: <199604242127.RAA20328@cyclone.ERE.UMontreal.CA> Does anyone have a working 1-d FFT package? I have to calculate the autocorrelation of long time series, and the "straightforward" approach is much too slow for me. ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsenk@ere.umontreal.ca Departement de chimie | Tel.: +1-514-343-6111 ext. 3953 Universite de Montreal | Fax: +1-514-343-7586 C.P. 6128, succ. Centre-Ville | Deutsch/Esperanto/English/Nederlands/ Montreal (QC) H3C 3J7 | Francais (phase experimentale) ------------------------------------------------------------------------------- ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From mundkur@ece.uci.edu Wed Apr 24 23:57:39 1996 From: mundkur@ece.uci.edu (Prashanth Mundkur) Date: Wed, 24 Apr 1996 15:57:39 -0700 (PDT) Subject: [PYTHON MATRIX-SIG] strange slice behaviour In-Reply-To: <199604242157.RAA16303@python.org> Message-ID: I just subscribed to this list yesterday, but I haven't been yet been able to locate the Numeric module. Where do I find it, along with the install instructs? Thanks for any help. --prashanth ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From hinsenk@ERE.UMontreal.CA Wed Apr 24 23:56:58 1996 From: hinsenk@ERE.UMontreal.CA (Konrad HINSEN) Date: Wed, 24 Apr 1996 18:56:58 -0400 Subject: [PYTHON MATRIX-SIG] strange slice behaviour In-Reply-To: <199604242157.RAA16303@python.org> (tim@lassi.ece.uiuc.edu) Message-ID: <199604242256.SAA27372@cyclone.ERE.UMontreal.CA> > I have a 2D array and I slice it, it works fine for non-zero length > slices, but behaves strangely (IMHO) for zero length slices. It works > fine for 1D arrays though... There are many operations that don't work correctly with empty arrays at the moment. Just wait... ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsenk@ere.umontreal.ca Departement de chimie | Tel.: +1-514-343-6111 ext. 3953 Universite de Montreal | Fax: +1-514-343-7586 C.P. 6128, succ. Centre-Ville | Deutsch/Esperanto/English/Nederlands/ Montreal (QC) H3C 3J7 | Francais (phase experimentale) ------------------------------------------------------------------------------- ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From hohn@math.utah.edu Thu Apr 25 00:36:29 1996 From: hohn@math.utah.edu (Michael Hohn) Date: Wed, 24 Apr 1996 17:36:29 -0600 (MDT) Subject: [PYTHON MATRIX-SIG] matlab loading/saving Message-ID: <199604242336.RAA21348@blab02.math.utah.edu> After being unable to find a MATLAB binary file load routine, I have started writing one to handle dense matrices. If someone has already done this, please let me know :) Thanks. Mike ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From jjh@Goldilocks.LCS.MIT.EDU Thu Apr 25 21:39:39 1996 From: jjh@Goldilocks.LCS.MIT.EDU (James Hugunin) Date: Thu, 25 Apr 96 16:39:39 EDT Subject: [PYTHON MATRIX-SIG] Release 0.36 is available! Message-ID: <9604252039.AA14995@baribal.LCS.MIT.EDU.LCS.MIT.EDU> Release 0.36 of the numerical extension to python is available at: ftp://sls-ftp.lcs.mit.edu/pub/jjh/NumericalPython-0.36.tar.gz There is no patch available for this release for several minor reasons. My apologies to overseas users for the size. If somebody would like to make this available in Europe/Asia, that would be welcome. New in this release: Numerous small bug fixes. This should now compile on Windows and Macintosh platforms. Added functions argsort, and position. Surely you don't want documentation? The TestSuite works again! Enjoy - Jim ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From jjh@Goldilocks.LCS.MIT.EDU Thu Apr 25 22:06:50 1996 From: jjh@Goldilocks.LCS.MIT.EDU (James Hugunin) Date: Thu, 25 Apr 96 17:06:50 EDT Subject: [PYTHON MATRIX-SIG] FAQ Message-ID: <9604252106.AA15086@baribal.LCS.MIT.EDU.LCS.MIT.EDU> Here's my first step at creating a FAQ for this project. If anybody else wants to take it up, please feel free. This is going to be very free form, off the top of my head and unedited. Still, I anticipate that it will be useful. Occaionally I will steal text entirely from other people on the SIG without any attribution. I'll try to fix this later. Written by Jim Hugunin (hugunin@mit.edu) on April 25, 1996. 1) What's Numerical Python? Here should really go Paul's humorous depiction of Monty's more serious brother, but I don't have that right now, so the high level stuff will have to wait. 2) Where do I get it? ftp://sls-ftp.lcs.mit.edu/pub/jjh/NumericalPython-0.36.tar.gz This is the latest version. New versions will be made available at this location. 3) Is there any documentation? There's incomplete online documentation written by David Ascher for a course he taught using Numerical Python at: http://maigret.cog.brown.edu/python/arraytut.html There's a paper soon to be published in Computers and Physics written by Dubois, Hinsen and Hugunin at: ftp://ftp-icf.llnl.gov/pub/basis/numerical_python.ps There's my talk from the 3rd python workshop at: http://www.python.org/workshops/1995-12/papers/hugunin.html 4) What modules are available that use Numerical python? (Note: I know that this needs pointers, I just don't have the time to put them together today) Tom Schwaller's delaunaymodule and trimodule Tom's and my opengl, glu, and glut modules Paul DuBois' URNGmodule Doug Heisterkamp's interface to the LAPACK libraries at: ftp://ftp.cs.unl.edu/pub/drh/python/pylapack.0.02.tar.gz 5) What are the future plans? First goal is a general release to the python community. Before this happens, I want a somewhat finalized API (which Konrad seems to have provided) implemented (for which I just need some free time). I don't want to have too many users developing code with the system before the API is at least closer to its final form (to minimize the changes they need to make). On the other hand, the C API is essentially final. I'm perfectly willing to guarantee that I won't introduce any major incompatibilities in subsequent release of the system. This means that people have no excuse not to develop modules to interface to all that great C/FORTRAN numerical code out there. Obviously the ultimate goal is to have this a part of the base python distribution. I'll start thinking more about this once I make the general release to the community at large. 6) Hints for Windows Users You must use binary mode files for pickling and unpickling matrices in the windows world. Blame Bill for the silliness. ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From Rob.Hooft@EMBL-Heidelberg.de Fri Apr 26 10:11:25 1996 From: Rob.Hooft@EMBL-Heidelberg.de (Rob Hooft) Date: Fri, 26 Apr 1996 11:11:25 +0200 Subject: [PYTHON MATRIX-SIG] Release 0.36 is available! In-Reply-To: <9604252039.AA14995@baribal.LCS.MIT.EDU.LCS.MIT.EDU> References: <9604252039.AA14995@baribal.LCS.MIT.EDU.LCS.MIT.EDU> Message-ID: <199604260911.LAA17540@nu.EMBL-Heidelberg.DE> >>>>> "JH" == James Hugunin writes: JH> ftp://sls-ftp.lcs.mit.edu/pub/jjh/NumericalPython-0.36.tar.gz JH> If somebody would like to make this available in Europe/Asia, JH> that would be welcome. I copied the whole directory as soon as I could get through (even from New York at 6 in the morning that was not an easy task). Now as a special offer to European members of the matrix-sig list, it is available from: ftp://swift.embl-heidelberg.de/pub/Numeric/ Please note that this is NOT an automatic mirror! Regards, -- === Rob.Hooft@EMBL-Heidelberg.DE http://www.Sander.EMBL-Heidelberg.DE/rob/ == ==== In need of protein modeling? http://www.Sander.EMBL-Heidelberg.DE/whatif/ Validation of protein structures? http://biotech.EMBL-Heidelberg.DE:8400/ ==== ================ Long Live Linux! Free Software Rules The World! ============= ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From friedric@rose.rsoc.rockwell.com Fri Apr 26 16:53:53 1996 From: friedric@rose.rsoc.rockwell.com (Robin Friedrich) Date: Fri, 26 Apr 1996 10:53:53 -0500 Subject: [PYTHON MATRIX-SIG] FAQ Message-ID: <199604261553.KAA18756@darwin.rsoc.rockwell.com> Hi Jim, Whipped up this little script to htmlize your FAQ. Thought you might like it. #!/bin/env python # Script to htmlize Jim's FAQ. Might be generally useful though. import regsub, regex, sys try: file = sys.argv[1] except IndexError: print 'Usage: '+sys.argv[0]+' filename' print 'The processed file will have the same name with a .html suffix added.' outname = file+'.html' out = open(outname, 'w') httppat = regex.compile('\(http:[^ \n]+\)') ftppat = regex.compile('\(ftp:[^ \n]+\)') mailpat = regex.compile('\(\w+@[^ ()\n]+\)') headpat = regex.compile('\(^[0-9]+).*$\)') trailpat = regex.compile('\([^ ]$\)') text = open(file).read() out.write('Numerical Python FAQ\n') #change this to taste out.write('\n') text = regsub.gsub(httppat, '\\1', text) text = regsub.gsub(ftppat, '\\1', text) text = regsub.gsub(mailpat, '\\1', text) text = regsub.gsub(headpat, '

\\1

', text) text = regsub.gsub('\n\n', '\n

', text) text = regsub.gsub(trailpat, '\\1 ', text) out.write(text) out.write('\n\n') print 'Done. Output may be found in '+outname ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org ================= From hinsenk@ERE.UMontreal.CA Fri Apr 26 15:43:46 1996 From: hinsenk@ERE.UMontreal.CA (Konrad HINSEN) Date: Fri, 26 Apr 1996 10:43:46 -0400 Subject: [PYTHON MATRIX-SIG] FAQ In-Reply-To: <9604252106.AA15086@baribal.LCS.MIT.EDU.LCS.MIT.EDU> (message from James Hugunin on Thu, 25 Apr 96 17:06:50 EDT) Message-ID: <199604261443.KAA09879@cyclone.ERE.UMontreal.CA> > 4) What modules are available that use Numerical python? > > (Note: I know that this needs pointers, I just don't have the time to > put them together today) ... I have a couple of Python modules using arrays/umath, and I bet I am not the only one. Maybe it would be a good idea to start a collection somewhere. Even if the API is not final yet, this would be useful to 1) Have useful code right now 2) Prevent duplicated development effort 3) Provide examples to newcomers to this SIG In the first public release this code could then appear as examples. My current collection of modules of general interest is: Derivatives.py Automatic derivatives; uses umath, but no arrays (yet). Interpolation.py Represents functions defined by numerical values on a grid. Provides linear interpolation, differentiation, and integration. LeastSquares.py Levenberg-Marquardt algorithm to find a least-squares solution for nonlinear problems. PhysicalQuantities.py Represents physical quantities with units; handles mixed-unit arithmetic and unit conversion. Uses umath, but not arrays. Vector.py 3D geometrical vectors, uses umath. A version based on arrays exists, but makes sense only when arrays of general objects work reliably (I have to test that with the new release). Special-interest code: G90Output.py Extracts information from output files of Gaussian 90. Potential.py Automatic calculation of first and second derivatives for potential functions. wham.py Calculates a potential of mean force from umbrella sampling data; works for arbitrary number of variables. All of these have been used for real-life applications and can be considered working, although as always there is absolutely no warranty... ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsenk@ere.umontreal.ca Departement de chimie | Tel.: +1-514-343-6111 ext. 3953 Universite de Montreal | Fax: +1-514-343-7586 C.P. 6128, succ. Centre-Ville | Deutsch/Esperanto/English/Nederlands/ Montreal (QC) H3C 3J7 | Francais (phase experimentale) ------------------------------------------------------------------------------- ================= MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org =================