summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryuichi-ike <yuichi.ike.1990@gmail.com>2020-05-26 18:22:14 +0900
committeryuichi-ike <yuichi.ike.1990@gmail.com>2020-05-26 18:22:14 +0900
commit55316205b2c7c2e3d7e3fe3ea92e20f3f8b29b11 (patch)
tree078909eee9a8bef9bed4631e5a795bd73299f980
parent2ccc5ea97a5979f80fec93863da5549e4e6f2eea (diff)
test fixed, documents modified
-rw-r--r--src/python/doc/rips_complex_user.rst6
-rw-r--r--src/python/gudhi/dtm_rips_complex.py1
-rw-r--r--src/python/test/test_dtm_rips_complex.py16
3 files changed, 9 insertions, 14 deletions
diff --git a/src/python/doc/rips_complex_user.rst b/src/python/doc/rips_complex_user.rst
index 450e6c1a..dd2f2cc0 100644
--- a/src/python/doc/rips_complex_user.rst
+++ b/src/python/doc/rips_complex_user.rst
@@ -378,7 +378,7 @@ Example from a point cloud combined with DistanceToMeasure
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Combining with DistanceToMeasure, one can compute the DTM-filtration of a point set, as in `this notebook <https://github.com/GUDHI/TDA-tutorial/blob/master/Tuto-GUDHI-DTM-filtrations.ipynb>`_.
-Remark that DTMRipsComplex class provides exactly this function.
+Remark that `DTMRipsComplex <rips_complex_user.html#dtm-rips-complex>`_ class provides exactly this function.
.. testcode::
@@ -400,10 +400,12 @@ The output is:
[(0, (3.1622776601683795, inf)), (0, (3.1622776601683795, 5.39834563766817)), (0, (3.1622776601683795, 5.39834563766817))]
+.. _dtm-rips-complex:
+
DTM Rips Complex
----------------
-`DTMRipsComplex <rips_complex_ref.html#dtm-rips-complex-reference-manual>`_ builds a simplicial complex from a point set or a full distence matrix (in the form of ndarray), as described in the above example.
+`DTMRipsComplex <rips_complex_ref.html#dtm-rips-complex-reference-manual>`_ builds a simplicial complex from a point set or a full distance matrix (in the form of ndarray), as described in the above example.
This class constructs a weighted Rips complex giving larger weights to outliers, which reduces their impact on the persistence diagram. See `this notebook <https://github.com/GUDHI/TDA-tutorial/blob/master/Tuto-GUDHI-DTM-filtrations.ipynb>`_ for some experiments.
.. testcode::
diff --git a/src/python/gudhi/dtm_rips_complex.py b/src/python/gudhi/dtm_rips_complex.py
index 70c8e5dd..d77ad36e 100644
--- a/src/python/gudhi/dtm_rips_complex.py
+++ b/src/python/gudhi/dtm_rips_complex.py
@@ -18,6 +18,7 @@ class DTMRipsComplex(WeightedRipsComplex):
in the way described in :cite:`dtmfiltrations`.
Remark that all the filtration values are doubled compared to the definition in the paper
for the consistency with RipsComplex.
+ :Requires: `SciPy <installation.html#scipy>`_
"""
def __init__(self,
points=None,
diff --git a/src/python/test/test_dtm_rips_complex.py b/src/python/test/test_dtm_rips_complex.py
index 7cd2ad90..e1c0ee44 100644
--- a/src/python/test/test_dtm_rips_complex.py
+++ b/src/python/test/test_dtm_rips_complex.py
@@ -9,6 +9,7 @@
"""
from gudhi.dtm_rips_complex import DTMRipsComplex
+from gudhi import RipsComplex
import numpy as np
from math import sqrt
import pytest
@@ -25,16 +26,7 @@ def test_compatibility_with_rips():
distance_matrix = np.array([[0, 1, 1, sqrt(2)], [1, 0, sqrt(2), 1], [1, sqrt(2), 0, 1], [sqrt(2), 1, 1, 0]])
dtm_rips = DTMRipsComplex(distance_matrix=distance_matrix, max_filtration=42)
st = dtm_rips.create_simplex_tree(max_dimension=1)
- assert list(st.get_filtration()) == [
- ([0], 0.0),
- ([1], 0.0),
- ([2], 0.0),
- ([3], 0.0),
- ([0, 1], 1.0),
- ([0, 2], 1.0),
- ([1, 3], 1.0),
- ([2, 3], 1.0),
- ([1, 2], sqrt(2)),
- ([0, 3], sqrt(2)),
- ]
+ rips_complex = RipsComplex(distance_matrix=distance_matrix, max_edge_length=42)
+ st_from_rips = rips_complex.create_simplex_tree(max_dimension=1)
+ assert list(st.get_filtration()) == list(st_from_rips.get_filtration())