A library for computing topological data structures stemming from Morse Theory. Given a set of arbitrarily arranged points in any dimension, this library is able to construct approximate topological structures using a neighborhood graph to simulate manifold structures.
Currently, you can use pip to install this package and all of its prerequisite libraries:
pip install topopy
Or to install from source, install all of the prerequiste libraries:
And then clone and build the source repository:
git clone https://github.com/maljovec/topopy.git cd topopy make python setup.py [develop|install]
import nglpy as ngl import numpy as np import topopy def hill(_x): _x = np.atleast_2d(_x) x = _x[:, 0] y = _x[:, 1] return np.exp(- ((x - .55)**2 + (y-.75)**2)/.125) + 0.01*(x+y) X = np.random.rand(100,2) Y = hill(X) graph = ngl.EmptyRegionGraph(beta=1.0, relaxed=False, p=2.0) msc = topopy.MorseSmaleComplex(graph=graph, gradient='steepest', normalization='feature') msc.build(X, Y) msc.get_partitions()