From Sidey Timmins Tue Oct 17 18:07:16 2000 From: Sidey Timmins (Sidey Timmins) Date: Tue, 17 Oct 2000 13:07:16 -0400 (EDT) Subject: [Matrix-SIG] How to a la IDL, TV, matrix_array Message-ID: <200010171707.NAA16554@forest.gsfc.nasa.gov> Hi: As a new pythoner I am very impressed with Numpy. But surely you can (via Tkinter) display a raster matrix easily. (I dont want to write a file and then display a jpeg etc with the imaging lib) How do you display the matrix on the Numpy Topic guide page ? (http://www.python.org/topics/scicomp/numpy.html): >>> from Numeric import * # load NumPy >>> xs = arange(-6, 6, .02) # create X indices >>> ys = arange(-6, 6, .02)[:,NewAxis] # create Y indices >>> sinx = sin(xs) # sin() on each element of xs >>> yx = cos(ys)*exp(-ys*ys/18.0) # same sort of thing >>> zx = xs * xs # elementwise multiplication which results in an array zx which looks something like: ????? Sidey Timmins Code 923, Biospheric Sciences NASA/GSFC Greenbelt Md From ransom@cfa.harvard.edu Tue Oct 17 18:43:07 2000 From: ransom@cfa.harvard.edu (Scott Ransom) Date: Tue, 17 Oct 2000 13:43:07 -0400 Subject: [Matrix-SIG] How to a la IDL, TV, matrix_array References: <200010171707.NAA16554@forest.gsfc.nasa.gov> Message-ID: <39EC8FAB.E559A176@cfa.harvard.edu> Sidey Timmins wrote: > > As a new pythoner I am very impressed with Numpy. > But surely you can (via Tkinter) display a raster matrix easily. > (I dont want to write a file and then display a jpeg etc with the imaging ... > which results in an array zx which looks something like: Hi Sidey, One option (especially since you work at NASA where PGPLOT is certainly installed) is to use the ppgplot and Pgplot modules available from here: ftp://cfa-ftp.harvard.edu/pub/ransom/ The ppgplot library wraps PGPLOT, and Pgplot is an easy-to-use set of Python procedures to do interactive plotting (ala IDL). In your case you would simply do: from Pgplot import * plot2d(zx) to get a plot in an X-window Postscript output, contours, different color schemes, labeling, etc., are only keywords away. There are other options, of course, see this page for a list: http://www.python.org/topics/scicomp/plotting.html Hope this helps, Scott -- Scott M. Ransom Address: Harvard-Smithsonian CfA Phone: (617) 495-4142 60 Garden St. MS 10 email: ransom@cfa.harvard.edu Cambridge, MA 02138 GPG Fingerprint: 06A9 9553 78BE 16DB 407B FFCA 9BFA B6FF FFD3 2989 From cgw@fnal.gov Tue Oct 17 18:50:39 2000 From: cgw@fnal.gov (Charles G Waldman) Date: Tue, 17 Oct 2000 12:50:39 -0500 (CDT) Subject: [Matrix-SIG] How to a la IDL, TV, matrix_array In-Reply-To: <39EC8FAB.E559A176@cfa.harvard.edu> References: <200010171707.NAA16554@forest.gsfc.nasa.gov> <39EC8FAB.E559A176@cfa.harvard.edu> Message-ID: <14828.37231.409962.745221@buffalo.fnal.gov> Scott Ransom writes: > Sidey Timmins wrote: > > > > As a new pythoner I am very impressed with Numpy. > > But surely you can (via Tkinter) display a raster matrix easily. > > (I dont want to write a file and then display a jpeg etc with the imaging > ... > > which results in an array zx which looks something like: If you install install PIL (Python Imaging Library) you can easily do this using the "tostring" and "fromstring" functions. Search the archives, I believe this has been discussed before. From mmiller3@iupui.edu Tue Oct 17 22:02:03 2000 From: mmiller3@iupui.edu (Michael A. Miller) Date: 17 Oct 2000 16:02:03 -0500 Subject: [Matrix-SIG] How to a la IDL, TV, matrix_array In-Reply-To: Sidey Timmins's message of "Tue, 17 Oct 2000 13:07:16 -0400 (EDT)" References: <200010171707.NAA16554@forest.gsfc.nasa.gov> Message-ID: <87u2abji5w.fsf@lumen.med.iupui.edu> >>>>> "Sidey" == Sidey Timmins writes: > How do you display the matrix on the Numpy Topic guide > page? Look for the NumTut package: >>> Import NumTut >>> NumTut.view(zx) The NumTut link at http://www.python.org/topics/scicomp/documentation.html is broken. Does anyone know where it can be found these days? I can tar up a copy of what I've got if anyone whants it. Mike -- Michael A. Miller mmiller3@iupui.edu Krannert Institute of Cardiology, IU School of Medicine Indiana Center for Vascular Biology and Medicine