diff options
author | ROUVREAU Vincent <vincent.rouvreau@inria.fr> | 2020-07-03 16:04:45 +0200 |
---|---|---|
committer | ROUVREAU Vincent <vincent.rouvreau@inria.fr> | 2020-07-03 16:04:45 +0200 |
commit | 85eec1ba750d56b66e3739dc486c6205f49fb31e (patch) | |
tree | 74053406d8f1d5ebbf2b6d51c6b8c6f7931b566e /src/python/test | |
parent | 444ec77fe16783c35ef86598011a662c5d6e8d92 (diff) |
A proposal for simplex_tree reset_filtration (python & C++)
Diffstat (limited to 'src/python/test')
-rwxr-xr-x | src/python/test/test_simplex_tree.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/python/test/test_simplex_tree.py b/src/python/test/test_simplex_tree.py index 2137d822..1ca84c10 100755 --- a/src/python/test/test_simplex_tree.py +++ b/src/python/test/test_simplex_tree.py @@ -340,3 +340,25 @@ def test_simplices_iterator(): assert st.find(simplex[0]) == True print("filtration is: ", simplex[1]) assert st.filtration(simplex[0]) == simplex[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 + + for simplex in st.get_simplices(): + assert st.filtration(simplex[0]) >= 0. + + # dimension until 5 even if simplex tree is of dimension 3 to test the limits + for dimension in range(0, 6): + 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]) >= 1. + else: + assert st.filtration(simplex[0]) == 0. + |