Skip to main content

A package for differential geometry on meshes (Laplace, FEM)

Project description

PyPI version

LaPy

LaPy is an open-source Python library for differential geometry and finite-element computations on triangle and tetrahedral meshes. It provides mesh data structures and fast, vectorized algorithms to compute differential operators, curvature flows, spectral descriptors and to solve PDEs such as Laplace, Poisson and Heat equations on surfaces and volumes.

Key design goals:

  • Pure Python 3 implementation with heavy use of NumPy and SciPy for performance.
  • Sparse, memory-efficient mesh data structures and vectorized algorithms.
  • Utilities for IO, visualization, and common geometry processing tasks.

Table of contents

Features

  • TriaMesh: triangle mesh class with orientation checking, boundary handling, normals, smoothing and quality metrics; efficient edge and adjacency representations; IO for OFF, VTK; Gifti and related formats.
  • TetMesh: tetrahedral mesh utilities, boundary handling and IO.
  • Polygon: polygon class representing open and closed polygon curves.
  • Solver: FEM routines producing stiffness and mass matrices, sparse eigenvalue solvers, Poisson and heat equation solvers, and support for anisotropic operators.
  • diffgeo: gradient, divergence, mean-curvature flow and related differential operators.
  • heat: heat kernel and diffusion utilities, geodesics via heat method.
  • shapedna: compute ShapeDNA (Laplace spectra) for shape descriptors.
  • conformal: conformal mapping methods for genus-0 surfaces.
  • io: read/write vertex functions and eigenvector files.
  • plot: lightweight Plotly wrappers for interactive visualization.

Quick start

Install the released package:

python3 -m pip install lapy

Import and inspect main classes:

import lapy as lp
help(lp.TriaMesh)
help(lp.Solver)

A minimal example (compute eigenpairs of a triangular mesh):

import lapy as lp
mesh = lp.TriaMesh.from_off('examples/data/sample.off')  # or other supported reader
solver = lp.Solver(mesh)
vals, vecs = solver.eigensystem(k=20)  # compute 20 smallest nontrivial eigenpairs

Installation

Install the development version to a chosen source location:

python3 -m pip install --user --src /my/preferred/location --editable git+https://github.com/Deep-MI/Lapy.git#egg=lapy

Dependencies and optional backends

  • Core: Python 3, NumPy, SciPy.
  • Optional (recommended): scikit-sparse (for CHOLMOD) to accelerate Cholesky sparse solves. Note: CHOLMOD (via scikit-sparse) is not currently installable via plain pip on all platforms; use conda when possible. If use_cholmod=True is requested, LaPy attempts to import CHOLMOD and will raise if it is unavailable. Install ordering: install numpy and scipy first, then scikit-sparse.

Solver backends

  • Default: SciPy sparse LU/QR routines.
  • Optional: CHOLMOD (faster for symmetric positive definite systems). Toggle with use_cholmod=True when constructing Solver.

Examples and documentation

  • Example Jupyter notebooks are available in the examples directory demonstrating common workflows (mesh IO, curvature, diffusion, ShapeDNA, geodesics).
  • Full API documentation: https://deep-mi.org/LaPy

Development and testing

  • The project includes unit tests and example notebooks. Use the development installation command above and run tests with your preferred test runner (e.g., pytest).
  • Contributions and issues are welcome via the repository issue tracker.

References

If you use LaPy in publications, please cite:

  1. Reuter M, Wolter F-E, Peinecke N. "Laplace-Beltrami spectra as 'Shape-DNA' of surfaces and solids." Computer-Aided Design. 2006;38(4):342–366. http://dx.doi.org/10.1016/j.cad.2005.10.011

  2. Wachinger C, Golland P, Kremen W, Fischl B, Reuter M. "BrainPrint: a discriminative characterization of brain morphology." NeuroImage. 2015;109:232–248. http://dx.doi.org/10.1016/j.neuroimage.2015.01.032 http://www.ncbi.nlm.nih.gov/pubmed/25613439

Additional algorithmic sources:

Website

License

  • See the repository LICENSE file for license terms.

Contact

  • Report issues or feature requests via the repository issue tracker on GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lapy-1.6.0.tar.gz (84.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lapy-1.6.0-py3-none-any.whl (90.6 kB view details)

Uploaded Python 3

File details

Details for the file lapy-1.6.0.tar.gz.

File metadata

  • Download URL: lapy-1.6.0.tar.gz
  • Upload date:
  • Size: 84.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for lapy-1.6.0.tar.gz
Algorithm Hash digest
SHA256 b29c5a1ded33ff507f01378f4dd70525d13f8b5d3219bb44d2e3ff981bbfaac0
MD5 34900bebff738eddf5790c3be415c56f
BLAKE2b-256 dd95361169d744172dd4c289bcb1d910c85294e159b3f8caae532f823e93f66e

See more details on using hashes here.

File details

Details for the file lapy-1.6.0-py3-none-any.whl.

File metadata

  • Download URL: lapy-1.6.0-py3-none-any.whl
  • Upload date:
  • Size: 90.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for lapy-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 94d0c965425abcc110a773fb51822d7a4d7123d27fbd625c0890f34c92148ecf
MD5 b6b617f9cf4e8ff16dcf446610e551d7
BLAKE2b-256 297cf74fe3536f980cebb6c117395e728ecea4711415e51898b373df78441ba0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page