Example UsageΒΆ
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()