Thanks for replying Mike,
I tried it on Linux as well but I ran into the same problem. Perhaps it has 
something to do with other needed libraries (GTK+, etc.). Can you please tell 
me your libraries versions? I mean GTK+, pygtk, etc. Also output produced by 
--verbose-helpful could be useful. Thank you.
Tomas.



> ------------ Pôvodná správa ------------
> Od: Michael Droettboom <md...@stsci.edu>
> Predmet: Re: [Matplotlib-users] imshow memory problem
> Dátum: 17.5.2010 16:48:55
> ----------------------------------------
> On Linux, I only see about an extra 24kb being used when the canvas is 
> added to a window vs. not adding it (i.e. commenting out the 
> window.add(canvas) line).
> 
> In general, here's the memory usage to be expected from imshow (if it's 
> a floating-point, not-rgb(a) array as you have here):
> 
> The original data: 4-bytes-per-pixel for float32 or 8-bytes-per-pixel 
> for float64 (in your example the array is float64).
> Intermediate float data: *if* the original is not float64, then an 
> intermediate float64 is created (not the case here)
> The colorized data: 4-bytes-per-pixel at original array size
> The sized data: 4-bytes-per-pixel at the scaled figure size
> 
> I hope I'm not forgetting anything, but the point is that to support 
> high-speed rendering of plots, the memory usage is much greater than the 
> data itself.  If your data is truly large, the usual technique is to 
> decimate or downsample it before passing it to matplotlib, as you're not 
> going to see more data points than pixels on your display anyway.
> 
> Mike
> 
> Tomáš Faragó wrote:
> > Hello,
> > I am writing a GUI using GTK+ library. I have a question about axes class
> imshow method memory consumtion. If I pass the imshow an array, the resulting
> memory consuption is approximatelly 46 times greater than the array size. If I
> do not add the canvas to a window (in a code below), the memory consuption is
> "only" 8 times greater. Any tips on how to reduce the memory consuption would 
> be
> very appreciated and any explanation of how much memmory imshow allocates too.
> Configuration and script are below.
> >
> > os: Windowx XP
> > matplotlib version: 0.99.1
> > downloaded from: sourceforge.net
> >
> > script:
> > from matplotlib.figure import Figure
> > from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg
> > from pylab import rand
> > import gtk
> >
> > window = gtk.Window()
> > window.connect("destroy", gtk.main_quit)
> >
> > figure = Figure(figsize=(8,6), dpi=72)
> > canvas = FigureCanvasGTKAgg(figure)
> > axes = figure.add_subplot(111)
> >
> > window.add(canvas)
> >
> > axes.imshow(rand(1024,1024))
> > canvas.draw()
> > window.show_all()
> >
> > gtk.main()
> >
> > verbose-helpful output:
> > $HOME=C:\Documents and Settings\Sensej
> > CONFIGDIR=C:\Documents and Settings\Sensej\.matplotlib
> > matplotlib data path C:\Python26\lib\site-packages\matplotlib\mpl-data
> > loaded rc file 
> > C:\Python26\lib\site-packages\matplotlib\mpl-data\matplotlibrc
> > matplotlib version 0.99.1
> > verbose.level helpful
> > interactive is False
> > units is False
> > platform is win32
> > Using fontManager instance from C:\Documents and
> Settings\Sensej\.matplotlib\fontList.cache
> > backend GTKAgg version 2.12.1
> > findfont: Matching
> :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium
> to Bitstream Vera Sans
> (C:\Python26\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf) with
> score of 0.000000
> >
> > Thank you,
> > Tomas.
> >
> >
> ------------------------------------------------------------------------------
> >
> > _______________________________________________
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >   
> 
> -- 
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
> 
> 
> 
> 

------------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to