Skip to main content

Fast ellipse tangency solver

Project description

EllPHi – a fast ellipse-tangency solver for anisotropic persistent homology

CI codecov ellphi-logo

EllPHi brings anisotropy to persistent-homology workflows.

Starting from an ordinary point cloud, it estimates local covariance, inflates ellipsoids instead of balls, and feeds the resulting tangency distance into your favourite PH backend (HomCloud, Ripser, and so on). The result: cleaner barcodes, longer lifetimes, and ring structures that survive heavy noise — all without rewriting your topology code.

Features

  • Ellipse Creation: Easily create ellipses from covariance matrices or directly from point cloud neighborhoods.
  • Tangency Distance: Compute the tangency distance between pairs of ellipses, a key component for anisotropic persistent homology.
  • High-Performance Backend: Includes a C++ backend for fast and efficient tangency calculations, with a pure Python fallback for portability.
  • N-Dimensional Support: Works with n-dimensional ellipsoids, allowing for analysis in higher-dimensional spaces.
  • Visualization: Comes with helper functions to quickly visualize ellipse clouds using Matplotlib.

Installation

Install from PyPI:

pip install ellphi

To install with demo dependencies for notebooks and examples:

pip install ellphi[demo]

Optional Eigen build (from source)

If you build from source (for example, with poetry install), you can enable the C++ linear algebra implementation based on Eigen.

Install Eigen headers:

  • Ubuntu: apt-get install libeigen3-dev
  • macOS (Homebrew): brew install eigen

Then build with:

ELLPHI_USE_EIGEN=1 ELLPHI_EIGEN_INCLUDE=/usr/include/eigen3 poetry install

On macOS, use /opt/homebrew/include/eigen3 (Apple Silicon) or /usr/local/include/eigen3 (Intel).

Supported Python Versions

Python 3.10 or later.

Quick start

Install and solve a tangency query in just a few lines:

pip install ellphi
import numpy as np
import ellphi

pcoef = ellphi.coef_from_cov([0.0, 0.0], [[0.2, 0.0], [0.0, 0.1]])[0]
qcoef = ellphi.coef_from_cov([1.0, 0.25], [[0.15, 0.0], [0.0, 0.25]])[0]

result = ellphi.tangency(pcoef, qcoef)
print(f"t = {result.t:.3f}")       # tangency distance
print(f"point = {result.point}")

Usage

Here's a complete example of how to create an ellipse cloud from a point cloud and compute the pairwise tangency distances:

import numpy as np
import ellphi

# 1. Generate a sample point cloud
np.random.seed(42)
X = np.random.rand(100, 2)

# 2. Create an ellipse cloud from the point cloud
# This will estimate the local covariance for each point's neighborhood
ellipses = ellphi.ellipse_cloud(X, k=5)

# 3. Compute the pairwise tangency distances
# This will use the C++ backend if available
distances = ellipses.pdist_tangency()

print("Computed tangency distances for", len(distances), "pairs of ellipses.")

For deeper workflows, see the accompanying notebooks:

Check the installed version

Inside Python:

import ellphi

print(ellphi.version_info())

From the shell:

python -m ellphi --version

Build info (including the C++ linear algebra choice):

python -m ellphi --build-info

Contributing

Interested in contributing? We welcome pull requests!

Please read CONTRIBUTING.md for the branching/versioning flow and AGENTS.md (plus .github/workflows/python-app.yml) for the required local checks before opening a PR.

To get started with development, clone the repository and set up your environment:

git clone https://github.com/t-uda/ellphi.git
cd ellphi

# Install dependencies, including development tools
poetry install --with dev

# Run the tests to make sure everything is set up correctly
poetry run pytest

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

ellphi-0.1.2.tar.gz (41.3 kB view details)

Uploaded Source

Built Distributions

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

ellphi-0.1.2-cp312-cp312-win_amd64.whl (52.2 kB view details)

Uploaded CPython 3.12Windows x86-64

ellphi-0.1.2-cp312-cp312-manylinux_2_39_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

ellphi-0.1.2-cp311-cp311-win_amd64.whl (52.2 kB view details)

Uploaded CPython 3.11Windows x86-64

ellphi-0.1.2-cp311-cp311-manylinux_2_39_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

ellphi-0.1.2-cp310-cp310-win_amd64.whl (52.2 kB view details)

Uploaded CPython 3.10Windows x86-64

ellphi-0.1.2-cp310-cp310-manylinux_2_39_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.39+ x86-64

File details

Details for the file ellphi-0.1.2.tar.gz.

File metadata

  • Download URL: ellphi-0.1.2.tar.gz
  • Upload date:
  • Size: 41.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ellphi-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c8bc7e9a85683fc0cec036b680a45407a10cf7c06ec059a6f9a9cd9c4cdba116
MD5 be4ee0271a51e11e4ea56f31e0cd30c3
BLAKE2b-256 ebb1588ca20ea40115e486e42c2b222da1a3e2d8a54717c529aa8d3e5f90edeb

See more details on using hashes here.

Provenance

The following attestation bundles were made for ellphi-0.1.2.tar.gz:

Publisher: release.yml on t-uda/ellphi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ellphi-0.1.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: ellphi-0.1.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 52.2 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ellphi-0.1.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8a1024539b5282fc50339a31a9f08c6e9ae2237ab5c43642eb695c0795925222
MD5 fe5a8685427e5766738938645ee21945
BLAKE2b-256 262340ef263eb40dc361b7ec8b88b27c3cea291e005a2310622db2e361292aba

See more details on using hashes here.

Provenance

The following attestation bundles were made for ellphi-0.1.2-cp312-cp312-win_amd64.whl:

Publisher: release.yml on t-uda/ellphi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ellphi-0.1.2-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for ellphi-0.1.2-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 b063e735532df6092e6cf03a8c774faeface907d0fce67176b2d6e349e2187c9
MD5 a1b1c3347575ef3539eb245d3714080c
BLAKE2b-256 a014dc242856414c9f9f2c027417230c3973f85951e08c9e822ead2a6ef4e439

See more details on using hashes here.

Provenance

The following attestation bundles were made for ellphi-0.1.2-cp312-cp312-manylinux_2_39_x86_64.whl:

Publisher: release.yml on t-uda/ellphi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ellphi-0.1.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: ellphi-0.1.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 52.2 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ellphi-0.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 29daed74e20461765775338201088290af415dcf887a8a715a071415e4d90f8a
MD5 a4b665fc48a864584b8c5914c84cd8ac
BLAKE2b-256 0ec84116c996e784936e478cebff9e1298de103da91ba8acf27382fbcbb726f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for ellphi-0.1.2-cp311-cp311-win_amd64.whl:

Publisher: release.yml on t-uda/ellphi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ellphi-0.1.2-cp311-cp311-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for ellphi-0.1.2-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 c9bf2a463a966ec2b893497bab49621504255b613ac0f56b21ed01fa3d77368e
MD5 735175ee6fa91110c5f2bdfc568c6438
BLAKE2b-256 8b56c8f297ce14b9d63302581377a3e3b2ac6a8bff01cbe923b043344f620d07

See more details on using hashes here.

Provenance

The following attestation bundles were made for ellphi-0.1.2-cp311-cp311-manylinux_2_39_x86_64.whl:

Publisher: release.yml on t-uda/ellphi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ellphi-0.1.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: ellphi-0.1.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 52.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ellphi-0.1.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c3b3461c7b04f2e08d741e885cf050a955f12cb38842a2ad1de15ae15d77794b
MD5 92265e8b933730565d3d393b2e5a9930
BLAKE2b-256 3f36dc695eefcd267a357c86e8d581a86c0d83873ac57fa5647ddea855b08fa4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ellphi-0.1.2-cp310-cp310-win_amd64.whl:

Publisher: release.yml on t-uda/ellphi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ellphi-0.1.2-cp310-cp310-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for ellphi-0.1.2-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 24d51403025c66b051ede756d630a67a483cfd0ac9a653ed09e39d658c1e098a
MD5 12dd1d1012c7f775d156b06a21fd3d99
BLAKE2b-256 f3c71661c304e8bd7678e886d8a9c3f3b7a97d732ed76a5eb2616a6d35ab3f42

See more details on using hashes here.

Provenance

The following attestation bundles were made for ellphi-0.1.2-cp310-cp310-manylinux_2_39_x86_64.whl:

Publisher: release.yml on t-uda/ellphi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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