spharapy.spharabasis: SPHARA Basis

SPHARA basis functions

This module provides a class for determining SPHARA basis functions. Methods are provided to determine basis functions using different discretization schemes of the Laplace-Beltrami operator, as FEM, inverse euclidean and unit.

class spharapy.spharabasis.SpharaBasis(triangsamples=None, mode='fem')[source]

Bases: object

SPHARA basis functions class

This class can be used to determine SPHARA basis functions for spatially irregularly sampled functions whose topology is described by a triangular mesh.

Parameters
triangsamplestrimesh object

A trimesh object from the package spharapy in which the triangulation of the spatial arrangement of the sampling points is stored. The SPHARA basis functions are determined for this triangulation of the sample points.

mode{‘unit’, ‘inv_euclidean’, ‘fem’}, optional

The discretization method used to estimate the Laplace-Beltrami operator. Using the option ‘unit’ all edges of the mesh are weighted by unit weighting function. The option ‘inv_euclidean’ results in edge weights corresponding to the inverse Euclidean distance of the edge lengths. The option ‘fem’ uses a FEM discretization. The default weighting function is ‘fem’.

Attributes
triangsamples: trimesh object

Triangulation of the spatial arrangement of the sampling points

mode: {‘unit’, ‘inv_euclidean’, ‘fem’}

Discretization used to estimate the Laplace-Beltrami operator

basis()[source]

Return the SPHARA basis for the triangulated sample points

This method determines a SPHARA basis for spatially distributed sampling points described by a triangular mesh. A discrete Laplace-Beltrami operator in matrix form is determined for the given triangular grid. The discretization methods for determining the Laplace-Beltrami operator is specified in the attribute mode. The eigenvectors \(\vec{x}\) and the eigenvalues \(\lambda\) of the matrix \(L\) containing the discrete Laplace-Beltrami operator are the SPHARA basis vectors and the natural frequencies, respectively, \(L \vec{x} = \lambda \vec{x}\).

Parameters
Returns
basisarray, shape (n_points, n_points)

Matrix, which contains the SPHARA basis functions column by column. The number of vertices of the triangular mesh is n_points.

frequenciesarray, shape (n_points, 1)

The natural frequencies associated to the SPHARA basis functions.

Examples

>>> from spharapy import trimesh as tm
>>> from spharapy import spharabasis as sb
>>> testtrimesh = tm.TriMesh([[0, 1, 2]], [[1., 0., 0.], [0., 2., 0.],
...                                        [0., 0., 3.]])
>>> sb_fem = sb.SpharaBasis(testtrimesh, mode='fem')
>>> sb_fem.basis()
(array([[ 0.53452248, -0.49487166,  1.42857143],
        [ 0.53452248, -0.98974332, -1.14285714],
        [ 0.53452248,  1.48461498, -0.28571429]]),
 array([  2.33627569e-16,   1.71428571e+00,   5.14285714e+00]))
massmatrix()[source]

Return the massmatrix

The method returns the mass matrix of the triangular mesh.

property mode

Get or set the discretization method.

The discretization method used to estimate the Laplace-Beltrami operator, choosen from {‘unit’, ‘inv_euclidean’, ‘fem’}. Setting the triangsamples object will simultaneously check the correct format.

property triangsamples

Get or set the triangsamples object.

The parameter triangsamples has to be an instance of the class spharapy.trimesh.TriMesh. Setting the triangsamples object will simultaneously check the correct format.