Skip to main content

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.
  • intersect: self-intersection tests for triangle meshes, and undoing vertex moves that create intersections.
  • remesh: isotropic remeshing to near-equilateral triangles that keeps the topology, and closest points on a surface.
  • topology: non-trivial loops, handle detection and surgery, to correct closed surfaces to genus 0.
  • 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: cholespy (for CHOLMOD) to accelerate sparse solves with the Cholesky decomposition. Install it with pip install lapy[chol]. If use_cholmod=True is requested without cholespy, LaPy raises an ImportError.

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.

Metadata

Release files for lapy 1.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lapy 1.8.0
File Size Uploaded Provenance Actions
lapy-1.8.0.tar.gz 115.0 kB Without provenance Details for lapy-1.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lapy 1.8.0
File Interpreter ABI Platform Actions
lapy-1.8.0-py3-none-any.whl Python 3 none any Details for lapy-1.8.0-py3-none-any.whl

Total release size: 237.1 kB

Release files / lapy-1.8.0.tar.gz

Download URL lapy-1.8.0.tar.gz
Size 115.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4fbae7f07b9bee9fe8305c86832fe490da29a6a45c48a721b34117e590ae7cae
BLAKE2b-256 checksum
How to use checksums
62d9ad7bef8fe3f00afd376fc6a2f4699df3c9956f4ad92ea3554d73a917754f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.18

Release files / lapy-1.8.0-py3-none-any.whl

Download URL lapy-1.8.0-py3-none-any.whl
Size 122.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
917bc880dc3a622cdfcd665dd49b382786f307e2cefd833c10875737bcfbd7c2
BLAKE2b-256 checksum
How to use checksums
c9373c48e965f4faf3b7ea418324d361063071e8f5838684f1cd21f680656634
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.18

Security for lapy 1.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page