diff options
author | yuichi-ike <yuichi.ike.1990@gmail.com> | 2020-04-06 16:31:59 +0900 |
---|---|---|
committer | yuichi-ike <yuichi.ike.1990@gmail.com> | 2020-04-06 16:31:59 +0900 |
commit | fadeb80b46001779e2a998941a02195921b03124 (patch) | |
tree | 9a65b9e08884d4ad088ee1b00b5020e0746d8752 /src/python/test | |
parent | 5ce1ee8976ced78de839ef629522c95324b2fabd (diff) |
test_weighted_rips added
Diffstat (limited to 'src/python/test')
-rw-r--r-- | src/python/test/test_weighted_rips.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/python/test/test_weighted_rips.py b/src/python/test/test_weighted_rips.py new file mode 100644 index 00000000..f0db6798 --- /dev/null +++ b/src/python/test/test_weighted_rips.py @@ -0,0 +1,27 @@ +""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + Author(s): Yuichi Ike + + Copyright (C) 2020 Inria + + Modification(s): + - YYYY/MM Author: Description of the modification +""" + +from gudhi.weighted_rips_complex import WeightedRipsComplex +from gudhi.point_cloud.dtm import DTM +import numpy +from scipy.spatial.distance import cdist +import pytest + +def test_dtm_rips_complex(): + pts = numpy.array([[2.0, 2], [0, 1], [3, 4]]) + dist = cdist(pts,pts) + dtm = DTM(2, q=2, metric="precomputed") + r = dtm.fit_transform(dist) + w_rips = WeightedRipsComplex(distance_mattix=dist, filtration_values=r) + st = w_rips.create_simplex_tree(max_dimension=2) + diag = st.persistence() + assert diag == [(0, (1.5811388300841898, float("inf"))), (0, (1.5811388300841898, 2.699172818834085)), (0, (1.5811388300841898, 2.699172818834085))] + +
\ No newline at end of file |