Erik Tollerud | 1 Oct 08:48
Picon
Gravatar

Re: Patch for scatter plot legend enhancement

Sorry for the dealyed reply - I've been out of town... I posted to the
patch tracker, and am dutifully pinging :)

On Tue, Sep 23, 2008 at 11:41 AM, John Hunter <jdh2358@...> wrote:
> On Tue, Sep 23, 2008 at 12:20 AM, Erik Tollerud
<erik.tollerud@...> wrote:
>> Attached is a diff against revision 6115 that contains a patch to
>> improve the behavior of the legend function when showing legends for
>
> Erik,
>
> I haven't had a chance to get to this yet.  Could you please also post
> it on the sf patch tracker so it doesn't get dropped, and ping us with
> a reminder in a few days if nothing has happened....
>
> JDH
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Mátyás János | 2 Oct 00:47
Picon

memory leak: gtk.gdk.Pixbuf and gtk.gdk.GCX11 with gtkagg backend

Hi,

I'm looking for memory leaks in a python application and found leaks in
matplotlib. The application is graphic intensive. Each time it updates
the screen, matplotlib allocates another 5-10 megabytes memory for the
new gtk.gdk.Pixbuf and gtk.gdk.GCX11 while does not free up the buffers
allocated for the previous content.

I switched on garbage collection debugging with:

import gc
gc.enable()
gc.set_debug(gc.DEBUG_LEAK)

and tried to delete the leaking objects:

--- ./lib/matplotlib/backends/backend_gtkagg.py 2008-06-23
04:09:29.000000000 +0200 ++
+ /usr/lib/python2.4/site-packages/matplotlib-0.91.4-py2.4-linux-i686.egg/matplotlib/backends/backend_gtkagg.py
2008-10-02 00:05:32.000000000 +0200 @@ -3,6 +3,7 @@ """
 from __future__ import division
 import os
+import gc

 import matplotlib
 from matplotlib.figure import Figure
@@ -82,8 +83,17 @@
         h = int(ren.height)
         pixbuf = gtk.gdk.pixbuf_new_from_data(
             buf, gtk.gdk.COLORSPACE_RGB,  True, 8, w, h, w*4)
(Continue reading)

Eric Firing | 2 Oct 01:45
Favicon
Gravatar

Re: memory leak: gtk.gdk.Pixbuf and gtk.gdk.GCX11 with gtkagg backend

Mátyás János wrote:
> Hi,
> 
> I'm looking for memory leaks in a python application and found leaks in
> matplotlib. The application is graphic intensive. Each time it updates
> the screen, matplotlib allocates another 5-10 megabytes memory for the
> new gtk.gdk.Pixbuf and gtk.gdk.GCX11 while does not free up the buffers
> allocated for the previous content.
> 

This sounds to me like a pygtk bug, not a matplotlib bug; a gtk object 
is hanging around after its reference has been deleted. What versions of 
gtk and pygtk are you using?  This sounds dimly familiar.  I don't know 
enough about gtk and pygtk to help, but I am sure the people who do know 
more will want to know the version.

Eric

> I switched on garbage collection debugging with:
> 
> import gc
> gc.enable()
> gc.set_debug(gc.DEBUG_LEAK)
> 
> and tried to delete the leaking objects:
> 
> --- ./lib/matplotlib/backends/backend_gtkagg.py 2008-06-23
> 04:09:29.000000000 +0200 ++
> + /usr/lib/python2.4/site-packages/matplotlib-0.91.4-py2.4-linux-i686.egg/matplotlib/backends/backend_gtkagg.py
> 2008-10-02 00:05:32.000000000 +0200 @@ -3,6 +3,7 @@ """
(Continue reading)

Tony S Yu | 2 Oct 03:26
Picon
Favicon

Re: spy: ignore zero values in sparse matrix

Hi Eric,

Sorry for the late reply.

On Sep 27, 2008, at 8:56 PM, Eric Firing wrote:

> Actually, I think the most logical thing would be to let the default  
> None give the old behavior, and require precision=0 to get the new  
> behavior.  What do you think?  Is it OK if I make this change?  It  
> is more consistent with the old behavior.

I'm ambivalent about this change. On one hand, I think it makes a lot  
more sense to have None give the old behavior and precision=0 to  
ignore zero values in the sparse array (then precision would be  
consistent for finite values and for zero).

On the other hand, I think ignoring zero values should be the default  
behavior for sparse arrays (although, I definitely agree there should  
be the option to plot all assigned values).

Would it be possible to make the change you suggest and also change  
the default precision value to 0? (see diff below) This change would  
also allow you to remove a lot of the special handling for  
precision=None, since precision=0 gives the same result (I didn't go  
this far in the diff below).

> I also changed the behavior so that if a sparse array is input, with  
> no marker specifications, it simply makes a default marker plot  
> instead of raising an exception.

(Continue reading)

Michael Droettboom | 2 Oct 14:26

Re: memory leak: gtk.gdk.Pixbuf and gtk.gdk.GCX11 with gtkagg backend

Agreed.  I'm not sure how this bug could be resolved only on the 
matplotlib side.  See if you can make a standalone (pygtk-only) example 
that demonstrates this bug and send it to their mailing list.  Also, if 
it's possible, try updating pygtk.  There was a very similar bug in an 
earlier version (sorry, I can't find the reference), that was resolved.

Cheers,
Mike

Eric Firing wrote:
> Mátyás János wrote:
>   
>> Hi,
>>
>> I'm looking for memory leaks in a python application and found leaks in
>> matplotlib. The application is graphic intensive. Each time it updates
>> the screen, matplotlib allocates another 5-10 megabytes memory for the
>> new gtk.gdk.Pixbuf and gtk.gdk.GCX11 while does not free up the buffers
>> allocated for the previous content.
>>
>>     
>
> This sounds to me like a pygtk bug, not a matplotlib bug; a gtk object 
> is hanging around after its reference has been deleted. What versions of 
> gtk and pygtk are you using?  This sounds dimly familiar.  I don't know 
> enough about gtk and pygtk to help, but I am sure the people who do know 
> more will want to know the version.
>
> Eric
>
(Continue reading)

Michael Droettboom | 2 Oct 15:51

Python 2.6

matplotlib SVN trunk appears to be running backend_driver.py fine under 
Python-2.6 with Numpy SVN and TkAgg backend.

I had to make a handful of changes to remove deprecation warnings, none 
of which changes our "still supporting Python 2.4" policy.  One change 
was required to pytz, which I've communicated upstream to its author.

In case anyone is wondering, there don't seem to be any measurable 
performance increases... :(

Cheers,
Mike

--

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Mátyás János | 2 Oct 21:57
Picon

Re: memory leak: gtk.gdk.Pixbuf and gtk.gdk.GCX11 with gtkagg backend

Hi,

thank you very much! The memory leak disappeared after I updated
pygobject from 2.12 to 2.13.2.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Eric Firing | 4 Oct 09:18
Favicon
Gravatar

Re: spy: ignore zero values in sparse matrix

Tony S Yu wrote:
> Hi Eric,
> 
> Sorry for the late reply.
> 
> On Sep 27, 2008, at 8:56 PM, Eric Firing wrote:
> 
>> Actually, I think the most logical thing would be to let the default  
>> None give the old behavior, and require precision=0 to get the new  
>> behavior.  What do you think?  Is it OK if I make this change?  It  
>> is more consistent with the old behavior.
> 
> I'm ambivalent about this change. On one hand, I think it makes a lot  
> more sense to have None give the old behavior and precision=0 to  
> ignore zero values in the sparse array (then precision would be  
> consistent for finite values and for zero).
> 
> On the other hand, I think ignoring zero values should be the default  
> behavior for sparse arrays (although, I definitely agree there should  
> be the option to plot all assigned values).
> 
> Would it be possible to make the change you suggest and also change  
> the default precision value to 0? (see diff below) This change would  
> also allow you to remove a lot of the special handling for  
> precision=None, since precision=0 gives the same result (I didn't go  
> this far in the diff below).

Good point.  I made that change, but then made precision='present' be 
the value for sparse arrays to show all filled cells.  precision=None is 
deprecated, but converted to 0.
(Continue reading)

Jae-Joon Lee | 5 Oct 01:56
Picon
Gravatar

Re: system fonts not found

John,

As you may know, you're reverting the change Michael made sometime
ago. Michael said it is not a bug, but rather intended.

http://sourceforge.net/mailarchive/message.php?msg_id=6e8d907b0809031201p4bb0701eo23b3d294797a8766%40mail.gmail.com

So, I would appreciate if you reiterate this with Micheal before I
change back my scripts again.

Regards,

-JJ

On Thu, Sep 25, 2008 at 11:53 AM, John Hunter <jdh2358@...> wrote:
> On Thu, Sep 25, 2008 at 9:31 AM, Darren Dale <dsdale24@...> wrote:
>> I noticed this morning that my Times and Palatino system fonts are not being
>> found anymore. I removed my fontManager.cache and ran my script with
>> verbose=debug, and it looks like creatFontDict found them, but then findfont
>> cant:
>
> I recently fixed another bug related to font finding when an explicit
> file name was passed -- I wonder if I broke a normal use case.  It's a
> simple change shown in the diff below.  Could you manually revert on
> your end and see if it makes a difference.  If so, I'll have to find
> another solution to the problem I was fixing.
>
>
> johnh <at> flag:mpl> svn diff lib/matplotlib/font_manager.py -r6097:6098
> Index: lib/matplotlib/font_manager.py
(Continue reading)

Eric Firing | 6 Oct 02:50
Favicon
Gravatar

Axes.add_line() is oddly slow?

I am getting very inconsistent timings when looking into plotting a line 
with a very large number of points.  Axes.add_line() is very slow, and 
the time is taken by Axes._update_line_limits().  But when I simply run 
the latter, on a Line2D of the same dimensions, it can be fast.

import matplotlib
matplotlib.use('template')
import numpy as np
import matplotlib.lines as mlines
import matplotlib.pyplot as plt
ax = plt.gca()
LL = mlines.Line2D(np.arange(1.5e6), np.sin(np.arange(1.5e6)))
from time import time
t = time(); ax.add_line(LL); time()-t
###16.621543884277344
LL = mlines.Line2D(np.arange(1.5e6), np.sin(np.arange(1.5e6)))
t = time(); ax.add_line(LL); time()-t
###16.579419136047363
## We added two identical lines, each took 16 seconds.

LL = mlines.Line2D(np.arange(1.5e6), np.sin(np.arange(1.5e6)))
t = time(); ax._update_line_limits(LL); time()-t
###0.1733548641204834
## But when we made another identical line, updating the limits was
## fast.

# Below are similar experiments:
LL = mlines.Line2D(np.arange(1.5e6), 2*np.sin(np.arange(1.5e6)))
t = time(); ax._update_line_limits(LL); time()-t
###0.18362092971801758
(Continue reading)


Gmane