lapy.shapedna

Functions for computing and comparing Laplace spectra.

Includes code for solving the anisotropic Laplace-Beltrami eigenvalue problem as well as functions for normalization and comparison of Laplace spectra.

lapy.shapedna.compute_distance(ev1, ev2, dist='euc')

Compute the shape dissimilarity from two shapeDNA descriptors.

Parameters:
ev1array_like

First set of sorted eigenvalues.

ev2array_like

Second set of sorted eigenvalues.

diststr

Distance measure; currently only ‘euc’ (Euclidean).

Returns:
*float

Distance between the eigenvalue arrays.

lapy.shapedna.compute_shapedna(geom, k=50, lump=False, aniso=None, aniso_smooth=10, use_cholmod=False)

Compute the shapeDNA descriptor for triangle or tetrahedral meshes.

Parameters:
geomTriaMesh or TetMesh

Mesh geometry.

kint, default=50

Number of eigenfunctions / eigenvalues.

lumpbool, default=False
If True, lump the mass matrix (diagonal).

(See ‘lapy.Solver.Solver’ class).

anisofloat or tuple of shape (2,)
Anisotropy for curvature based anisotopic Laplace.

(See ‘lapy.Solver.Solver’ class).

aniso_smoothint
Number of smoothing iterations for curvature computation on vertices.

(See ‘lapy.Solver.Solver’ class).

use_cholmodbool, default: False

If True, attempts to use the Cholesky decomposition for improved execution speed. Requires the scikit-sparse library. If it can not be found, an error will be thrown. If False, will use slower LU decomposition.

Returns:
evdict

A dictionary, including ‘Eigenvalues’ and ‘Eigenvectors’ fields.

lapy.shapedna.normalize_ev(geom, evals, method='geometry')

Normalize a surface or a volume.

Parameters:
geomTriaMesh or TetMesh

Mesh geometry.

evalsarray_like

Set of sorted eigenvalues.

methodstr

Either “surface”, “volume”, or “geometry”; “geometry” will perform surface normalization for 2D objects, and volume normalization for 3D objects.

Returns:
array_like

Vector of re-weighted eigenvalues.

lapy.shapedna.reweight_ev(evals)

Apply linear re-weighting.

Parameters:
evalsarray_like

Set of sorted eigenvalues.

Returns:
evals: array_like

Vector of re-weighted eigenvalues.