neurotools.spatial.triangulation module

Routines for meshes and triangulation

neurotools.spatial.triangulation.z2xy(z)[source]

Converts an array of complex numbers into two arrays representing real and imaginary parts, respectively.

neurotools.spatial.triangulation.uniquerow(x)[source]

Removes duplicate rows from a 2D numpy array

neurotools.spatial.triangulation.trianglesToEdges(triangles)[source]

Accepts Ntriangles x 3 array of triangle indeces, the format returned by scipy.spatial.Delaunay(…).simplices. Returns a Nedges x 2 numpy array of unique edges in the triangulation

neurotools.spatial.triangulation.edgesNearby(iz, microd)[source]

Returns a dictionary mapping from indecies into point list iz (2d locations passed as x+iy complex) to a list of nearby point indices

Computed by thresholding delaunay triangulation

neurotools.spatial.triangulation.coalesce(iz, edgelist)[source]

Join connected components as defined in edgelist, and return the centroids taken as an average of all point locations in list iz (2d locations passed as x+iy complex)

neurotools.spatial.triangulation.plot_edges(iz, edges, **kwargs)[source]

Plots a set of edges given by 2d complex numbers and Nedges x 2 array of edge indices keword arguments are forwarded to matplotlib.plot

Parameters:
  • is

  • edges

  • **kwargs – Forward to plot()

neurotools.spatial.triangulation.plot_triangles(iz, triangles, **kwargs)[source]
Parameters:
  • iz

  • triangles

  • **kwargs – Forward to plot()

neurotools.spatial.triangulation.mergeNearby(x, y, radius)[source]

Merge nearby points

Parameters:
  • x

  • y

  • radius