moved teh get_simplex_extra_points to interp.grid
This commit is contained in:
parent
e50e12dcbe
commit
729dac0e90
@ -35,6 +35,17 @@ class grid(object):
|
|||||||
pickle.dump([f.verts for f in self.cells.itervalues()],
|
pickle.dump([f.verts for f in self.cells.itervalues()],
|
||||||
open(cfile, 'w'))
|
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):
|
def contains(X, R):
|
||||||
"""
|
"""
|
||||||
|
@ -1,20 +1,9 @@
|
|||||||
import scipy.spatial
|
import scipy.spatial
|
||||||
|
|
||||||
from interp.grid import grid as basegrid
|
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):
|
class dgrid(basegrid):
|
||||||
def __init__(self, points, values):
|
def __init__(self, points, values):
|
||||||
self.points = points
|
self.points = points
|
||||||
|
Loading…
Reference in New Issue
Block a user