From 10ca6a70ba7ffea5c65d9c045b624da3d4200a63 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Mon, 15 Jun 2020 07:52:15 +0200 Subject: Factory to build python alpha complex. 3d version of alpha complex. Needs change in doc as alphacomplexdoc.off is a fake 3d off data file --- src/python/doc/alpha_complex_user.rst | 47 ++++++++--------------------------- 1 file changed, 10 insertions(+), 37 deletions(-) (limited to 'src/python/doc/alpha_complex_user.rst') diff --git a/src/python/doc/alpha_complex_user.rst b/src/python/doc/alpha_complex_user.rst index 097470c1..bcc2fc51 100644 --- a/src/python/doc/alpha_complex_user.rst +++ b/src/python/doc/alpha_complex_user.rst @@ -178,49 +178,22 @@ In the following example, a threshold of :math:`\alpha^2 = 32.0` is used. Example from OFF file ^^^^^^^^^^^^^^^^^^^^^ -This example builds the Delaunay triangulation from the points given by an OFF file, and initializes the alpha complex -with it. +This example builds the alpha complex from 300 random points on a 2-torus. +Then, it computes the persistence diagram and diplays it: -Then, it is asked to display information about the alpha complex: - -.. testcode:: +.. plot:: + :include-source: + import matplotlib.pyplot as plt import gudhi alpha_complex = gudhi.AlphaComplex(off_file=gudhi.__root_source_dir__ + \ - '/data/points/alphacomplexdoc.off') - simplex_tree = alpha_complex.create_simplex_tree(max_alpha_square=32.0) + '/data/points/tore3D_300.off') + simplex_tree = alpha_complex.create_simplex_tree() result_str = 'Alpha complex is of dimension ' + repr(simplex_tree.dimension()) + ' - ' + \ 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(fmt % tuple(filtered_value)) - -the program output is: - -.. testoutput:: - - Alpha complex is of dimension 2 - 20 simplices - 7 vertices. - [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 - + diag = simplex_tree.persistence() + gudhi.plot_persistence_diagram(diag) + plt.show() -- cgit v1.2.3 From 92235328f549fe610102ce3b58731d5877067f0e Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Sun, 28 Jun 2020 13:22:02 +0200 Subject: Duplicated comment --- src/python/doc/alpha_complex_user.rst | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/python/doc/alpha_complex_user.rst') diff --git a/src/python/doc/alpha_complex_user.rst b/src/python/doc/alpha_complex_user.rst index bcc2fc51..714c5343 100644 --- a/src/python/doc/alpha_complex_user.rst +++ b/src/python/doc/alpha_complex_user.rst @@ -35,8 +35,6 @@ Remarks output is a valid filtration (faces have a filtration value no larger than their cofaces). * For performances reasons, it is advised to use Alpha_complex with `CGAL `_ :math:`\geq` 5.0.0. -For performances reasons, it is advised to use CGAL :math:`\geq` 5.0.0. - Example from points ------------------- -- cgit v1.2.3 From 7fb8f17638ee7245a1eb6c604c6629a484612179 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Wed, 1 Jul 2020 07:41:13 +0200 Subject: Doc review: add some details about get_point --- src/python/doc/alpha_complex_user.rst | 2 ++ src/python/gudhi/alpha_complex.pyx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/python/doc/alpha_complex_user.rst') diff --git a/src/python/doc/alpha_complex_user.rst b/src/python/doc/alpha_complex_user.rst index 714c5343..fd4a2372 100644 --- a/src/python/doc/alpha_complex_user.rst +++ b/src/python/doc/alpha_complex_user.rst @@ -34,6 +34,8 @@ Remarks the computation of filtration values can exceptionally be arbitrarily bad. In all cases, we still guarantee that the output is a valid filtration (faces have a filtration value no larger than their cofaces). * For performances reasons, it is advised to use Alpha_complex with `CGAL `_ :math:`\geq` 5.0.0. +* The vertices in the output simplex tree are not guaranteed to match the order of the input points. One can use + :func:`~gudhi.AlphaComplex.get_point` to get the initial point back. Example from points ------------------- diff --git a/src/python/gudhi/alpha_complex.pyx b/src/python/gudhi/alpha_complex.pyx index ac44c61f..ea128743 100644 --- a/src/python/gudhi/alpha_complex.pyx +++ b/src/python/gudhi/alpha_complex.pyx @@ -99,7 +99,7 @@ cdef class AlphaComplex: return self.this_ptr != NULL def get_point(self, vertex): - """This function returns the point corresponding to a given vertex. + """This function returns the point corresponding to a given vertex from the :class:`~gudhi.SimplexTree`. :param vertex: The vertex. :type vertex: int -- cgit v1.2.3 From f39473b7c1de0fe42b3f4ebf5cb37bca0a84a247 Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com> Date: Wed, 1 Jul 2020 22:51:48 -0700 Subject: doc typo Co-authored-by: Marc Glisse --- src/python/doc/alpha_complex_user.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/python/doc/alpha_complex_user.rst') diff --git a/src/python/doc/alpha_complex_user.rst b/src/python/doc/alpha_complex_user.rst index fd4a2372..fffcb3db 100644 --- a/src/python/doc/alpha_complex_user.rst +++ b/src/python/doc/alpha_complex_user.rst @@ -180,7 +180,7 @@ Example from OFF file This example builds the alpha complex from 300 random points on a 2-torus. -Then, it computes the persistence diagram and diplays it: +Then, it computes the persistence diagram and displays it: .. plot:: :include-source: -- cgit v1.2.3