Code Search for Developers
 
 
  

transform_memleak.py from matplotlib at Krugle


Show transform_memleak.py syntax highlighted

import sys, time, os
from helpers import rand_val, rand_point, rand_bbox, rand_transform
from matplotlib.numerix.mlab import rand


def report_memory(i):
    pid = os.getpid()
    if sys.platform=='sunos5':
        command = 'ps -p %d -o rss,osz' % pid
    else:
        'ps -p %d -o rss,sz' % pid
    a2 = os.popen(command).readlines()
    print i, '  ', a2[1],
    return int(a2[1].split()[1])


N = 200
for i in range(N):
    v1, v2, v3, v4, v5 = rand_val(5)
    b1 = v1 + v2
    b2 = v3 -v4
    b3 = v1*v2*b2 - b1


    p1 = rand_point()
    box1 = rand_bbox()
    t = rand_transform()
    N = 10000
    x, y = rand(N), rand(N)
    xt, yt = t.numerix_x_y(x, y)
    xys = t.seq_xy_tups( zip(x,y) )
    val = report_memory(i)
    if i==1: start = val

end = val
print 'Average memory consumed per loop: %1.4f\n' % ((end-start)/float(N))





See more files for this project here

matplotlib

Matplotlib is a pure python plotting library with the goal of making\r\npublication quality plots using a syntax familiar to matlab users. \r\nThe library uses Numeric for handling large\r\ndata sets and supports a variety of output backends

Project homepage: http://sourceforge.net/projects/matplotlib
Programming language(s): C,C++,Python
License: other

  pathologies/
    const_xy.py
    shapes.py
    single_date.py
    single_point.py
    test.py
  __init__.py
  agg_memleak.py
  auto_legend.py
  dates_unit.py
  ft2font_memleak.py
  helpers.py
  inside_poly_memleak.py
  inside_poly_profile.py
  legend_unit.py
  longs_test.py
  memleak_gui.py
  memleak_hawaii3.py
  memleak_nongui.py
  memleak_transforms.py
  override_builtins.py
  simple_plot.py
  test_wxagg.py
  transform_memleak.py
  transforms_unit.py