Code Search for Developers
 
 
  

inside_poly_profile.py from matplotlib at Krugle


Show inside_poly_profile.py syntax highlighted

import os, sys, time

import matplotlib.nxutils as nxutils
import matplotlib.numerix as nx
import matplotlib.mlab
import matplotlib.patches as patches
if 1:
    numtrials, numverts, numpoints = 50, 1000, 1000
    verts = patches.CirclePolygon((0.5, 0.5), radius=0.5, resolution=numverts).get_verts()

    t0 = time.time()
    for i in range(numtrials):
        points = nx.mlab.rand(numpoints,2)
        mask = matplotlib.mlab._inside_poly_deprecated(points, verts)
    told = time.time() - t0

    t0 = time.time()
    for i in range(numtrials):
        points = nx.mlab.rand(numpoints,2)
        mask = nxutils.points_inside_poly(points, verts)
    tnew = time.time() - t0
    print numverts, numpoints, told, tnew, told/tnew







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