summaryrefslogtreecommitdiff
path: root/src/cython/test/test_simplex_tree.py
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-05-02 08:00:44 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-05-02 08:00:44 +0000
commit71840751fcd4771d126c0ebe2f63a02c14e67186 (patch)
tree2c534d74e3af6095e18171e1c2350b233756c8a5 /src/cython/test/test_simplex_tree.py
parent0902c35ad4701d78a91b30e2d055a529f4de01d5 (diff)
Add Python Simplex_tree make_filtration_non_decreasing interface and its tests
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/python_2.1.0_fix_vincent@3409 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 6a3af66b3d90c6114886e54c5c34287a13f4b863
Diffstat (limited to 'src/cython/test/test_simplex_tree.py')
-rwxr-xr-xsrc/cython/test/test_simplex_tree.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/cython/test/test_simplex_tree.py b/src/cython/test/test_simplex_tree.py
index 6dec5d94..bc16183a 100755
--- a/src/cython/test/test_simplex_tree.py
+++ b/src/cython/test/test_simplex_tree.py
@@ -161,3 +161,47 @@ def test_automatic_dimension():
assert st.upper_bound_dimension() == 2
assert st.dimension() == 1
assert st.upper_bound_dimension() == 1
+
+def test_make_filtration_non_decreasing():
+ st = SimplexTree()
+ assert st.__is_defined() == True
+ assert st.__is_persistence_defined() == False
+
+ # Inserted simplex:
+ # 1
+ # o
+ # /X\
+ # o---o---o---o
+ # 2 0 3\X/4
+ # o
+ # 5
+ assert st.insert([2, 1, 0], filtration=2.0) == True
+ assert st.insert([3, 0], filtration=2.0) == True
+ assert st.insert([3, 4, 5], filtration=2.0) == True
+
+ assert st.make_filtration_non_decreasing() == False
+
+ # Because of non decreasing property of simplex tree, { 0 } , { 1 } and
+ # { 0, 1 } are going to be set from value 2.0 to 1.0
+ st.insert([0, 1, 6, 7], filtration=1.0);
+
+ assert st.make_filtration_non_decreasing() == False
+
+ # Modify specific values to test make_filtration_non_decreasing
+ st.assign_filtration([0,1,6,7], 0.8);
+ st.assign_filtration([0,1,6], 0.9);
+ st.assign_filtration([0,6], 0.6);
+ st.assign_filtration([3,4,5], 1.2);
+ st.assign_filtration([3,4], 1.1);
+ st.assign_filtration([4,5], 1.99);
+
+ assert st.make_filtration_non_decreasing() == True
+
+ assert st.filtration([0,1,6,7]) == 1.
+ assert st.filtration([0,1,6]) == 1.
+ assert st.filtration([0,1]) == 1.
+ assert st.filtration([0]) == 1.
+ assert st.filtration([1]) == 1.
+ assert st.filtration([3,4,5]) == 2.
+ assert st.filtration([3,4]) == 2.
+ assert st.filtration([4,5]) == 2.