Re: [Matplotlib-users] Limits with errorbar
Hi Paul, 2011/2/1 Paul Ivanov pivanov...@gmail.com I'm not sure what you're hoping to see, but you should either use xerr with xuplims, or yerr with uplims. Thank you for the reply. As usually I checked everything except the correct one. By the way, if one uses (by error) yerr and xuplims/xlolims or xerr and uplims/lolims, no error bar shows up. Is this a bug or a feature? Cheers, Fra -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plots do not scale to size
Hi, I'd very much vote for such a feature, too. It's absolutely not foolproof currently the way it is :( What I find weird, too, is that while everthing fits on the canvas for PDF output, the left side is cropped for PNG. ´ Best regards, Daniel 2011/2/1 Paul Anton Letnes wrote: On 10. juni 2009, at 14.53, John Hunter wrote: On Wed, Jun 10, 2009 at 1:58 AM, Paul Anton Letnes wrote: This _must_ be a bug. Consider the following: ## import matplotlib No it is not a bug -- mpl is doing what you tell it to do. Consider figure() subplot(111) plot([1,2,3]) xlabel('hi mom', fontsize=100) Each command has precise meaning -- the fig creates a figure using the default size, the subplot occupies a fraction of that figure according to the default ratios in the subplots_adjust parameters, and the xlabel makes a label at an indicated physical size. You may not be explicitly setting those sizes, but they are all defined via defaults in the matplotlibrc. We try and make mpl do what you tell it to do, not to try and out-smart you and do what we think you are telling it to do. Now I definitely support the idea that we should have a *feature* to auto-adjust the subplots_adjust params and fontsizes so that it just works more often. But this should be an optional feature so the user who wants to express their intent clearly will not constantly be stymied by mpl adjusting the sizes. Michael Droettboom has worked on it and it is a difficult problem to get right. JDH I don't mean to bother people with this question again, but has anyone implemented this auto-adjust feature that John was talking about? It would be nice not having to adjust matplotlib.rcParams['figure.subplot.left'] (and friends) in every plot script, or alternatively, through a clever hierarchy of matplotlibrc files. By the way: kudos to matplotlib in every other respect! Cheers Paul -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] plot_wireframe
Just trying to get familiar with mplot3d's functions, and I've run into a problem with plot_wireframe that I'm having problems running down (or duplicating, for that matter). I'm trying to generate plots of some wavelet functions, so I need to plot values against time and scale. I've generated three numpy arrays: X (time), Y (scale) (generated these using meshgrid), and Z (values, a rather sparse matrix). I verified that all of these are the same shape (7x100) by fetching the 'shape' attribute from X,Y,Z. However, when I call plot_wireframe(), I get this error: Exception in Tkinter callback Traceback (most recent call last): File C:\Python26\lib\lib-tk\Tkinter.py, line 1410, in __call__ return self.func(*args) File C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 212, in resize self.show() File C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 215, in draw FigureCanvasAgg.draw(self) File C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py, line 314, in draw self.figure.draw(self.renderer) File C:\Python26\Lib\site-packages\matplotlib\artist.py, line 46, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\Python26\lib\site-packages\matplotlib\figure.py, line 773, in draw for a in self.axes: a.draw(renderer) File C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py, line 135, in draw for col in self.collections] File C:\Python26\Lib\site-packages\mpl_toolkits\mplot3d\art3d.py, line 163, in do_3d_projection self._segments3d] File C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\proj3d.py, line 211, in proj_trans_points return proj_transform(xs, ys, zs, M) File C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\proj3d.py, line 193, in proj_transform vec = vec_pad_ones(xs, ys, zs) File C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\proj3d.py, line 184, in vec_pad_ones vec = np.array([xs,ys,zs,np.ones((len(xs)))]) ValueError: setting an array element with a sequence. Any suggestions as to what the problem might be? As I said, I'm having problems duplicating it in toy programs. Thanks in advance. /s/ Pat -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot_wireframe
On Wed, Feb 2, 2011 at 1:16 PM, Patton Bradford patbradfo...@att.netwrote: Just trying to get familiar with mplot3d's functions, and I've run into a problem with plot_wireframe that I'm having problems running down (or duplicating, for that matter). I'm trying to generate plots of some wavelet functions, so I need to plot values against time and scale. I've generated three numpy arrays: X (time), Y (scale) (generated these using meshgrid), and Z (values, a rather sparse matrix). I verified that all of these are the same shape (7x100) by fetching the 'shape' attribute from X,Y,Z. However, when I call plot_wireframe(), I get this error: Exception in Tkinter callback Traceback (most recent call last): File C:\Python26\lib\lib-tk\Tkinter.py, line 1410, in __call__ return self.func(*args) File C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 212, in resize self.show() File C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 215, in draw FigureCanvasAgg.draw(self) File C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py, line 314, in draw self.figure.draw(self.renderer) File C:\Python26\Lib\site-packages\matplotlib\artist.py, line 46, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\Python26\lib\site-packages\matplotlib\figure.py, line 773, in draw for a in self.axes: a.draw(renderer) File C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py, line 135, in draw for col in self.collections] File C:\Python26\Lib\site-packages\mpl_toolkits\mplot3d\art3d.py, line 163, in do_3d_projection self._segments3d] File C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\proj3d.py, line 211, in proj_trans_points return proj_transform(xs, ys, zs, M) File C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\proj3d.py, line 193, in proj_transform vec = vec_pad_ones(xs, ys, zs) File C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\proj3d.py, line 184, in vec_pad_ones vec = np.array([xs,ys,zs,np.ones((len(xs)))]) ValueError: setting an array element with a sequence. Any suggestions as to what the problem might be? As I said, I'm having problems duplicating it in toy programs. Thanks in advance. /s/ Pat Pat, plot_wireframe (and plot_surface as well) can be very tricky to use. Typically, the way to go about it is through a parametric approach. For example, if I wanted a wireframe of a sphere, I would create two arrays of u and v (azimuth and elevation) and use that to create x, y, z (assuming constant r). The key to making these surfaces work is that the order of the array elements is very important because the plotting function uses this information to link up neighboring points. Could you please post a self-contained version of your code that demonstrates the problem? Ben Root -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Trouble with imshow
Hello All, I'm very new to python, so bear with me. I'd like to use python to do my image processing, but I'm running into behavior that doesn't make sense to me. I'm using Windows 7 Pro (64-bit) with 4 gigs of memory, python 2.6.6, and the newest versions of ipython, pyfits, matplotlib (1.0.1), numpy (1.5.1), scipy. I'm loading in a fits file that's 26 MB (~16 Mpixels). When I load my image in ImageJ, I can see memory usage go up by 50MB, but when I try displaying the image using imshow(), my memory usage goes up by around 500MB, each time. If I close the figure and replot it, imshow() crashes. I don't know if I'm doing something wrong, or if it's a new or known bug. I tried the same thing on Linux and got the same result. Here's a transcript. Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: import pyfits In [2]: from Tkinter import * In [3]: import tkFileDialog In [4]: image=pyfits.getdata(tkFileDialog.askopenfilename()) In [5]: imshow(image) Out[5]: matplotlib.image.AxesImage object at 0x03BCA170 In [6]: close() In [7]: imshow(image,origin='lower') Out[7]: matplotlib.image.AxesImage object at 0x0440E170 In [8]: close() In [9]: imshow(image[100:3600,100:3600],origin='lower') Out[9]: matplotlib.image.AxesImage object at 0x045D9FB0 In [10]: Exception in Tkinter callback Traceback (most recent call last): File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 1410, in __call__ return self.func(*args) File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 495, in callit func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 263, in idle_draw self.draw() File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 248, in draw FigureCanvasAgg.draw(self) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_agg.py, line 394, in draw self.figure.draw(self.renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\figure.py, line 798, in draw func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\axes.py, line 1946, in draw a.draw(renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 354, in draw im = self.make_image(renderer.get_image_magnification()) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 569, in make_image transformed_viewLim) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 201, in _get_unsampled_image x = self.to_rgba(self._A, self._alpha) File C:\app\Python2.6\lib\site-packages\matplotlib\cm.py, line 193, in to_rgba x = self.norm(x) File C:\app\Python2.6\lib\site-packages\matplotlib\colors.py, line 820, in __call__ result = (val-vmin) / (vmax-vmin) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 3673, in __div__ return divide(self, other) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 1077, in __call__ m |= filled(domain(da, db), True) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 772, in __call__ return umath.absolute(a) * self.tolerance = umath.absolute(b) MemoryError Thanks for any help, -robert -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Trouble with imshow
On Wed, Feb 2, 2011 at 5:33 PM, Robert Abiad ab...@ssl.berkeley.edu wrote: Hello All, I'm very new to python, so bear with me. I'd like to use python to do my image processing, but I'm running into behavior that doesn't make sense to me. I'm using Windows 7 Pro (64-bit) with 4 gigs of memory, python 2.6.6, and the newest versions of ipython, pyfits, matplotlib (1.0.1), numpy (1.5.1), scipy. I'm loading in a fits file that's 26 MB (~16 Mpixels). When I load my image in ImageJ, I can see memory usage go up by 50MB, but when I try displaying the image using imshow(), my memory usage goes up by around 500MB, each time. If I close the figure and replot it, imshow() crashes. I don't know if I'm doing something wrong, or if it's a new or known bug. I tried the same thing on Linux and got the same result. Here's a transcript. Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: import pyfits In [2]: from Tkinter import * In [3]: import tkFileDialog In [4]: image=pyfits.getdata(tkFileDialog.askopenfilename()) In [5]: imshow(image) Out[5]: matplotlib.image.AxesImage object at 0x03BCA170 In [6]: close() In [7]: imshow(image,origin='lower') Out[7]: matplotlib.image.AxesImage object at 0x0440E170 In [8]: close() In [9]: imshow(image[100:3600,100:3600],origin='lower') Out[9]: matplotlib.image.AxesImage object at 0x045D9FB0 In [10]: Exception in Tkinter callback Traceback (most recent call last): File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 1410, in __call__ return self.func(*args) File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 495, in callit func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 263, in idle_draw self.draw() File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 248, in draw FigureCanvasAgg.draw(self) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_agg.py, line 394, in draw self.figure.draw(self.renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\figure.py, line 798, in draw func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\axes.py, line 1946, in draw a.draw(renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 354, in draw im = self.make_image(renderer.get_image_magnification()) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 569, in make_image transformed_viewLim) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 201, in _get_unsampled_image x = self.to_rgba(self._A, self._alpha) File C:\app\Python2.6\lib\site-packages\matplotlib\cm.py, line 193, in to_rgba x = self.norm(x) File C:\app\Python2.6\lib\site-packages\matplotlib\colors.py, line 820, in __call__ result = (val-vmin) / (vmax-vmin) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 3673, in __div__ return divide(self, other) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 1077, in __call__ m |= filled(domain(da, db), True) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 772, in __call__ return umath.absolute(a) * self.tolerance = umath.absolute(b) MemoryError Thanks for any help, -robert This isn't new, but it isn't well understood either: http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19614.html Unfortunately, that conversation went off-list, and never resulted in a bug report being filed. Could you please file a bug report on this? http://sourceforge.net/tracker/?group_id=80706 Thanks, Ben Root -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Trouble with imshow
On 2/2/2011 3:33 PM, Robert Abiad wrote: Hello All, I'm very new to python, so bear with me. I'd like to use python to do my image processing, but I'm running into behavior that doesn't make sense to me. I'm using Windows 7 Pro (64-bit) with 4 gigs of memory, python 2.6.6, and the newest versions of ipython, pyfits, matplotlib (1.0.1), numpy (1.5.1), scipy. I'm loading in a fits file that's 26 MB (~16 Mpixels). When I load my image in ImageJ, I can see memory usage go up by 50MB, but when I try displaying the image using imshow(), my memory usage goes up by around 500MB, each time. If I close the figure and replot it, imshow() crashes. I don't know if I'm doing something wrong, or if it's a new or known bug. I tried the same thing on Linux and got the same result. Here's a transcript. Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: import pyfits In [2]: from Tkinter import * In [3]: import tkFileDialog In [4]: image=pyfits.getdata(tkFileDialog.askopenfilename()) In [5]: imshow(image) Out[5]:matplotlib.image.AxesImage object at 0x03BCA170 In [6]: close() In [7]: imshow(image,origin='lower') Out[7]:matplotlib.image.AxesImage object at 0x0440E170 In [8]: close() In [9]: imshow(image[100:3600,100:3600],origin='lower') Out[9]:matplotlib.image.AxesImage object at 0x045D9FB0 In [10]: Exception in Tkinter callback Traceback (most recent call last): File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 1410, in __call__ return self.func(*args) File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 495, in callit func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 263, in idle_draw self.draw() File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 248, in draw FigureCanvasAgg.draw(self) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_agg.py, line 394, in draw self.figure.draw(self.renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\figure.py, line 798, in draw func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\axes.py, line 1946, in draw a.draw(renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 354, in draw im = self.make_image(renderer.get_image_magnification()) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 569, in make_image transformed_viewLim) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 201, in _get_unsampled_image x = self.to_rgba(self._A, self._alpha) File C:\app\Python2.6\lib\site-packages\matplotlib\cm.py, line 193, in to_rgba x = self.norm(x) File C:\app\Python2.6\lib\site-packages\matplotlib\colors.py, line 820, in __call__ result = (val-vmin) / (vmax-vmin) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 3673, in __div__ return divide(self, other) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 1077, in __call__ m |= filled(domain(da, db), True) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 772, in __call__ return umath.absolute(a) * self.tolerance= umath.absolute(b) MemoryError Thanks for any help, -robert These are previous discussions on the issue: http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg14727.html http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19815.html http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19614.html Christoph -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Trouble with imshow
You might want to try out the visvis module instead of matplotlib for interactive viewing of large 2D images - my system is also Win64 with 4GB and visvis.imshow() handles a 4k*4k image. You'll probably also want to disable ipython's object caching if you're doing a lot of this interactive viewing of large images. Gary R On Thu, Feb 3, 2011 at 10:59 AM, Christoph Gohlke cgoh...@uci.edu wrote: On 2/2/2011 3:33 PM, Robert Abiad wrote: Hello All, I'm very new to python, so bear with me. I'd like to use python to do my image processing, but I'm running into behavior that doesn't make sense to me. I'm using Windows 7 Pro (64-bit) with 4 gigs of memory, python 2.6.6, and the newest versions of ipython, pyfits, matplotlib (1.0.1), numpy (1.5.1), scipy. I'm loading in a fits file that's 26 MB (~16 Mpixels). When I load my image in ImageJ, I can see memory usage go up by 50MB, but when I try displaying the image using imshow(), my memory usage goes up by around 500MB, each time. If I close the figure and replot it, imshow() crashes. I don't know if I'm doing something wrong, or if it's a new or known bug. I tried the same thing on Linux and got the same result. Here's a transcript. Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: import pyfits In [2]: from Tkinter import * In [3]: import tkFileDialog In [4]: image=pyfits.getdata(tkFileDialog.askopenfilename()) In [5]: imshow(image) Out[5]:matplotlib.image.AxesImage object at 0x03BCA170 In [6]: close() In [7]: imshow(image,origin='lower') Out[7]:matplotlib.image.AxesImage object at 0x0440E170 In [8]: close() In [9]: imshow(image[100:3600,100:3600],origin='lower') Out[9]:matplotlib.image.AxesImage object at 0x045D9FB0 In [10]: Exception in Tkinter callback Traceback (most recent call last): File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 1410, in __call__ return self.func(*args) File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 495, in callit func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 263, in idle_draw self.draw() File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 248, in draw FigureCanvasAgg.draw(self) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_agg.py, line 394, in draw self.figure.draw(self.renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\figure.py, line 798, in draw func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\axes.py, line 1946, in draw a.draw(renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 354, in draw im = self.make_image(renderer.get_image_magnification()) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 569, in make_image transformed_viewLim) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 201, in _get_unsampled_image x = self.to_rgba(self._A, self._alpha) File C:\app\Python2.6\lib\site-packages\matplotlib\cm.py, line 193, in to_rgba x = self.norm(x) File C:\app\Python2.6\lib\site-packages\matplotlib\colors.py, line 820, in __call__ result = (val-vmin) / (vmax-vmin) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 3673, in __div__ return divide(self, other) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 1077, in __call__ m |= filled(domain(da, db), True) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 772, in __call__ return umath.absolute(a) * self.tolerance= umath.absolute(b) MemoryError Thanks for any help, -robert These are previous discussions on the issue: http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg14727.html http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19815.html http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19614.html Christoph -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___
Re: [Matplotlib-users] Trouble with imshow
On 2/2/2011 3:59 PM, Christoph Gohlke wrote: On 2/2/2011 3:33 PM, Robert Abiad wrote: Hello All, I'm very new to python, so bear with me. I'd like to use python to do my image processing, but I'm running into behavior that doesn't make sense to me. I'm using Windows 7 Pro (64-bit) with 4 gigs of memory, python 2.6.6, and the newest versions of ipython, pyfits, matplotlib (1.0.1), numpy (1.5.1), scipy. I'm loading in a fits file that's 26 MB (~16 Mpixels). When I load my image in ImageJ, I can see memory usage go up by 50MB, but when I try displaying the image using imshow(), my memory usage goes up by around 500MB, each time. If I close the figure and replot it, imshow() crashes. I don't know if I'm doing something wrong, or if it's a new or known bug. I tried the same thing on Linux and got the same result. Here's a transcript. Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: import pyfits In [2]: from Tkinter import * In [3]: import tkFileDialog In [4]: image=pyfits.getdata(tkFileDialog.askopenfilename()) In [5]: imshow(image) Out[5]:matplotlib.image.AxesImage object at 0x03BCA170 In [6]: close() In [7]: imshow(image,origin='lower') Out[7]:matplotlib.image.AxesImage object at 0x0440E170 In [8]: close() In [9]: imshow(image[100:3600,100:3600],origin='lower') Out[9]:matplotlib.image.AxesImage object at 0x045D9FB0 In [10]: Exception in Tkinter callback Traceback (most recent call last): File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 1410, in __call__ return self.func(*args) File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 495, in callit func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 263, in idle_draw self.draw() File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 248, in draw FigureCanvasAgg.draw(self) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_agg.py, line 394, in draw self.figure.draw(self.renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\figure.py, line 798, in draw func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\axes.py, line 1946, in draw a.draw(renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 354, in draw im = self.make_image(renderer.get_image_magnification()) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 569, in make_image transformed_viewLim) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 201, in _get_unsampled_image x = self.to_rgba(self._A, self._alpha) File C:\app\Python2.6\lib\site-packages\matplotlib\cm.py, line 193, in to_rgba x = self.norm(x) File C:\app\Python2.6\lib\site-packages\matplotlib\colors.py, line 820, in __call__ result = (val-vmin) / (vmax-vmin) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 3673, in __div__ return divide(self, other) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 1077, in __call__ m |= filled(domain(da, db), True) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 772, in __call__ return umath.absolute(a) * self.tolerance= umath.absolute(b) MemoryError Thanks for any help, -robert These are previous discussions on the issue: http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg14727.html http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19815.html http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19614.html Christoph The first 2 discussions lead to suggestions of more memory on a 64-bit installation, but that doesn't seem like a great solution. I use other image processing software (ImageJ and IDL) and neither has any trouble with my images. As I mentioned ImageJ uses 1/10th the memory for the same display, or about 1 byte of memory for 1 byte of image. I think matplotlib should aim for the same. I also think it should free up memory when the image is closed, but maybe I'm not doing the right thing. Is there something else I should be doing to free up memory? Things are even worse with plot. I'll file a bug report as Benjamin suggests. -robert -- Special Offer--
Re: [Matplotlib-users] Trouble with imshow
On 2/2/2011 5:08 PM, Robert Abiad wrote: On 2/2/2011 3:59 PM, Christoph Gohlke wrote: On 2/2/2011 3:33 PM, Robert Abiad wrote: Hello All, I'm very new to python, so bear with me. I'd like to use python to do my image processing, but I'm running into behavior that doesn't make sense to me. I'm using Windows 7 Pro (64-bit) with 4 gigs of memory, python 2.6.6, and the newest versions of ipython, pyfits, matplotlib (1.0.1), numpy (1.5.1), scipy. I'm loading in a fits file that's 26 MB (~16 Mpixels). When I load my image in ImageJ, I can see memory usage go up by 50MB, but when I try displaying the image using imshow(), my memory usage goes up by around 500MB, each time. If I close the figure and replot it, imshow() crashes. I don't know if I'm doing something wrong, or if it's a new or known bug. I tried the same thing on Linux and got the same result. Here's a transcript. Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: import pyfits In [2]: from Tkinter import * In [3]: import tkFileDialog In [4]: image=pyfits.getdata(tkFileDialog.askopenfilename()) In [5]: imshow(image) Out[5]:matplotlib.image.AxesImage object at 0x03BCA170 In [6]: close() In [7]: imshow(image,origin='lower') Out[7]:matplotlib.image.AxesImage object at 0x0440E170 In [8]: close() In [9]: imshow(image[100:3600,100:3600],origin='lower') Out[9]:matplotlib.image.AxesImage object at 0x045D9FB0 In [10]: Exception in Tkinter callback Traceback (most recent call last): File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 1410, in __call__ return self.func(*args) File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 495, in callit func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 263, in idle_draw self.draw() File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 248, in draw FigureCanvasAgg.draw(self) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_agg.py, line 394, in draw self.figure.draw(self.renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\figure.py, line 798, in draw func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\axes.py, line 1946, in draw a.draw(renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 354, in draw im = self.make_image(renderer.get_image_magnification()) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 569, in make_image transformed_viewLim) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 201, in _get_unsampled_image x = self.to_rgba(self._A, self._alpha) File C:\app\Python2.6\lib\site-packages\matplotlib\cm.py, line 193, in to_rgba x = self.norm(x) File C:\app\Python2.6\lib\site-packages\matplotlib\colors.py, line 820, in __call__ result = (val-vmin) / (vmax-vmin) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 3673, in __div__ return divide(self, other) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 1077, in __call__ m |= filled(domain(da, db), True) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 772, in __call__ return umath.absolute(a) * self.tolerance= umath.absolute(b) MemoryError Thanks for any help, -robert These are previous discussions on the issue: http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg14727.html http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19815.html http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19614.html Christoph The first 2 discussions lead to suggestions of more memory on a 64-bit installation, but that doesn't seem like a great solution. I use other image processing software (ImageJ and IDL) and neither has any trouble with my images. As I mentioned ImageJ uses 1/10th the memory for the same display, or about 1 byte of memory for 1 byte of image. I think matplotlib should aim for the same. I also think it should free up memory when the image is closed, but maybe I'm not doing the right thing. Is there something else I should be doing to free up memory? Things are even worse with plot. I'll file a bug report as Benjamin suggests. -robert
Re: [Matplotlib-users] Trouble with imshow
On 02/02/2011 03:08 PM, Robert Abiad wrote: On 2/2/2011 3:59 PM, Christoph Gohlke wrote: On 2/2/2011 3:33 PM, Robert Abiad wrote: Hello All, I'm very new to python, so bear with me. I'd like to use python to do my image processing, but I'm running into behavior that doesn't make sense to me. I'm using Windows 7 Pro (64-bit) with 4 gigs of memory, python 2.6.6, and the newest versions of ipython, pyfits, matplotlib (1.0.1), numpy (1.5.1), scipy. I'm loading in a fits file that's 26 MB (~16 Mpixels). When I load my image in ImageJ, I can see memory usage go up by 50MB, but when I try displaying the image using imshow(), my memory usage goes up by around 500MB, each time. If I close the figure and replot it, imshow() crashes. I don't know if I'm doing something wrong, or if it's a new or known bug. I tried the same thing on Linux and got the same result. Here's a transcript. Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: import pyfits In [2]: from Tkinter import * In [3]: import tkFileDialog In [4]: image=pyfits.getdata(tkFileDialog.askopenfilename()) In [5]: imshow(image) Out[5]:matplotlib.image.AxesImage object at 0x03BCA170 In [6]: close() In [7]: imshow(image,origin='lower') Out[7]:matplotlib.image.AxesImage object at 0x0440E170 In [8]: close() In [9]: imshow(image[100:3600,100:3600],origin='lower') Out[9]:matplotlib.image.AxesImage object at 0x045D9FB0 In [10]: Exception in Tkinter callback Traceback (most recent call last): File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 1410, in __call__ return self.func(*args) File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 495, in callit func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 263, in idle_draw self.draw() File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 248, in draw FigureCanvasAgg.draw(self) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_agg.py, line 394, in draw self.figure.draw(self.renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\figure.py, line 798, in draw func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\axes.py, line 1946, in draw a.draw(renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 354, in draw im = self.make_image(renderer.get_image_magnification()) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 569, in make_image transformed_viewLim) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 201, in _get_unsampled_image x = self.to_rgba(self._A, self._alpha) File C:\app\Python2.6\lib\site-packages\matplotlib\cm.py, line 193, in to_rgba x = self.norm(x) File C:\app\Python2.6\lib\site-packages\matplotlib\colors.py, line 820, in __call__ result = (val-vmin) / (vmax-vmin) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 3673, in __div__ return divide(self, other) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 1077, in __call__ m |= filled(domain(da, db), True) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 772, in __call__ return umath.absolute(a) * self.tolerance= umath.absolute(b) MemoryError Thanks for any help, -robert These are previous discussions on the issue: http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg14727.html http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19815.html http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19614.html Christoph The first 2 discussions lead to suggestions of more memory on a 64-bit installation, but that doesn't seem like a great solution. I use other image processing software (ImageJ and IDL) and neither has any trouble with my images. As I mentioned ImageJ uses 1/10th the memory for the same display, or about 1 byte of memory for 1 byte of image. I think matplotlib should aim for the same. I also think it should free up memory when the image is closed, but maybe I'm not doing the right thing. Is there something else I should be doing to free up memory? Things are even worse with plot. I'll file a bug report as Benjamin suggests. Please file it in
Re: [Matplotlib-users] 3D Data to 2d Plots
Sorry I was out of touch for a while I have been busy with other things, You would have to do some sort of a bin solution with the method I suggested. So m/z values would not have to be exact but you would group ranges of them together. To be honest based on the plots you showed in your initial question I am surprised you don’t already have the data in a 2d array already. An example of the data in the format you intend to start with would have really helped explain the situation. Matplotlib has a plot module that bins things automatically for you based on the data http://matplotlib.sourceforge.net/examples/api/histogram_demo.html or you can use numpy.historgram function directly. If you are doing something like that already to compute your m/z values, just make sure use the same sequence for your bins (see examples at http://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html) and presto you have the makings of a perfectly aligned 2d array that can be plotted with pcolor or with 3d surface Again I hope this helps From: trueflyingsh...@googlemail.com [mailto:trueflyingsh...@googlemail.com] On Behalf Of Philipp A. Sent: January-28-11 10:55 AM To: Mike Alger Cc: matplotlib-users@lists.sourceforge.net Subject: Re: [Matplotlib-users] 3D Data to 2d Plots 2011/1/28 Mike Alger mal...@ryerson.ca Philip, A few questions before I give one possible solution, Does this plot need to be updated in real time ? or is this plot to be done in post processing? if you can do the plots with post processing you should be able to use pcolor function to do your tasks http://matplotlib.sourceforge.net/examples/pylab_examples/pcolor_demo.html i won’t go into details but just assign: X as 1d vector with your m/z values Y as 1d vector your time values And Z as a 2d array that will map counts/sec to both a “m/z” and “time” index You will have to find the location for your other marks and then plot them on top of pcolor graph but that shouldn’t be too hard just express your values (i am assuming 3dB cutoff points and peak power of some sort) in terms of X Y. I am almost certain there is probably a nice DSP way to solve for those X Y values once the data is in a 2d array but i am no expert on that mater. Good luck and hopefully this helps, Mike hi mike, thanks for the answer. it looks interesting, but will it work if the m/z values are all different from each other? i mean: the m/z-ranges are overlapping, but there are no duplicate values. this way, every column of the array would only contain one value if i understood you correctly. thanks, philipp -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Trouble with imshow
On 2/2/2011 6:06 PM, Eric Firing wrote: On 02/02/2011 03:08 PM, Robert Abiad wrote: On 2/2/2011 3:59 PM, Christoph Gohlke wrote: On 2/2/2011 3:33 PM, Robert Abiad wrote: Hello All, I'm very new to python, so bear with me. I'd like to use python to do my image processing, but I'm running into behavior that doesn't make sense to me. I'm using Windows 7 Pro (64-bit) with 4 gigs of memory, python 2.6.6, and the newest versions of ipython, pyfits, matplotlib (1.0.1), numpy (1.5.1), scipy. I'm loading in a fits file that's 26 MB (~16 Mpixels). When I load my image in ImageJ, I can see memory usage go up by 50MB, but when I try displaying the image using imshow(), my memory usage goes up by around 500MB, each time. If I close the figure and replot it, imshow() crashes. I don't know if I'm doing something wrong, or if it's a new or known bug. I tried the same thing on Linux and got the same result. Here's a transcript. Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: import pyfits In [2]: from Tkinter import * In [3]: import tkFileDialog In [4]: image=pyfits.getdata(tkFileDialog.askopenfilename()) In [5]: imshow(image) Out[5]:matplotlib.image.AxesImage object at 0x03BCA170 In [6]: close() In [7]: imshow(image,origin='lower') Out[7]:matplotlib.image.AxesImage object at 0x0440E170 In [8]: close() In [9]: imshow(image[100:3600,100:3600],origin='lower') Out[9]:matplotlib.image.AxesImage object at 0x045D9FB0 In [10]: Exception in Tkinter callback Traceback (most recent call last): File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 1410, in __call__ return self.func(*args) File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 495, in callit func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 263, in idle_draw self.draw() File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 248, in draw FigureCanvasAgg.draw(self) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_agg.py, line 394, in draw self.figure.draw(self.renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\figure.py, line 798, in draw func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\axes.py, line 1946, in draw a.draw(renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 354, in draw im = self.make_image(renderer.get_image_magnification()) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 569, in make_image transformed_viewLim) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 201, in _get_unsampled_image x = self.to_rgba(self._A, self._alpha) File C:\app\Python2.6\lib\site-packages\matplotlib\cm.py, line 193, in to_rgba x = self.norm(x) File C:\app\Python2.6\lib\site-packages\matplotlib\colors.py, line 820, in __call__ result = (val-vmin) / (vmax-vmin) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 3673, in __div__ return divide(self, other) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 1077, in __call__ m |= filled(domain(da, db), True) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 772, in __call__ return umath.absolute(a) * self.tolerance= umath.absolute(b) MemoryError Thanks for any help, -robert These are previous discussions on the issue: http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg14727.html http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19815.html http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19614.html Christoph The first 2 discussions lead to suggestions of more memory on a 64-bit installation, but that doesn't seem like a great solution. I use other image processing software (ImageJ and IDL) and neither has any trouble with my images. As I mentioned ImageJ uses 1/10th the memory for the same display, or about 1 byte of memory for 1 byte of image. I think matplotlib should aim for the same. I also think it should free up memory when the image is closed, but maybe I'm not doing the right thing. Is there something else I should be doing to free up memory? Things are even worse with plot. I'll file a bug report as Benjamin suggests. Please file it in the enhancement
Re: [Matplotlib-users] Trouble with imshow
On Wed, Feb 2, 2011 at 8:06 PM, Eric Firing efir...@hawaii.edu wrote: On 02/02/2011 03:08 PM, Robert Abiad wrote: On 2/2/2011 3:59 PM, Christoph Gohlke wrote: On 2/2/2011 3:33 PM, Robert Abiad wrote: Hello All, I'm very new to python, so bear with me. I'd like to use python to do my image processing, but I'm running into behavior that doesn't make sense to me. I'm using Windows 7 Pro (64-bit) with 4 gigs of memory, python 2.6.6, and the newest versions of ipython, pyfits, matplotlib (1.0.1), numpy (1.5.1), scipy. I'm loading in a fits file that's 26 MB (~16 Mpixels). When I load my image in ImageJ, I can see memory usage go up by 50MB, but when I try displaying the image using imshow(), my memory usage goes up by around 500MB, each time. If I close the figure and replot it, imshow() crashes. I don't know if I'm doing something wrong, or if it's a new or known bug. I tried the same thing on Linux and got the same result. Here's a transcript. Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: import pyfits In [2]: from Tkinter import * In [3]: import tkFileDialog In [4]: image=pyfits.getdata(tkFileDialog.askopenfilename()) In [5]: imshow(image) Out[5]:matplotlib.image.AxesImage object at 0x03BCA170 In [6]: close() In [7]: imshow(image,origin='lower') Out[7]:matplotlib.image.AxesImage object at 0x0440E170 In [8]: close() In [9]: imshow(image[100:3600,100:3600],origin='lower') Out[9]:matplotlib.image.AxesImage object at 0x045D9FB0 In [10]: Exception in Tkinter callback Traceback (most recent call last): File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 1410, in __call__ return self.func(*args) File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 495, in callit func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 263, in idle_draw self.draw() File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 248, in draw FigureCanvasAgg.draw(self) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_agg.py, line 394, in draw self.figure.draw(self.renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\figure.py, line 798, in draw func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\axes.py, line 1946, in draw a.draw(renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 354, in draw im = self.make_image(renderer.get_image_magnification()) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 569, in make_image transformed_viewLim) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 201, in _get_unsampled_image x = self.to_rgba(self._A, self._alpha) File C:\app\Python2.6\lib\site-packages\matplotlib\cm.py, line 193, in to_rgba x = self.norm(x) File C:\app\Python2.6\lib\site-packages\matplotlib\colors.py, line 820, in __call__ result = (val-vmin) / (vmax-vmin) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 3673, in __div__ return divide(self, other) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 1077, in __call__ m |= filled(domain(da, db), True) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 772, in __call__ return umath.absolute(a) * self.tolerance= umath.absolute(b) MemoryError Thanks for any help, -robert These are previous discussions on the issue: http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg14727.html http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19815.html http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19614.html Christoph The first 2 discussions lead to suggestions of more memory on a 64-bit installation, but that doesn't seem like a great solution. I use other image processing software (ImageJ and IDL) and neither has any trouble with my images. As I mentioned ImageJ uses 1/10th the memory for the same display, or about 1 byte of memory for 1 byte of image. I think matplotlib should aim for the same. I also think it should free up memory when the image is closed, but maybe I'm not doing the right thing. Is
Re: [Matplotlib-users] Trouble with imshow
On 2/2/2011 8:22 PM, Benjamin Root wrote: On Wed, Feb 2, 2011 at 8:06 PM, Eric Firing efir...@hawaii.edu mailto:efir...@hawaii.edu wrote: On 02/02/2011 03:08 PM, Robert Abiad wrote: On 2/2/2011 3:59 PM, Christoph Gohlke wrote: On 2/2/2011 3:33 PM, Robert Abiad wrote: Hello All, I'm very new to python, so bear with me. I'd like to use python to do my image processing, but I'm running into behavior that doesn't make sense to me. I'm using Windows 7 Pro (64-bit) with 4 gigs of memory, python 2.6.6, and the newest versions of ipython, pyfits, matplotlib (1.0.1), numpy (1.5.1), scipy. I'm loading in a fits file that's 26 MB (~16 Mpixels). When I load my image in ImageJ, I can see memory usage go up by 50MB, but when I try displaying the image using imshow(), my memory usage goes up by around 500MB, each time. If I close the figure and replot it, imshow() crashes. I don't know if I'm doing something wrong, or if it's a new or known bug. I tried the same thing on Linux and got the same result. Here's a transcript. Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: import pyfits In [2]: from Tkinter import * In [3]: import tkFileDialog In [4]: image=pyfits.getdata(tkFileDialog.askopenfilename()) In [5]: imshow(image) Out[5]:matplotlib.image.AxesImage object at 0x03BCA170 In [6]: close() In [7]: imshow(image,origin='lower') Out[7]:matplotlib.image.AxesImage object at 0x0440E170 In [8]: close() In [9]: imshow(image[100:3600,100:3600],origin='lower') Out[9]:matplotlib.image.AxesImage object at 0x045D9FB0 In [10]: Exception in Tkinter callback Traceback (most recent call last): File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 1410, in __call__ return self.func(*args) File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 495, in callit func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 263, in idle_draw self.draw() File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 248, in draw FigureCanvasAgg.draw(self) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_agg.py, line 394, in draw self.figure.draw(self.renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\figure.py, line 798, in draw func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\axes.py, line 1946, in draw a.draw(renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 354, in draw im = self.make_image(renderer.get_image_magnification()) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 569, in make_image transformed_viewLim) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 201, in _get_unsampled_image x = self.to_rgba(self._A, self._alpha) File C:\app\Python2.6\lib\site-packages\matplotlib\cm.py, line 193, in to_rgba x = self.norm(x) File C:\app\Python2.6\lib\site-packages\matplotlib\colors.py, line 820, in __call__ result = (val-vmin) / (vmax-vmin) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 3673, in __div__ return divide(self, other) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 1077, in __call__ m |= filled(domain(da, db), True) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 772, in __call__ return umath.absolute(a) * self.tolerance= umath.absolute(b) MemoryError Thanks for any help, -robert These are previous discussions on the issue: http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg14727.html
Re: [Matplotlib-users] Trouble with imshow
On 2/2/2011 6:06 PM, Eric Firing wrote: On 02/02/2011 03:08 PM, Robert Abiad wrote: On 2/2/2011 3:59 PM, Christoph Gohlke wrote: On 2/2/2011 3:33 PM, Robert Abiad wrote: Hello All, I'm very new to python, so bear with me. I'd like to use python to do my image processing, but I'm running into behavior that doesn't make sense to me. I'm using Windows 7 Pro (64-bit) with 4 gigs of memory, python 2.6.6, and the newest versions of ipython, pyfits, matplotlib (1.0.1), numpy (1.5.1), scipy. I'm loading in a fits file that's 26 MB (~16 Mpixels). When I load my image in ImageJ, I can see memory usage go up by 50MB, but when I try displaying the image using imshow(), my memory usage goes up by around 500MB, each time. If I close the figure and replot it, imshow() crashes. I don't know if I'm doing something wrong, or if it's a new or known bug. I tried the same thing on Linux and got the same result. Here's a transcript. Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: import pyfits In [2]: from Tkinter import * In [3]: import tkFileDialog In [4]: image=pyfits.getdata(tkFileDialog.askopenfilename()) In [5]: imshow(image) Out[5]:matplotlib.image.AxesImage object at 0x03BCA170 In [6]: close() In [7]: imshow(image,origin='lower') Out[7]:matplotlib.image.AxesImage object at 0x0440E170 In [8]: close() In [9]: imshow(image[100:3600,100:3600],origin='lower') Out[9]:matplotlib.image.AxesImage object at 0x045D9FB0 In [10]: Exception in Tkinter callback Traceback (most recent call last): File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 1410, in __call__ return self.func(*args) File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 495, in callit func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 263, in idle_draw self.draw() File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 248, in draw FigureCanvasAgg.draw(self) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_agg.py, line 394, in draw self.figure.draw(self.renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\figure.py, line 798, in draw func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\axes.py, line 1946, in draw a.draw(renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 354, in draw im = self.make_image(renderer.get_image_magnification()) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 569, in make_image transformed_viewLim) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 201, in _get_unsampled_image x = self.to_rgba(self._A, self._alpha) File C:\app\Python2.6\lib\site-packages\matplotlib\cm.py, line 193, in to_rgba x = self.norm(x) File C:\app\Python2.6\lib\site-packages\matplotlib\colors.py, line 820, in __call__ result = (val-vmin) / (vmax-vmin) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 3673, in __div__ return divide(self, other) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 1077, in __call__ m |= filled(domain(da, db), True) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 772, in __call__ return umath.absolute(a) * self.tolerance= umath.absolute(b) MemoryError Thanks for any help, -robert These are previous discussions on the issue: http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg14727.html http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19815.html http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19614.html Christoph The first 2 discussions lead to suggestions of more memory on a 64-bit installation, but that doesn't seem like a great solution. I use other image processing software (ImageJ and IDL) and neither has any trouble with my images. As I mentioned ImageJ uses 1/10th the memory for the same display, or about 1 byte of memory for 1 byte of image. I think matplotlib should aim for the same. I also think it should free up memory when the image is closed, but maybe I'm not doing the right thing. Is there something else I should be doing to free up memory? Things are even