summaryrefslogtreecommitdiff
path: root/cython/test
diff options
context:
space:
mode:
Diffstat (limited to 'cython/test')
-rwxr-xr-xcython/test/test_alpha_complex.py4
-rwxr-xr-xcython/test/test_bottleneck_distance.py4
-rwxr-xr-xcython/test/test_cubical_complex.py15
-rwxr-xr-xcython/test/test_euclidean_witness_complex.py4
-rwxr-xr-xcython/test/test_reader_utils.py4
-rwxr-xr-xcython/test/test_rips_complex.py4
-rwxr-xr-xcython/test/test_simplex_tree.py48
-rwxr-xr-xcython/test/test_subsampling.py4
-rwxr-xr-xcython/test/test_tangential_complex.py6
-rwxr-xr-xcython/test/test_witness_complex.py4
10 files changed, 76 insertions, 21 deletions
diff --git a/cython/test/test_alpha_complex.py b/cython/test/test_alpha_complex.py
index 2c76d9d7..e97f2530 100755
--- a/cython/test/test_alpha_complex.py
+++ b/cython/test/test_alpha_complex.py
@@ -6,7 +6,7 @@ from gudhi import AlphaComplex, SimplexTree
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ from gudhi import AlphaComplex, SimplexTree
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
diff --git a/cython/test/test_bottleneck_distance.py b/cython/test/test_bottleneck_distance.py
index 3d982d34..4eb5848f 100755
--- a/cython/test/test_bottleneck_distance.py
+++ b/cython/test/test_bottleneck_distance.py
@@ -6,7 +6,7 @@ import gudhi
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ import gudhi
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
diff --git a/cython/test/test_cubical_complex.py b/cython/test/test_cubical_complex.py
index 0e81554d..92e591e9 100755
--- a/cython/test/test_cubical_complex.py
+++ b/cython/test/test_cubical_complex.py
@@ -6,7 +6,7 @@ from gudhi import CubicalComplex
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ from gudhi import CubicalComplex
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
@@ -72,6 +72,17 @@ def test_dimension_simple_constructor():
assert cub.betti_numbers() == [1, 0, 0]
assert cub.persistent_betti_numbers(0, 1000) == [0, 0, 0]
+def test_user_case_simple_constructor():
+ cub = CubicalComplex(dimensions=[3, 3],
+ top_dimensional_cells = [float('inf'), 0.,0.,0.,1.,0.,0.,0.,0.])
+ assert cub.__is_defined() == True
+ assert cub.__is_persistence_defined() == False
+ assert cub.persistence() == [(1, (0.0, 1.0)), (0, (0.0, float('inf')))]
+ assert cub.__is_persistence_defined() == True
+ other_cub = CubicalComplex(dimensions=[3, 3],
+ top_dimensional_cells = [1000., 0.,0.,0.,1.,0.,0.,0.,0.])
+ assert other_cub.persistence() == [(1, (0.0, 1.0)), (0, (0.0, float('inf')))]
+
def test_dimension_file_constructor():
# Create test file
test_file = open('CubicalOneSphere.txt', 'w')
diff --git a/cython/test/test_euclidean_witness_complex.py b/cython/test/test_euclidean_witness_complex.py
index 737f1ef4..2f77210a 100755
--- a/cython/test/test_euclidean_witness_complex.py
+++ b/cython/test/test_euclidean_witness_complex.py
@@ -6,7 +6,7 @@ import gudhi
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ import gudhi
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
diff --git a/cython/test/test_reader_utils.py b/cython/test/test_reader_utils.py
index 25591fb3..b240c84f 100755
--- a/cython/test/test_reader_utils.py
+++ b/cython/test/test_reader_utils.py
@@ -6,7 +6,7 @@ import gudhi
Author(s): Vincent Rouvreau
- Copyright (C) 2017 INRIA
+ Copyright (C) 2017 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ import gudhi
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2017 INRIA"
+__copyright__ = "Copyright (C) 2017 Inria"
__license__ = "GPL v3"
diff --git a/cython/test/test_rips_complex.py b/cython/test/test_rips_complex.py
index c7d2ead4..c37b5400 100755
--- a/cython/test/test_rips_complex.py
+++ b/cython/test/test_rips_complex.py
@@ -7,7 +7,7 @@ from math import sqrt
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ from math import sqrt
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
diff --git a/cython/test/test_simplex_tree.py b/cython/test/test_simplex_tree.py
index 6dec5d94..cb701c9a 100755
--- a/cython/test/test_simplex_tree.py
+++ b/cython/test/test_simplex_tree.py
@@ -6,7 +6,7 @@ from gudhi import SimplexTree
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ from gudhi import SimplexTree
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
@@ -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.
diff --git a/cython/test/test_subsampling.py b/cython/test/test_subsampling.py
index 2caf4ddb..96906a6f 100755
--- a/cython/test/test_subsampling.py
+++ b/cython/test/test_subsampling.py
@@ -6,7 +6,7 @@ import gudhi
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ import gudhi
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
diff --git a/cython/test/test_tangential_complex.py b/cython/test/test_tangential_complex.py
index 8aa4023c..5385a0d3 100755
--- a/cython/test/test_tangential_complex.py
+++ b/cython/test/test_tangential_complex.py
@@ -6,7 +6,7 @@ from gudhi import TangentialComplex, SimplexTree
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,13 +23,13 @@ from gudhi import TangentialComplex, SimplexTree
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
def test_tangential():
point_list = [[0.0, 0.0], [1.0, 0.0], [0.0, 1.0], [1.0, 1.0]]
- tc = TangentialComplex(points=point_list)
+ tc = TangentialComplex(intrisic_dim = 1, points=point_list)
assert tc.__is_defined() == True
assert tc.num_vertices() == 4
diff --git a/cython/test/test_witness_complex.py b/cython/test/test_witness_complex.py
index 7d1fb6be..bcbc521b 100755
--- a/cython/test/test_witness_complex.py
+++ b/cython/test/test_witness_complex.py
@@ -6,7 +6,7 @@ from gudhi import WitnessComplex, StrongWitnessComplex, SimplexTree
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ from gudhi import WitnessComplex, StrongWitnessComplex, SimplexTree
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"