[Matplotlib-users] suspect memory leak in Agg backend

2007-07-13 Thread Emanuele Passera
Hi all guys,
I'm experiencing a problem with automatic generation of .png figure using Agg 
backend. What i do is opening, saving and closing figure in a for statement 
without showing them up.
Let's say approximatively 400 figures for a total of 160 MB disk space.
I do not use an interactive shell.
Sometimes (not always) i get an error message saying that is impossible to 
allocate new memory. So, can it be a memory leak problem in Agg backend ?

I use Python 2.3 and maptplotlib 0.87.6 on a 
Linux HPC5 2.6.9-42.0.2.ELhugemem #1 SMP Thu Aug 17 18:22:52 EDT 2006 i686 
athlon i386 GNU/Linux








-- 
--
Emanuele Passera

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Problems with auto scaling with infinite values

2007-07-13 Thread John Travers
Hi all,

If I try to plot a graph with some y-values as -inf (which is very
common in physical sciences as we often take log10 of amplitude values
which can be zero), then matplotlib raises an exception:

/usr/lib/python2.5/site-packages/matplotlib/ticker.py in
scale_range(vmin, vmax, n, threshold)
814 offset = 10**ex
815 else:
-- 816 ex = divmod(math.log10(-meanv), 1)[0]
817 offset = -10**ex
818 ex = divmod(math.log10(dv/n), 1)[0]

type 'exceptions.OverflowError': math range error

It is clear where the problem is, matplotlib takes log10 of the mean
y-range (in this case infinity) to auto scale the y-axis.

I know I can modify my input values to get around this problem, but it
is so common to want to plot data (some of which may be zero) in say a
decibel scale, that having a workaround for the case of -inf input
would be nice. I tried to look into writing one myself, but got
quickly lost. If someone could point me at the files/functions I
should look at I will have a go.

Hope somebody can help!

Best regards,
John Travers

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] suspect memory leak in Agg backend

2007-07-13 Thread John Hunter
On 7/13/07, Emanuele Passera [EMAIL PROTECTED] wrote:
 Hi all guys,
 I'm experiencing a problem with automatic generation of .png figure using Agg
 backend. What i do is opening, saving and closing figure in a for statement
 without showing them up.
 Let's say approximatively 400 figures for a total of 160 MB disk space.
 I do not use an interactive shell.
 Sometimes (not always) i get an error message saying that is impossible to
 allocate new memory. So, can it be a memory leak problem in Agg backend ?

Take a look at unit/memleak_hawaii3.py.  Does it leak on your system?
If not (and it does not appear to be on ourson ours), maybe you can
compare what is different and try and isolate the part that is
leaking.

http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/unit/memleak_hawaii3.py?view=markup

JDH

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] memory leak in Agg backend

2007-07-13 Thread Emanuele Passera
Hi all,
a few hours ago I have wtitten for a possible memory leak in Agg backend.
It was my fault. It was a bad placement of matplotlibrc file.
Sorry for the raised alarm.
Instead i am glad to say that I have checked for the Agg backend with a for 
statement of opening a figure, drawing, saving and closing and a real time 
monitoring of machine memory used and I can say that has not a memory leak.


-- 
--
Emanuele Passera

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problems with auto scaling with infinite values

2007-07-13 Thread Darren Dale
On Friday 13 July 2007 09:13:03 am John Travers wrote:
 Hi all,

 If I try to plot a graph with some y-values as -inf (which is very
 common in physical sciences as we often take log10 of amplitude values
 which can be zero), then matplotlib raises an exception:

 /usr/lib/python2.5/site-packages/matplotlib/ticker.py in
 scale_range(vmin, vmax, n, threshold)
 814 offset = 10**ex
 815 else:
 -- 816 ex = divmod(math.log10(-meanv), 1)[0]
 817 offset = -10**ex
 818 ex = divmod(math.log10(dv/n), 1)[0]

 type 'exceptions.OverflowError': math range error

 It is clear where the problem is, matplotlib takes log10 of the mean
 y-range (in this case infinity) to auto scale the y-axis.

 I know I can modify my input values to get around this problem, but it
 is so common to want to plot data (some of which may be zero) in say a
 decibel scale, that having a workaround for the case of -inf input
 would be nice. I tried to look into writing one myself, but got
 quickly lost. If someone could point me at the files/functions I
 should look at I will have a go.

I think this might trace back to Interval.get_bounds() in src/_transforms.h. 
Maybe we could consider an additional Interval method like 
Interval.get_finite_bounds(), which could do something like numpy's isfinite 
function to filter values that can not be plotted. But I'm not an expert on 
mpl's transforms, so perhaps someone more knowledgeable can comment.

Darren

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] suspect memory leak in Agg backend

2007-07-13 Thread Michael Droettboom
I'm been looking at a lot of memory leaks as of late, but have not come 
across any in the Agg backend.  Can you send a snippet of code that 
reproduces your error?  Perhaps there is some particular operation or 
set of operations that triggers a leak.

Cheers,
Mike

Emanuele Passera wrote:
 Hi all guys,
 I'm experiencing a problem with automatic generation of .png figure using Agg 
 backend. What i do is opening, saving and closing figure in a for statement 
 without showing them up.
 Let's say approximatively 400 figures for a total of 160 MB disk space.
 I do not use an interactive shell.
 Sometimes (not always) i get an error message saying that is impossible to 
 allocate new memory. So, can it be a memory leak problem in Agg backend ?

 I use Python 2.3 and maptplotlib 0.87.6 on a 
 Linux HPC5 2.6.9-42.0.2.ELhugemem #1 SMP Thu Aug 17 18:22:52 EDT 2006 i686 
 athlon i386 GNU/Linux

   


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problems with auto scaling with infinite values

2007-07-13 Thread Darren Dale
On Friday 13 July 2007 10:32:15 am John Hunter wrote:
 On 7/13/07, Darren Dale [EMAIL PROTECTED] wrote:
  I think this might trace back to Interval.get_bounds() in
  src/_transforms.h. Maybe we could consider an additional Interval method
  like
  Interval.get_finite_bounds(), which could do something like numpy's
  isfinite function to filter values that can not be plotted. But I'm not
  an expert on mpl's transforms, so perhaps someone more knowledgeable can
  comment.

 I'm happy to do this, if someone can advise how to get a portable
 isinf.  
[...]
 I would be happy to 
 import it from numpy (since we can now rely on it, woohoo) but am
 having trouble here too  

If we can figure out how to get it from numpy, we can use numpy's isnan as 
well, and drop that bit of extension code from mpl's sources.

 I see isfinite defined in 
 umathmodule.c.src (and also in ufuncobject.h but only for _MSC_VER.
 If anyone can advise on how to get isinf or isfinite, pease do.

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problems with auto scaling with infinite values

2007-07-13 Thread John Hunter
On 7/13/07, Darren Dale [EMAIL PROTECTED] wrote:

 I think this might trace back to Interval.get_bounds() in src/_transforms.h.
 Maybe we could consider an additional Interval method like
 Interval.get_finite_bounds(), which could do something like numpy's isfinite
 function to filter values that can not be plotted. But I'm not an expert on
 mpl's transforms, so perhaps someone more knowledgeable can comment.

I'm happy to do this, if someone can advise how to get a portable
isinf.  I tried including math.h after reading

http://www.google.com/url?sa=tct=rescd=1url=http%3A%2F%2Fwww.opengroup.org%2Fonlinepubs%2F009695399%2Ffunctions%2Fisinf.htmlei=wYqXRr7IAovwiwHolJn2Bwusg=AFQjCNGAlh-XN0EWgSuTSEsOLPLNCiTxNwsig2=KAxpuLGHMuqoeGtzTz85YQ

but the symbol isn't found there on my system.  I would be happy to
import it from numpy (since we can now rely on it, woohoo) but am
having trouble here too  I see isfinite defined in
umathmodule.c.src (and also in ufuncobject.h but only for _MSC_VER.
If anyone can advise on how to get isinf or isfinite, pease do.

JDH

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Properly aligned tick labels on the inside

2007-07-13 Thread Anthony M. Floyd
For the archives (and further proof that programming done during the
witching hour between 4pm and 5pm should be avoided at all costs):

The solution is easy.

 for tick in axes.yaxis.get_major_ticks():
 tick.set_pad(-25)
 tick.label2.set_horizontalalignment('right')

A
 

 -Original Message-
 From: Anthony M. Floyd 
 Sent: July 12, 2007 4:37 PM
 To: matplotlib-users@lists.sourceforge.net
 Subject: [Matplotlib-users] Properly aligned tick labels on the inside
 
 Hi All,
 
 I'm trying to plot tick labels on the inside (ie data side) 
 of a typical x-y plot.  My setup is Python 2.5.1, matplotlib 
 0.90.0 on WinXP.
 
 I've been able to accomplish this by adjusting the padding of 
 the individual ticks, but it doesn't quite accomplish what I want.
 
 For example, imagine a typical x-y plot, except that the tick 
 labels are on the right-hand side (by setting 
 axes.yaxis.tick_right()).  Adjusting the padding of the ticks 
 by doing:
 
 for tick in axes.yaxis.get_major_ticks():
 tick.set_pad(-25)
 
 I'm able to get the numbers to appear about where I want.  
 The problem is that these numbers are left aligned.  So, it 
 works fine for small numbers, but for large numbers, or when 
 my tick formatter switches over to using scientific notation 
 the numbers will overlap the axis.  If my labels are on the 
 inside of the right-hand side, I want them to be 
 right-aligned and grow left towards the centre of the plot.
 
 I thought about doing it by setting tick_left() and then 
 using a (large) computed pad, but then the tick lines are on 
 the wrong side.
 
 So, my question is: can I get right-aligned tick labels on 
 the right-side of a plot?  How?
 
 I suspect I can do this by using 
 axis.set_offset_position('...'), but I've been unable to get 
 that to do anything in my tests using pylab.
 
 I can post code if it'll be helpful.
 
 Thanks,
 Anthony.
 
 --
 Anthony Floyd, PhD
 Convergent Manufacturing Technologies Inc.
 6190 Agronomy Rd, Suite 403
 Vancouver BC  V6T 1Z3
 CANADA
 
 Email: [EMAIL PROTECTED] | Tel:   604-822-9682
 WWW:   http://www.convergent.ca| Fax:   604-822-9659  
 
 CMT is hiring: See http://www.convergent.ca for details
 
 
 
 --
 ---
 This SF.net email is sponsored by DB2 Express Download DB2 
 Express C - the FREE version of DB2 express and take control 
 of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problems with auto scaling with infinite values

2007-07-13 Thread Andrew Straw
Darren Dale wrote:
 If we can figure out how to get it from numpy, we can use numpy's isnan as 
 well, and drop that bit of extension code from mpl's sources.

Done in r3512. Hurray for inclusion instead of code duplication. (I 
originally copied that stuff from numarray, which inspired numpy's 
design of that stuff, but since back then would couldn't depend on 
either...)

  On Friday 13 July 2007 10:32:15 am John Hunter wrote:
  I'm happy to do this, if someone can advise how to get a portable
  isinf.

Also in r3512, I inserted the definition of isfinite, copied from 
numpy's umathmodule.c.src at the top of _transforms.cpp. If it works for 
numpy, it should work for us.

I'm slightly worried that this stuff will break on MSVC... Does anyone 
have the ability to test this svn revision sooner than later?

-Andrew

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users