diff options
author | Gard Spreemann <gspr@nonempty.org> | 2022-01-14 09:15:35 +0100 |
---|---|---|
committer | Gard Spreemann <gspr@nonempty.org> | 2022-01-14 09:15:35 +0100 |
commit | dbc404626955aee632fa47ee7a4d4c3add7d6188 (patch) | |
tree | b7acfc83c9ba316216a93e9a7d14c68c11d92804 /src/python/test/test_cubical_complex.py | |
parent | 2c221bfcf8effff9b010de8b2e13a22f6bc15201 (diff) | |
parent | 17c3c6a07cdb1b4d4f735f3bc996af30e216dfbe (diff) |
Merge tag 'tags/gudhi-release-3.5.0' into dfsg/latest
Diffstat (limited to 'src/python/test/test_cubical_complex.py')
-rwxr-xr-x | src/python/test/test_cubical_complex.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/python/test/test_cubical_complex.py b/src/python/test/test_cubical_complex.py index d0e4e9e8..29d559b3 100755 --- a/src/python/test/test_cubical_complex.py +++ b/src/python/test/test_cubical_complex.py @@ -174,3 +174,28 @@ def test_periodic_cofaces_of_persistence_pairs_when_pd_has_no_paired_birth_and_d assert np.array_equal(pairs[1][0], np.array([0])) assert np.array_equal(pairs[1][1], np.array([0, 1])) assert np.array_equal(pairs[1][2], np.array([1])) + +def test_cubical_persistence_intervals_in_dimension(): + cub = CubicalComplex( + dimensions=[3, 3], + top_dimensional_cells=[1, 2, 3, 4, 5, 6, 7, 8, 9], + ) + cub.compute_persistence() + H0 = cub.persistence_intervals_in_dimension(0) + assert np.array_equal(H0, np.array([[ 1., float("inf")]])) + assert cub.persistence_intervals_in_dimension(1).shape == (0, 2) + +def test_periodic_cubical_persistence_intervals_in_dimension(): + cub = PeriodicCubicalComplex( + dimensions=[3, 3], + top_dimensional_cells=[1, 2, 3, 4, 5, 6, 7, 8, 9], + periodic_dimensions = [True, True] + ) + cub.compute_persistence() + H0 = cub.persistence_intervals_in_dimension(0) + assert np.array_equal(H0, np.array([[ 1., float("inf")]])) + H1 = cub.persistence_intervals_in_dimension(1) + assert np.array_equal(H1, np.array([[ 3., float("inf")], [ 7., float("inf")]])) + H2 = cub.persistence_intervals_in_dimension(2) + assert np.array_equal(H2, np.array([[ 9., float("inf")]])) + assert cub.persistence_intervals_in_dimension(3).shape == (0, 2) |