Re: [matplotlib-devel] zooming related bug? fades to white.

2006-12-05 Thread Tim Hirzel
Glad I'm not the only one...
well, I did some more investigation.  I get that slowdown too, and it 
seems potentially related.  the slowdown is happening in the call
im.resize(int(widthDisplay+0.5), int(heightDisplay+0.5),
  norm=self._filternorm, radius=self._filterrad)

near line 162 in image.py

as you zoom, the time it takes to execute that line grows 
exponentially.  this is where it heads into compiled dll land as resize 
is impemented in _image.cpp
see here:
http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/src/_image.cpp?view=markup

I don't have a build setup for matplotlib, so I am holding off on doing 
some printf investigations on _image.cpp, but perhaps this can help 
track it down?  Since it is independent of interpolation, shouldn't it 
be something going on between lines 328 and 445 of _image.cpp?


t

Eric Firing wrote:
> I have verified this behavior briefly on a Linux machine.  In 
> addition, the redraw after zoom gets extremely slow.  I have never 
> worked with the image internals and I don't have any idea where the 
> problem is coming from.
>
> Eric
>
> Tim Hirzel wrote:
>> To the fantastic matplotlib developers,
>> I am having a strange behavior when using zooming.  I have tried it 
>> with WX, Wxagg, and TKagg, and with Numeric and numpy.  It occurs in 
>> multiple interpolation types as well.   The best way to see this 
>> behavior is to use the image_interp.py example.  If you zoom in 
>> enough, the image starts to fade to white, and then turn completely 
>> white.  If you zoom in to about where the zoom the axes area spans 
>> 0.1 units, it should still look fine, but then a span of 0.01 unit 
>> will be all white.  If you zoom in slowly to where the color is 
>> starting to wash out to white, then resize the window, you will see 
>> more strange whitening behavior (the color fluctuates between white 
>> and the correct color as you change the window size).   This is on a 
>> windows machine with Python 2.4.
>> Another clue.  if I save the white appearing axes to a png, it looks 
>> fine.
>> the way it fades out almost seems like something going wrong with an 
>> alpha value somewhere...
>> any thoughts?
>>
>> thanks,
>> Tim
>
>

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] memory problem

2006-12-05 Thread Lisa Engblom

Hi,

I am using matplotlib with python to generate a bunch of charts.  I use
IDLE, have numpy version 1.0, and pylab version 2.5 with TkAgg if that is
relavant.  My
code works fine for a single iteration, which creates and saves 4
different charts.  The trouble is that when I try to run it for the
entire set (about 200 items) it can run for 12 items at a time, generating
48 charts.  On the
13th, I get an error from matplotlib that says it can't access data.
However, if I start the program at the point it just failed, it works
fine and will create the charts for the next 12 before failing.  I
assume that I am not closing the files properly somehow or otherwise
misallocating memory.  I tried just reimporting pylab each iteration,
but that didn't help.  This is the function that creates a chart:

#create and save the figure
def CreateFigure(state, facility, unit, SO2, increment, year, P99):
   size = len(SO2)

   #Create Plot
   figure(1, figsize=(10,8))
   bar(range(1, size+2), SO2, width=0.1, color='k')
   grid(True)
   xlim(0,size)
   ylim(0, 1.1*SO2[-1])
   ylabel('SO2 [lb/hr]')
   heading = ConstructFigName(state, facility, unit, increment, year)
   title(heading)

   #set handles
   xticklines = getp(gca(), 'xticklines')
   xgridlines = getp(gca(), 'xgridlines')
   xticklabels = getp(gca(), 'xticklabels')
   yticklines = getp(gca(), 'yticklines')

   #set properties
   setp(xticklines, visible=False)
   setp(xgridlines, visible=False)
   setp(xticklabels, visible=False)
   setp(yticklines, visible=False)

   axhspan(P99, P99, lw=3, ec='r', fc='r')
   ax = gca()
   P99 = '%0.1f' % P99
   text(0.01, 0.95, '99th Percentile: '+P99+' lb/hr',
transform=ax.transAxes)

   figpath = ConstructFigPath(state, facility, unit, increment, year)
   savefig(figpath)
   close()

Can you see the problem? If there is nothing obviously wrong... I tried to
run the memory leak algorithm from the website, but the line:
a2 = os.popen('ps -p %d -o rss,sz' % pid).readlines()
generates an empty list rather than information about about memory, and I am
not clear on how to modify it to do something useful.

thanks,
-Lisa
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel