Skip to main content

Implementation of Minibox and Delauany edges algorithms.

Project description

persty - Minibox and Delaunay Edges Algorithms

This package provides an implementation of algorithms for finding the Minibox and Delaunay edges on a finite set of points in d-dimensional space with Chebyshev distance.

Installation

The setuptools, numpy and scipy Python packages are prerequisites to using this package.

With these installed, the persty package can be installed running the following command.

>>> pip install persty

Note. To use the persty.util.make_gudhi_simplex_tree function, it is necessary to install the gudhi Python package.

>>> conda install -c conda-forge gudhi

Compilation. Pre-compiled wheels are not available for all platforms.

So running pip install persty might require compiling the C++ code in the persty.cpp.binding submodule. For this to complete successfully you need some additional components installed: a C++ compiler, cmake version 3.11 or greater, and the pybind11 Python package.

To obtain these we recommend installing conda first. Then install both cmake and pybind11 with conda.

>>> conda install -c anaconda cmake
>>> conda install -c conda-forge pybind11

Windows. After installing conda, run the above commands within an Anaconda prompt. For the C++ compiler install Visual Studio community.

Basic usage

import numpy as np
import persty.minibox
import persty.delaunay

np.random.seed(0)
points = np.random.rand(20, 2)

minibox_edges = persty.minibox.edges(points)
delaunay_edges = persty.delaunay.edges(points)

Computing Persistent Homology

Minibox and Delaunay edges can be used to compute persistent homology in homological dimensions zero and one.

The persty package provides a wrapper function to generate a gudhi.SimplexTree() object that can be used to compute persistence diagrams of Minibox and Alpha flag filtrations.

The following code computes the zero and one dimensional persistence diagrams of 100 three-dimensional randomly sampled points in the unit cube.

import numpy as np
import persty.minibox
import persty.util
from scipy.spatial.distance import chebyshev

np.random.seed(0)
points = np.random.rand(100, 3)
minibox_edges = persty.minibox.edges(points)
simplex_tree = persty.util.make_gudhi_simplex_tree(points,
                                                   minibox_edges,
                                                   max_simplex_dim=2,
                                                   metric=chebyshev)
persistence_diagrams = simplex_tree.persistence(homology_coeff_field=2,
                                                persistence_dim_max=False)

Tests

To check that this package has been installed correctly you can run the tests in the test/ directory of this repository.

  • Download this repository on you computer by running the following command in a terminal window.
>>> git clone https://github.com/gbeltramo/persty.git

Note. On Windows you can obtain git by installing the chocolatey package manager, and running

>>> choco install git
  • In a terminal window move to the persty directory you just downloaded.

  • If you do not have the pytest package installed run

>>> pip install pytest
  • Finally run
>>> pytest

or

>>> pytest -q

The second option decreases the verbosity of the output of this command.

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

persty-2.1.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

persty-2.1.0-py3.8-linux-x86_64.egg (70.8 kB view details)

Uploaded Egg

File details

Details for the file persty-2.1.0.tar.gz.

File metadata

  • Download URL: persty-2.1.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10

File hashes

Hashes for persty-2.1.0.tar.gz
Algorithm Hash digest
SHA256 70e986bd70ecda43da98b85ba4c2bf063f41e52f809591737150777f5c9e9bcf
MD5 a635ef507e0ad8b963ca0c3dafcb78e4
BLAKE2b-256 695aa837cd757dff9f6a7fef21f071e2f2d4d1eb1c51c021264e4c366db6a029

See more details on using hashes here.

File details

Details for the file persty-2.1.0-py3.8-linux-x86_64.egg.

File metadata

  • Download URL: persty-2.1.0-py3.8-linux-x86_64.egg
  • Upload date:
  • Size: 70.8 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10

File hashes

Hashes for persty-2.1.0-py3.8-linux-x86_64.egg
Algorithm Hash digest
SHA256 f92355367a71b7bec1b75c36485aaa094fd4a58ad3927d1045a284337155c56e
MD5 ef6b43e42d8e35684c0c918654140bd5
BLAKE2b-256 337412798c25500e52291b2bc0419490bfb06f0fe099f485ec1751eed75755ee

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