summaryrefslogtreecommitdiff
path: root/cython/test/test_simplex_tree.py
diff options
context:
space:
mode:
Diffstat (limited to 'cython/test/test_simplex_tree.py')
-rwxr-xr-xcython/test/test_simplex_tree.py38
1 files changed, 35 insertions, 3 deletions
diff --git a/cython/test/test_simplex_tree.py b/cython/test/test_simplex_tree.py
index 4d452d7d..6dec5d94 100755
--- a/cython/test/test_simplex_tree.py
+++ b/cython/test/test_simplex_tree.py
@@ -34,9 +34,13 @@ def test_insertion():
# insert test
assert st.insert([0, 1]) == True
+
+ assert st.dimension() == 1
+
assert st.insert([0, 1, 2], filtration=4.0) == True
- # FIXME: Remove this line
- st.set_dimension(2)
+
+ assert st.dimension() == 2
+
assert st.num_simplices() == 7
assert st.num_vertices() == 3
@@ -86,8 +90,9 @@ def test_insertion():
assert st.find([2]) == True
st.initialize_filtration()
- assert st.persistence() == [(1, (4.0, float('inf'))), (0, (0.0, float('inf')))]
+ assert st.persistence(persistence_dim_max = True) == [(1, (4.0, float('inf'))), (0, (0.0, float('inf')))]
assert st.__is_persistence_defined() == True
+
assert st.betti_numbers() == [1, 1]
assert st.persistent_betti_numbers(-0.1, 10000.0) == [0, 0]
assert st.persistent_betti_numbers(0.0, 10000.0) == [1, 0]
@@ -129,3 +134,30 @@ def test_expansion():
([1, 2], 0.5), ([0, 1, 2], 0.5), ([1, 2, 3], 0.5), ([5], 0.6), ([6], 0.6),
([5, 6], 0.6), ([4], 0.7), ([2, 4], 0.7), ([0, 3], 0.8), ([0, 1, 3], 0.8),
([0, 2, 3], 0.8), ([0, 1, 2, 3], 0.8), ([4, 6], 0.9), ([3, 6], 1.0)]
+
+def test_automatic_dimension():
+ st = SimplexTree()
+ assert st.__is_defined() == True
+ assert st.__is_persistence_defined() == False
+
+ # insert test
+ assert st.insert([0,1,3], filtration=0.5) == True
+ assert st.insert([0,1,2], filtration=1.) == True
+
+ assert st.num_vertices() == 4
+ assert st.num_simplices() == 11
+
+ assert st.dimension() == 2
+ assert st.upper_bound_dimension() == 2
+
+ assert st.prune_above_filtration(0.6) == True
+ assert st.dimension() == 2
+ assert st.upper_bound_dimension() == 2
+
+ st.assign_filtration([0, 1, 3], 0.7)
+ assert st.filtration([0, 1, 3]) == 0.7
+
+ st.remove_maximal_simplex([0, 1, 3])
+ assert st.upper_bound_dimension() == 2
+ assert st.dimension() == 1
+ assert st.upper_bound_dimension() == 1