From 3cfc598df6a152559f10ba840a8856587e1b1888 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 14 Apr 2017 13:30:04 +0000 Subject: Fix Sphinx and unitary tests issues git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2354 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 7852df8e3fcea5b0b7f37f79f2b8b34cfd1db62c --- src/cython/doc/alpha_complex_user.rst | 102 +++++++++--------- src/cython/doc/bottleneck_distance_user.rst | 6 +- src/cython/doc/installation.rst | 4 +- src/cython/doc/rips_complex_user.rst | 156 ++++++++++++++-------------- src/cython/doc/tangential_complex_user.rst | 32 +++--- 5 files changed, 153 insertions(+), 147 deletions(-) (limited to 'src/cython') diff --git a/src/cython/doc/alpha_complex_user.rst b/src/cython/doc/alpha_complex_user.rst index 2356944d..9aa6b13b 100644 --- a/src/cython/doc/alpha_complex_user.rst +++ b/src/cython/doc/alpha_complex_user.rst @@ -30,39 +30,40 @@ This example builds the Delaunay triangulation from the given points, and initia repr(simplex_tree.num_simplices()) + ' simplices - ' + \ repr(simplex_tree.num_vertices()) + ' vertices.' print(result_str) + fmt = '%s -> %.2f' for filtered_value in simplex_tree.get_filtration(): - print(filtered_value) + print(fmt % tuple(filtered_value)) The output is: .. testoutput:: Alpha complex is of dimension 2 - 25 simplices - 7 vertices. - ([0], 0.0) - ([1], 0.0) - ([2], 0.0) - ([3], 0.0) - ([4], 0.0) - ([5], 0.0) - ([6], 0.0) - ([2, 3], 6.25) - ([4, 5], 7.25) - ([0, 2], 8.5) - ([0, 1], 9.25) - ([1, 3], 10.0) - ([1, 2], 11.25) - ([1, 2, 3], 12.5) - ([0, 1, 2], 12.995867768595042) - ([5, 6], 13.25) - ([2, 4], 20.0) - ([4, 6], 22.736686390532547) - ([4, 5, 6], 22.736686390532547) - ([3, 6], 30.25) - ([2, 6], 36.5) - ([2, 3, 6], 36.5) - ([2, 4, 6], 37.24489795918368) - ([0, 4], 59.710743801652896) - ([0, 2, 4], 59.710743801652896) + [0] -> 0.00 + [1] -> 0.00 + [2] -> 0.00 + [3] -> 0.00 + [4] -> 0.00 + [5] -> 0.00 + [6] -> 0.00 + [2, 3] -> 6.25 + [4, 5] -> 7.25 + [0, 2] -> 8.50 + [0, 1] -> 9.25 + [1, 3] -> 10.00 + [1, 2] -> 11.25 + [1, 2, 3] -> 12.50 + [0, 1, 2] -> 13.00 + [5, 6] -> 13.25 + [2, 4] -> 20.00 + [4, 6] -> 22.74 + [4, 5, 6] -> 22.74 + [3, 6] -> 30.25 + [2, 6] -> 36.50 + [2, 3, 6] -> 36.50 + [2, 4, 6] -> 37.24 + [0, 4] -> 59.71 + [0, 2, 4] -> 59.71 Algorithm @@ -164,37 +165,38 @@ Then, it is asked to display information about the alpha complex: repr(simplex_tree.num_simplices()) + ' simplices - ' + \ repr(simplex_tree.num_vertices()) + ' vertices.' print(result_str) + fmt = '%s -> %.2f' for filtered_value in simplex_tree.get_filtration(): - print(filtered_value) + print(fmt % tuple(filtered_value)) the program output is: .. testoutput:: Alpha complex is of dimension 2 - 23 simplices - 7 vertices. - ([0], 0.0) - ([1], 0.0) - ([2], 0.0) - ([3], 0.0) - ([4], 0.0) - ([5], 0.0) - ([6], 0.0) - ([2, 3], 6.25) - ([4, 5], 7.25) - ([0, 2], 8.5) - ([0, 1], 9.25) - ([1, 3], 10.0) - ([1, 2], 11.25) - ([1, 2, 3], 12.5) - ([0, 1, 2], 12.995867768595042) - ([5, 6], 13.25) - ([2, 4], 20.0) - ([4, 6], 22.736686390532547) - ([4, 5, 6], 22.736686390532547) - ([3, 6], 30.25) - ([2, 6], 36.5) - ([2, 3, 6], 36.5) - ([2, 4, 6], 37.24489795918368) + [0] -> 0.00 + [1] -> 0.00 + [2] -> 0.00 + [3] -> 0.00 + [4] -> 0.00 + [5] -> 0.00 + [6] -> 0.00 + [2, 3] -> 6.25 + [4, 5] -> 7.25 + [0, 2] -> 8.50 + [0, 1] -> 9.25 + [1, 3] -> 10.00 + [1, 2] -> 11.25 + [1, 2, 3] -> 12.50 + [0, 1, 2] -> 13.00 + [5, 6] -> 13.25 + [2, 4] -> 20.00 + [4, 6] -> 22.74 + [4, 5, 6] -> 22.74 + [3, 6] -> 30.25 + [2, 6] -> 36.50 + [2, 3, 6] -> 36.50 + [2, 4, 6] -> 37.24 ============== CGAL citations diff --git a/src/cython/doc/bottleneck_distance_user.rst b/src/cython/doc/bottleneck_distance_user.rst index 8c29d069..546a15bb 100644 --- a/src/cython/doc/bottleneck_distance_user.rst +++ b/src/cython/doc/bottleneck_distance_user.rst @@ -23,15 +23,15 @@ This example computes the bottleneck distance from 2 persistence diagrams: diag1 = [[2.7, 3.7],[9.6, 14.],[34.2, 34.974], [3.,float('Inf')]] diag2 = [[2.8, 4.45],[9.5, 14.1],[3.2,float('Inf')]] - message = "Bottleneck distance approximation=" + repr(gudhi.bottleneck_distance(diag1, diag2, 0.1)) + message = "Bottleneck distance approximation=" + '%.2f' % gudhi.bottleneck_distance(diag1, diag2, 0.1) print(message) - message = "Bottleneck distance exact value=" + repr(gudhi.bottleneck_distance(diag1, diag2, 0)) + message = "Bottleneck distance exact value=" + '%.2f' % gudhi.bottleneck_distance(diag1, diag2, 0) print(message) The output is: .. testoutput:: - Bottleneck distance approximation=0.8081763781405569 + Bottleneck distance approximation=0.81 Bottleneck distance exact value=0.75 diff --git a/src/cython/doc/installation.rst b/src/cython/doc/installation.rst index 373e0717..f98a5039 100644 --- a/src/cython/doc/installation.rst +++ b/src/cython/doc/installation.rst @@ -33,7 +33,7 @@ To build the GUDHI cython module, run the following commands in a terminal: Test suites =========== -To test your build, `py.test `_ is required. Run the +To test your build, `py.test `_ is optional. Run the following command in a terminal: .. code-block:: bash @@ -41,7 +41,7 @@ following command in a terminal: cd /path-to-gudhi/build/cython # For windows, you have to set PYTHONPATH environment variable export PYTHONPATH='$PYTHONPATH:/path-to-gudhi/build/cython' - py.test + ctest -R py_test Documentation ============= diff --git a/src/cython/doc/rips_complex_user.rst b/src/cython/doc/rips_complex_user.rst index c89409a0..65d10304 100644 --- a/src/cython/doc/rips_complex_user.rst +++ b/src/cython/doc/rips_complex_user.rst @@ -60,8 +60,9 @@ Finally, it is asked to display information about the simplicial complex. repr(simplex_tree.num_simplices()) + ' simplices - ' + \ repr(simplex_tree.num_vertices()) + ' vertices.' print(result_str) + fmt = '%s -> %.2f' for filtered_value in simplex_tree.get_filtration(): - print(filtered_value) + print(fmt % tuple(filtered_value)) When launching (Rips maximal distance between 2 points is 12.0, is expanded until dimension 1 - one skeleton graph in other words), the output is: @@ -69,24 +70,24 @@ until dimension 1 - one skeleton graph in other words), the output is: .. testoutput:: Rips complex is of dimension 1 - 18 simplices - 7 vertices. - ([0], 0.0) - ([1], 0.0) - ([2], 0.0) - ([3], 0.0) - ([4], 0.0) - ([5], 0.0) - ([6], 0.0) - ([2, 3], 5.0) - ([4, 5], 5.385164807134504) - ([0, 2], 5.830951894845301) - ([0, 1], 6.082762530298219) - ([1, 3], 6.324555320336759) - ([1, 2], 6.708203932499369) - ([5, 6], 7.280109889280518) - ([2, 4], 8.94427190999916) - ([0, 3], 9.433981132056603) - ([4, 6], 9.486832980505138) - ([3, 6], 11.0) + [0] -> 0.00 + [1] -> 0.00 + [2] -> 0.00 + [3] -> 0.00 + [4] -> 0.00 + [5] -> 0.00 + [6] -> 0.00 + [2, 3] -> 5.00 + [4, 5] -> 5.39 + [0, 2] -> 5.83 + [0, 1] -> 6.08 + [1, 3] -> 6.32 + [1, 2] -> 6.71 + [5, 6] -> 7.28 + [2, 4] -> 8.94 + [0, 3] -> 9.43 + [4, 6] -> 9.49 + [3, 6] -> 11.00 Example from OFF file ^^^^^^^^^^^^^^^^^^^^^ @@ -107,32 +108,33 @@ Finally, it is asked to display information about the Rips complex. repr(simplex_tree.num_simplices()) + ' simplices - ' + \ repr(simplex_tree.num_vertices()) + ' vertices.' print(result_str) + fmt = '%s -> %.2f' for filtered_value in simplex_tree.get_filtration(): - print(filtered_value) + print(fmt % tuple(filtered_value)) the program output is: .. testoutput:: Rips complex is of dimension 1 - 18 simplices - 7 vertices. - ([0], 0.0) - ([1], 0.0) - ([2], 0.0) - ([3], 0.0) - ([4], 0.0) - ([5], 0.0) - ([6], 0.0) - ([2, 3], 5.0) - ([4, 5], 5.385164807134504) - ([0, 2], 5.830951894845301) - ([0, 1], 6.082762530298219) - ([1, 3], 6.324555320336759) - ([1, 2], 6.708203932499369) - ([5, 6], 7.280109889280518) - ([2, 4], 8.94427190999916) - ([0, 3], 9.433981132056603) - ([4, 6], 9.486832980505138) - ([3, 6], 11.0) + [0] -> 0.00 + [1] -> 0.00 + [2] -> 0.00 + [3] -> 0.00 + [4] -> 0.00 + [5] -> 0.00 + [6] -> 0.00 + [2, 3] -> 5.00 + [4, 5] -> 5.39 + [0, 2] -> 5.83 + [0, 1] -> 6.08 + [1, 3] -> 6.32 + [1, 2] -> 6.71 + [5, 6] -> 7.28 + [2, 4] -> 8.94 + [0, 3] -> 9.43 + [4, 6] -> 9.49 + [3, 6] -> 11.00 Distance matrix --------------- @@ -162,8 +164,9 @@ Finally, it is asked to display information about the simplicial complex. repr(simplex_tree.num_simplices()) + ' simplices - ' + \ repr(simplex_tree.num_vertices()) + ' vertices.' print(result_str) + fmt = '%s -> %.2f' for filtered_value in simplex_tree.get_filtration(): - print(filtered_value) + print(fmt % tuple(filtered_value)) When launching (Rips maximal distance between 2 points is 12.0, is expanded until dimension 1 - one skeleton graph in other words), the output is: @@ -171,24 +174,24 @@ until dimension 1 - one skeleton graph in other words), the output is: .. testoutput:: Rips complex is of dimension 1 - 18 simplices - 7 vertices. - ([0], 0.0) - ([1], 0.0) - ([2], 0.0) - ([3], 0.0) - ([4], 0.0) - ([5], 0.0) - ([6], 0.0) - ([2, 3], 5.0) - ([4, 5], 5.3851648071) - ([0, 2], 5.8309518948) - ([0, 1], 6.0827625303) - ([1, 3], 6.3245553203) - ([1, 2], 6.7082039325) - ([5, 6], 7.2801098893) - ([2, 4], 8.94427191) - ([0, 3], 9.4339811321) - ([4, 6], 9.4868329805) - ([3, 6], 11.0) + [0] -> 0.00 + [1] -> 0.00 + [2] -> 0.00 + [3] -> 0.00 + [4] -> 0.00 + [5] -> 0.00 + [6] -> 0.00 + [2, 3] -> 5.00 + [4, 5] -> 5.39 + [0, 2] -> 5.83 + [0, 1] -> 6.08 + [1, 3] -> 6.32 + [1, 2] -> 6.71 + [5, 6] -> 7.28 + [2, 4] -> 8.94 + [0, 3] -> 9.43 + [4, 6] -> 9.49 + [3, 6] -> 11.00 Example from csv file ^^^^^^^^^^^^^^^^^^^^^ @@ -209,29 +212,30 @@ Finally, it is asked to display information about the Rips complex. repr(simplex_tree.num_simplices()) + ' simplices - ' + \ repr(simplex_tree.num_vertices()) + ' vertices.' print(result_str) + fmt = '%s -> %.2f' for filtered_value in simplex_tree.get_filtration(): - print(filtered_value) + print(fmt % tuple(filtered_value)) the program output is: .. testoutput:: Rips complex is of dimension 1 - 18 simplices - 7 vertices. - ([0], 0.0) - ([1], 0.0) - ([2], 0.0) - ([3], 0.0) - ([4], 0.0) - ([5], 0.0) - ([6], 0.0) - ([2, 3], 5.0) - ([4, 5], 5.3851648071) - ([0, 2], 5.8309518948) - ([0, 1], 6.0827625303) - ([1, 3], 6.3245553203) - ([1, 2], 6.7082039325) - ([5, 6], 7.2801098893) - ([2, 4], 8.94427191) - ([0, 3], 9.4339811321) - ([4, 6], 9.4868329805) - ([3, 6], 11.0) + [0] -> 0.00 + [1] -> 0.00 + [2] -> 0.00 + [3] -> 0.00 + [4] -> 0.00 + [5] -> 0.00 + [6] -> 0.00 + [2, 3] -> 5.00 + [4, 5] -> 5.39 + [0, 2] -> 5.83 + [0, 1] -> 6.08 + [1, 3] -> 6.32 + [1, 2] -> 6.71 + [5, 6] -> 7.28 + [2, 4] -> 8.94 + [0, 3] -> 9.43 + [4, 6] -> 9.49 + [3, 6] -> 11.00 diff --git a/src/cython/doc/tangential_complex_user.rst b/src/cython/doc/tangential_complex_user.rst index 24f68f85..b2f40cce 100644 --- a/src/cython/doc/tangential_complex_user.rst +++ b/src/cython/doc/tangential_complex_user.rst @@ -134,7 +134,7 @@ This example builds the Tangential complex of point set read in an OFF file. repr(st.num_vertices()) + ' vertices.' print(result_str) for filtered_value in st.get_filtration(): - print(filtered_value) + print(filtered_value[0]) The output is: @@ -142,21 +142,21 @@ The output is: Tangential contains 12 simplices - 7 vertices. Simplex tree is of dimension 1 - 15 simplices - 7 vertices. - ([0], 0.0) - ([1], 0.0) - ([0, 1], 0.0) - ([2], 0.0) - ([0, 2], 0.0) - ([1, 2], 0.0) - ([3], 0.0) - ([1, 3], 0.0) - ([4], 0.0) - ([2, 4], 0.0) - ([5], 0.0) - ([4, 5], 0.0) - ([6], 0.0) - ([3, 6], 0.0) - ([5, 6], 0.0) + [0] + [1] + [0, 1] + [2] + [0, 2] + [1, 2] + [3] + [1, 3] + [4] + [2, 4] + [5] + [4, 5] + [6] + [3, 6] + [5, 6] Example with perturbation -- cgit v1.2.3