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 Distributions
Built Distributions
File details
Details for the file persty-2.0.0-py3.8-win-amd64.egg
.
File metadata
- Download URL: persty-2.0.0-py3.8-win-amd64.egg
- Upload date:
- Size: 61.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 245007a8960d6b35db4aaa98f85f22f6674d07ed6a94579b76eddb761d69deba |
|
MD5 | 578786e0f146d8179f0e355476b0081e |
|
BLAKE2b-256 | fb79e9129c43287835071fcf2df666a8a21426315377a163a465ff0dbd521b64 |
File details
Details for the file persty-2.0.0-py3.8-linux-x86_64.egg
.
File metadata
- Download URL: persty-2.0.0-py3.8-linux-x86_64.egg
- Upload date:
- Size: 59.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1214b27382ac6d927b173ae0510ad9d17c1da6e84a8a2830e676cf1e5f713d8b |
|
MD5 | c6a919a838fb90ff71d75381461fcd2e |
|
BLAKE2b-256 | 21ec4db3084baa4103c50d3ce7420015fa947eb40324245fe4a06ce98b368a95 |
File details
Details for the file persty-2.0.0-py3.7-win-amd64.egg
.
File metadata
- Download URL: persty-2.0.0-py3.7-win-amd64.egg
- Upload date:
- Size: 55.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bc4fcbfdf09cd3c688cff399777601bb43601d03723d75671322d73770bb3c5 |
|
MD5 | 8eb22041ce19f730e3974c35abe6f845 |
|
BLAKE2b-256 | 4cf3ec44a490e16210d5437cd8b0b654c1a589d325c990534b1638b9f5acf73d |
File details
Details for the file persty-2.0.0-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: persty-2.0.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 69.5 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e02f70e55ea18101168053c4ec9211904cf8adfa611e22b27130da17b8e2de04 |
|
MD5 | aaf3f5a839ebd4e917491ffffe9b2f31 |
|
BLAKE2b-256 | e5b3cd52df43deaa3a523df6aa4e4f98ecb27156642ddf558fe9128d11d29b0e |
File details
Details for the file persty-2.0.0-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: persty-2.0.0-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 63.8 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f018668b059237abff789c24e95533ea5bb738e4d938a4c95b9634cb514d28b |
|
MD5 | 18b90c4d0ba0f96086efeebf9a5b730d |
|
BLAKE2b-256 | 6b1c2a3ec351a65b86940688af2d8f3c04a0d6f75b46cba788cbc5bbc1c9d0d8 |