summaryrefslogtreecommitdiff
path: root/src/python/test
diff options
context:
space:
mode:
authorVincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com>2020-10-05 09:35:39 +0200
committerGitHub <noreply@github.com>2020-10-05 09:35:39 +0200
commit749dd136b61b50004629608ae95370dd0f61849e (patch)
tree534ea1ad91510f2a5f1e3d633f3b4adb5e98a64d /src/python/test
parenta304049bdcfb03aa848d8049923ab796e0761b56 (diff)
parent0c843fd01f0cd1ccff92c8ed40e989b3fbf8f1e9 (diff)
Merge pull request #363 from VincentRouvreau/stree_reset_filtration
A proposal for simplex_tree reset_filtration (python & C++)
Diffstat (limited to 'src/python/test')
-rwxr-xr-xsrc/python/test/test_simplex_tree.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/python/test/test_simplex_tree.py b/src/python/test/test_simplex_tree.py
index 83be0602..ac2b59c7 100755
--- a/src/python/test/test_simplex_tree.py
+++ b/src/python/test/test_simplex_tree.py
@@ -356,5 +356,27 @@ def test_collapse_edges():
st.collapse_edges()
assert st.num_simplices() == 9
assert st.find([1, 3]) == False
- for simplex in st.get_skeleton(0):
- assert simplex[1] == 1.
+ for simplex in st.get_skeleton(0):
+ assert simplex[1] == 1.
+
+def test_reset_filtration():
+ st = SimplexTree()
+
+ assert st.insert([0, 1, 2], 3.) == True
+ assert st.insert([0, 3], 2.) == True
+ assert st.insert([3, 4, 5], 3.) == True
+ assert st.insert([0, 1, 6, 7], 4.) == True
+
+ # Guaranteed by construction
+ for simplex in st.get_simplices():
+ assert st.filtration(simplex[0]) >= 2.
+
+ # dimension until 5 even if simplex tree is of dimension 3 to test the limits
+ for dimension in range(5, -1, -1):
+ st.reset_filtration(0., dimension)
+ for simplex in st.get_skeleton(3):
+ print(simplex)
+ if len(simplex[0]) < (dimension) + 1:
+ assert st.filtration(simplex[0]) >= 2.
+ else:
+ assert st.filtration(simplex[0]) == 0.