moved teh get_simplex_extra_points to interp.grid

This commit is contained in:
Stephen M. McQuay 2011-09-21 12:14:47 -06:00
parent e50e12dcbe
commit 729dac0e90
2 changed files with 12 additions and 12 deletions

View File

@ -35,6 +35,17 @@ class grid(object):
pickle.dump([f.verts for f in self.cells.itervalues()],
open(cfile, 'w'))
def get_simplex_extra_points(X, points, triangulation, kdtree, extra_points=8):
simplex_id = triangulation.find_simplex(X)
simplex_verts_ids = set(triangulation.vertices[simplex_id])
distances, kdt_ids = kdtree.query(X, extra_points + len(simplex_verts_ids))
kdt_ids = set(kdt_ids)
simplex_ids = list(simplex_verts_ids)
extra_points_ids = list(kdt_ids - simplex_verts_ids)
return simplex_ids, extra_points_ids
def contains(X, R):
"""

View File

@ -1,20 +1,9 @@
import scipy.spatial
from interp.grid import grid as basegrid
from interp.grid import get_simplex_extra_points
def get_simplex_extra_points(X, points, triangulation, kdtree, extra_points=8):
simplex_id = triangulation.find_simplex(X)
simplex_verts_ids = set(triangulation.vertices[simplex_id])
distances, kdt_ids = kdtree.query(X, extra_points + len(simplex_verts_ids))
kdt_ids = set(kdt_ids)
simplex_ids = list(simplex_verts_ids)
extra_points_ids = list(kdt_ids - simplex_verts_ids)
return simplex_ids, extra_points_ids
class dgrid(basegrid):
def __init__(self, points, values):
self.points = points