The ImprovedTessellation module

This implements a ImprovedTessellation, a subclass of scipy.spatial.Delaunay which provides support for extrapolation outside the grid of points, as well as various utility methods.

class ImprovedTessellation.ImprovedTessellation(points)[source]

A class which extends scipy.spatial.Delaunay thereby providing an improved tessellation which allows the user to find the nearest simplex outside the convex hull of the grid of points upon which the tessellation is built. This facilitates extrapolation outside the grid of points.

Parameters:points ((npoints, ndim) numpy float array) – coordinates of the points to triangulate
convex_hull_array = None

Array representation of the facets which make up the convex hull

facet_to_simplex = None

Lookup array which gives the index of the simplex corresponding to each facet from the convex hull

find_barycentre_distances()[source]

Find minimun and maximum distances between the barycentres of the simplices and points which make up these simplices.

Returns:the set of distances
Return type:2D numpy float array
find_barycentres()[source]

Find the barycentres of the simplices.

Returns:the set of barycentres
Return type:2D numpy float array
find_distances(points)[source]

Find minimun and maximum distances between a given set of points, and the points of the closest simplices.

Parameters:points ((npoints, ndim) numpy float array) – coordinates of the points for which we would like to find the maximum and minimum distances
Returns:the set of distances
Return type:2D numpy float array
find_simplex(pt)[source]

Find the simplices containing the given points. If the given point is outside the convex hull of the grid of points, find nearest simplex with the most favourable height.

Parameters:pt (array-like of floats) – point for which we’re searching for the containing or nearest simplex
Returns:the index of the containing or nearest simplex
Return type:int
find_simplex_volumes()[source]

Find volumes of simplices.

Returns:the set of volumes
Return type:1D numpy float array
static point_simplex_distance(pt, simplex)[source]

Recursive function which finds the distance between a simplex and a point. Reference: Golubitsky, O., Mazalov, V., Watt, S. M. (2015)

Parameters:
  • pt (numpy 1D float array) – n-dimensional point
  • simplex ((d,n) numpy array) – a (d-1)-dimensional simplex (d-1 <= n)
Returns:

the distance between pt and the closest point in simplex

Return type:

float

simplex_to_simplex_array(val)[source]

Convert an index representing a simplex to an array representation.

Parameters:val (integer) – index corresponding to a simplex
Returns:an array representation of the simplex
Return type:(ndim+1,ndim) numpy float array
static simplex_volume(simplex)[source]

Calculate the volume of a simplex. The approach used here also works for simplices embedded in higher dimensional spaces (e.g. a triangle in 3D space).

Parameters:simplex ((d,n) numpy array) – a (d-1)-dimensional simplex (d-1 <= n)
Returns:the volume of the simplex
Return type:float