[Matplotlib-users] tk_agg plotting error when using legend()
Hi, I'm running into the following error: findfont: Matching :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium to Bitstream Vera Sans (/usr/X11R6/lib/X11/fonts/TTF/Vera.ttf) with score of 0.00 Found dvipng version 1.11 findfont: Matching :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=large to Bitstream Vera Sans (/usr/X11R6/lib/X11/fonts/TTF/Vera.ttf) with score of 0.00 Exception in Tkinter callback Traceback (most recent call last): File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk/Tkinter.py, line 1410, in __call__ return self.func(*args) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py, line 212, in resize self.show() File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py, line 215, in draw FigureCanvasAgg.draw(self) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_agg.py, line 388, in draw self.figure.draw(self.renderer) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py, line 55, in draw_wrapper draw(artist, renderer, *kl) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py, line 772, in draw for a in self.axes: a.draw(renderer) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py, line 55, in draw_wrapper draw(artist, renderer, *kl) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axes.py, line 1760, in draw a.draw(renderer) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py, line 55, in draw_wrapper draw(artist, renderer, *kl) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/legend.py, line 389, in draw self._legend_box.draw(renderer) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py, line 240, in draw c.draw(renderer) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py, line 240, in draw c.draw(renderer) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py, line 240, in draw c.draw(renderer) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py, line 240, in draw c.draw(renderer) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py, line 504, in draw c.draw(renderer) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py, line 55, in draw_wrapper draw(artist, renderer, *kl) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/lines.py, line 530, in draw drawFunc(renderer, gc, tpath, affine.frozen()) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/lines.py, line 866, in _draw_lines self._lineFunc(renderer, gc, path, trans) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/lines.py, line 917, in _draw_dashed renderer.draw_path(gc, path, trans) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_agg.py, line 117, in draw_path self._renderer.draw_path(gc, path, transform, rgbFace) TypeError: float() argument must be a string or a number Exception in Tkinter callback Traceback (most recent call last): File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk/Tkinter.py, line 1410, in __call__ return self.func(*args) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py, line 212, in resize self.show() File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py, line 215, in draw FigureCanvasAgg.draw(self) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_agg.py, line 388, in draw self.figure.draw(self.renderer) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py, line 55, in draw_wrapper draw(artist, renderer, *kl) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py, line 772, in draw for a in self.axes: a.draw(renderer) File
Re: [Matplotlib-users] Segmentation fault using imshow on large image
Yep, I'm running on a 64 bit machine. I've been dealing with larger than 4GB data files in IDL, but I'd rather use python/numpy/matplotlib if possible. Here's the gdb session. The error didn't happen in imshow, only when I specified show(); I guess that means I must have had ioff() set although I don't think that was my default choice last time I used matplotlib. milkyway /data/glimpseii $ gdb /usr/local/python/bin/python GNU gdb Red Hat Linux (6.3.0.0-1.159.el4rh) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type show copying to see the conditions. There is absolutely no warranty for GDB. Type show warranty for details. This GDB was configured as x86_64-redhat-linux-gnu...Using host libthread_db library /lib64/tls/libthread_db.so.1. (gdb) run Starting program: /usr/local/python/bin/python [Thread debugging using libthread_db enabled] [New Thread 182900715072 (LWP 18039)] Python 2.5 (r25:51908, Dec 22 2006, 16:08:43) [GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] on linux2 Type help, copyright, credits or license for more information. import matplotlib,scipy,numpy,pyfits from pylab import * f = pyfits.open('GLM_00600+_mosaic_I3.fits') imshow(f[0].data) matplotlib.image.AxesImage object at 0x2aa3f45890 show() Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 182900715072 (LWP 18039)] 0x002aa3170ab5 in _image_module::fromarray (this=Variable this is not available. ) at src/image.cpp:872 872 src/image.cpp: No such file or directory. in src/image.cpp Current language: auto; currently c++ (gdb) I've never used gdb before, so is there anything else I should be doing at this point? Thanks, Adam On Fri, Apr 24, 2009 at 7:52 AM, Michael Droettboom md...@stsci.edu wrote: On my machine (32-bit Fedora 10 with 2GB RAM), it chugs along swapping for a lng time and then fails with a Python MemoryError exception -- which is at least reasonable. I suspect you're running on a 64-bit machine and we're running into some sort of non-64-bit-clean issue. We try to be 64-bit clean, but it doesn't get verified on a regular basis, and not all of us (myself included) are running 64-bit OSes. Can you try running python inside of gdb and getting a traceback? That might provide some clues. We can estimate a little bit as to the memory requirements -- though it's hard to account for everything. Input array is (10370, 9320) x 4 = 386MB This array is always converted to doubles to convert to colors (this is probably a place ripe for opimtization) so you get also 786MB. Then this gets converted to an RGBA array for another 386MB Mike Adam Ginsburg wrote: Hi, I've been getting a segmentation fault when trying to display large images. A transcript of a sample session is below. I'm using the TkAgg backend, and I am using numpy, but otherwise I have made no modifications to the matplotlib setup. milkyway /data/glimpseii $ alias pylab alias pylab='/usr/local/adm/config/python/bin/ipython -pylab -log' milkyway /data/glimpseii $ pylab Activating auto-logging. Current session state plus future input saved. Filename : ipython_log.py Mode : rotate Output logging : False Raw input log : False Timestamping : False State : active Python 2.5 (r25:51908, Dec 22 2006, 16:08:43) Type copyright, credits or license for more information. IPython 0.9.1 -- An enhanced Interactive Python. ? - Introduction and overview of IPython's features. %quickref - Quick reference. help - Python's own help system. object? - Details about 'object'. ?object also works, ?? prints more. Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: import matplotlib,pyfits,numpy,scipy In [2]: scipy.__version__ Out[2]: '0.7.0' In [3]: numpy.__version__ Out[3]: '1.3.0' In [4]: matplotlib.__version__ Out[4]: '0.98.5.2' In [5]: f = pyfits.open('GLM_00600+_mosaic_I3.fits') In [6]: f[0].data.shape Out[6]: (10370, 9320) In [7]: f[0].data.dtype Out[7]: dtype('f4') In [8]: imshow(f[0].data) Segmentation fault Any ideas? Thanks, Adam -- Crystal Reports #45; New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty#45;free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Segmentation fault using imshow on large image
A 1x1 array reproduces the error: milkyway /data/glimpseii $ gdb /usr/local/python/bin/python GNU gdb Red Hat Linux (6.3.0.0-1.159.el4rh) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type show copying to see the conditions. There is absolutely no warranty for GDB. Type show warranty for details. This GDB was configured as x86_64-redhat-linux-gnu...Using host libthread_db library /lib64/tls/libthread_db.so.1. (gdb) run Starting program: /usr/local/python/bin/python [Thread debugging using libthread_db enabled] [New Thread 182900715072 (LWP 19947)] Python 2.5 (r25:51908, Dec 22 2006, 16:08:43) [GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] on linux2 Type help, copyright, credits or license for more information. from pylab import * x=rand(1,1) imshow(x) matplotlib.image.AxesImage object at 0x2a9f532390 show() Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 182900715072 (LWP 19947)] 0x002a9eac7ab5 in _image_module::fromarray (this=Variable this is not available. ) at src/image.cpp:872 872 src/image.cpp: No such file or directory. in src/image.cpp Current language: auto; currently c++ (gdb) Could you try and create an image using random data that is the same dimensions and datatype as the fits data you are using htat replicates the segfault, so we can try and reproduce the error as well as add it to our test suite? Thanks JDH -- Crystal Reports #45; New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty#45;free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Segmentation fault using imshow on large image
Hi, I've been getting a segmentation fault when trying to display large images. A transcript of a sample session is below. I'm using the TkAgg backend, and I am using numpy, but otherwise I have made no modifications to the matplotlib setup. milkyway /data/glimpseii $ alias pylab alias pylab='/usr/local/adm/config/python/bin/ipython -pylab -log' milkyway /data/glimpseii $ pylab Activating auto-logging. Current session state plus future input saved. Filename : ipython_log.py Mode : rotate Output logging : False Raw input log : False Timestamping : False State : active Python 2.5 (r25:51908, Dec 22 2006, 16:08:43) Type copyright, credits or license for more information. IPython 0.9.1 -- An enhanced Interactive Python. ? - Introduction and overview of IPython's features. %quickref - Quick reference. help - Python's own help system. object? - Details about 'object'. ?object also works, ?? prints more. Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: import matplotlib,pyfits,numpy,scipy In [2]: scipy.__version__ Out[2]: '0.7.0' In [3]: numpy.__version__ Out[3]: '1.3.0' In [4]: matplotlib.__version__ Out[4]: '0.98.5.2' In [5]: f = pyfits.open('GLM_00600+_mosaic_I3.fits') In [6]: f[0].data.shape Out[6]: (10370, 9320) In [7]: f[0].data.dtype Out[7]: dtype('f4') In [8]: imshow(f[0].data) Segmentation fault Any ideas? Thanks, Adam -- Crystal Reports #45; New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty#45;free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Returning contour points as an array
Hi, I'm trying to use the values of a contour plot to evaluate the min/max along a given axis in order to marginalize a 2d distribution. This effectively amounts to doing the same thing asked for in this post: http://sourceforge.net/mailarchive/message.php?msg_id=47505681.8030306%40hawaii.edu I think there's an easier way to do this: val = contour(xRange,yRange,delchi2,[1]) t = asarray(val.collections[0].get_verts()) because the example given in the above post actually return a list, not a numpy array (unless I did it wrong). However, even though the above works, it was poorly documented and took about an hour of googling / guess-and-checking to get to it. Either the documentation should be improved a little (e.g. explain what collections really means) or some more transparent means of returning the contour data should be available. So, the question: is there any easier way to do the above? Is this actually the easy method? Thanks, Adam - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users