From fe3bbb9b3de5001ba943d3be7109712847ec44ef Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Tue, 26 Nov 2019 23:08:53 +0100 Subject: Fix various links for sphinx and some minor doc changes along the way. (why were we documenting a hasse diagram that doesn't exist?) --- src/python/doc/rips_complex_user.rst | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/python/doc/rips_complex_user.rst') diff --git a/src/python/doc/rips_complex_user.rst b/src/python/doc/rips_complex_user.rst index 3f6b960d..a8659542 100644 --- a/src/python/doc/rips_complex_user.rst +++ b/src/python/doc/rips_complex_user.rst @@ -40,12 +40,12 @@ A vertex name corresponds to the index of the point in the given range (aka. the On this example, as edges (4,5), (4,6) and (5,6) are in the complex, simplex (4,5,6) is added with the filtration value set with :math:`max(filtration(4,5), filtration(4,6), filtration(5,6))`. And so on for simplex (0,1,2,3). -If the `RipsComplex` interfaces are not detailed enough for your need, please refer to rips_persistence_step_by_step.cpp -C++ example, where the graph construction over the Simplex_tree is more detailed. +If the :doc:`RipsComplex ` interfaces are not detailed enough for your need, please refer to +rips_persistence_step_by_step.cpp C++ example, where the graph construction over the Simplex_tree is more detailed. A Rips complex can easily become huge, even if we limit the length of the edges and the dimension of the simplices. One easy trick, before building a Rips -complex on a point cloud, is to call `sparsify_point_set` which removes points +complex on a point cloud, is to call :func:`~gudhi.sparsify_point_set` which removes points that are too close to each other. This does not change its persistence diagram by more than the length used to define "too close". @@ -57,7 +57,7 @@ a :math:`\frac{1}{1-\varepsilon}`-interleaving, although in practice the error is usually smaller. A more intuitive presentation of the idea is available in :cite:`cavanna15geometric`, and in a video :cite:`cavanna15visualizing`. Passing an extra argument `sparse=0.3` at the -construction of a `RipsComplex` object asks it to build a sparse Rips with +construction of a :class:`~gudhi.RipsComplex` object asks it to build a sparse Rips with parameter :math:`\varepsilon=0.3`, while the default `sparse=None` builds the regular Rips complex. @@ -69,7 +69,7 @@ Example from a point cloud ^^^^^^^^^^^^^^^^^^^^^^^^^^ This example builds the neighborhood graph from the given points, up to max_edge_length. -Then it creates a :doc:`Simplex_tree ` with it. +Then it creates a :doc:`SimplexTree ` with it. Finally, it is asked to display information about the simplicial complex. @@ -128,7 +128,7 @@ Example from OFF file This example builds the :doc:`RipsComplex ` from the given points in an OFF file, and max_edge_length value. -Then it creates a :doc:`Simplex_tree ` with it. +Then it creates a :doc:`SimplexTree ` with it. Finally, it is asked to display information about the Rips complex. @@ -178,7 +178,7 @@ Example from a distance matrix ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This example builds the one skeleton graph from the given distance matrix, and max_edge_length value. -Then it creates a :doc:`Simplex_tree ` with it. +Then it creates a :doc:`SimplexTree ` with it. Finally, it is asked to display information about the simplicial complex. @@ -233,7 +233,7 @@ Example from csv file This example builds the :doc:`RipsComplex ` from the given distance matrix in a csv file, and max_edge_length value. -Then it creates a :doc:`Simplex_tree ` with it. +Then it creates a :doc:`SimplexTree ` with it. Finally, it is asked to display information about the Rips complex. @@ -286,7 +286,7 @@ Example from a correlation matrix Analogously to the case of distance matrix, Rips complexes can be also constructed based on correlation matrix. Given a correlation matrix M, comportment-wise 1-M is a distance matrix. This example builds the one skeleton graph from the given corelation matrix and threshold value. -Then it creates a :doc:`Simplex_tree ` with it. +Then it creates a :doc:`SimplexTree ` with it. Finally, it is asked to display information about the simplicial complex. @@ -307,7 +307,7 @@ Finally, it is asked to display information about the simplicial complex. [0.01, 0.01, 0.72, 1., 0.7], [0.89, 0.61, 0.03, 0.7, 1.]], float) - distance_matrix = np.ones((correlation_matrix.shape),float) - correlation_matrix + distance_matrix = 1 - correlation_matrix rips_complex = gudhi.RipsComplex(distance_matrix=distance_matrix, max_edge_length=1.0) simplex_tree = rips_complex.create_simplex_tree(max_dimension=1) @@ -342,6 +342,7 @@ until dimension 1 - one skeleton graph in other words), the output is: [1, 3] -> 0.99 .. note:: - As persistence diagrams points will be under the diagonal, + If you compute the persistence diagram and convert distances back to correlation values, + points in the persistence diagram will be under the diagonal, and bottleneck distance and persistence graphical tool will not work properly, this is a known issue. -- cgit v1.2.3 From b6e1d3025e27eed08eb8a1c5f95a80d6c6a9ce15 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Mon, 13 Jan 2020 09:55:01 +0100 Subject: Fix #194 : Rename read_off as it only read points from OFF file --- src/python/doc/persistence_graphical_tools_user.rst | 2 +- src/python/doc/reader_utils_ref.rst | 2 +- src/python/doc/rips_complex_user.rst | 3 ++- src/python/doc/witness_complex_user.rst | 2 +- src/python/example/alpha_rips_persistence_bottleneck_distance.py | 2 +- ...strong_witness_complex_diagram_persistence_from_off_file_example.py | 2 +- ...lidean_witness_complex_diagram_persistence_from_off_file_example.py | 2 +- src/python/example/plot_rips_complex.py | 2 +- .../example/rips_complex_diagram_persistence_from_off_file_example.py | 2 +- src/python/gudhi/off_reader.pyx | 2 +- 10 files changed, 11 insertions(+), 10 deletions(-) (limited to 'src/python/doc/rips_complex_user.rst') diff --git a/src/python/doc/persistence_graphical_tools_user.rst b/src/python/doc/persistence_graphical_tools_user.rst index f41a926b..80002db6 100644 --- a/src/python/doc/persistence_graphical_tools_user.rst +++ b/src/python/doc/persistence_graphical_tools_user.rst @@ -24,7 +24,7 @@ This function can display the persistence result as a barcode: import gudhi off_file = gudhi.__root_source_dir__ + '/data/points/tore3D_300.off' - point_cloud = gudhi.read_off(off_file=off_file) + point_cloud = gudhi.read_points_from_off_file(off_file=off_file) rips_complex = gudhi.RipsComplex(points=point_cloud, max_edge_length=0.7) simplex_tree = rips_complex.create_simplex_tree(max_dimension=3) diff --git a/src/python/doc/reader_utils_ref.rst b/src/python/doc/reader_utils_ref.rst index f3ecebad..b8977a5a 100644 --- a/src/python/doc/reader_utils_ref.rst +++ b/src/python/doc/reader_utils_ref.rst @@ -6,7 +6,7 @@ Reader utils reference manual ============================= -.. autofunction:: gudhi.read_off +.. autofunction:: gudhi.read_points_from_off_file .. autofunction:: gudhi.read_lower_triangular_matrix_from_csv_file diff --git a/src/python/doc/rips_complex_user.rst b/src/python/doc/rips_complex_user.rst index a8659542..a27573e8 100644 --- a/src/python/doc/rips_complex_user.rst +++ b/src/python/doc/rips_complex_user.rst @@ -136,7 +136,8 @@ Finally, it is asked to display information about the Rips complex. .. testcode:: import gudhi - point_cloud = gudhi.read_off(off_file=gudhi.__root_source_dir__ + '/data/points/alphacomplexdoc.off') + off_file = gudhi.__root_source_dir__ + '/data/points/alphacomplexdoc.off' + point_cloud = gudhi.read_points_from_off_file(off_file = off_file) rips_complex = gudhi.RipsComplex(points=point_cloud, max_edge_length=12.0) simplex_tree = rips_complex.create_simplex_tree(max_dimension=1) result_str = 'Rips complex is of dimension ' + repr(simplex_tree.dimension()) + ' - ' + \ diff --git a/src/python/doc/witness_complex_user.rst b/src/python/doc/witness_complex_user.rst index 45ba5b3b..7087fa98 100644 --- a/src/python/doc/witness_complex_user.rst +++ b/src/python/doc/witness_complex_user.rst @@ -101,7 +101,7 @@ Let's start with a simple example, which reads an off point file and computes a print("#####################################################################") print("EuclideanWitnessComplex creation from points read in a OFF file") - witnesses = gudhi.read_off(off_file=args.file) + witnesses = gudhi.read_points_from_off_file(off_file=args.file) landmarks = gudhi.pick_n_random_points(points=witnesses, nb_points=args.number_of_landmarks) message = "EuclideanWitnessComplex with max_edge_length=" + repr(args.max_alpha_square) + \ diff --git a/src/python/example/alpha_rips_persistence_bottleneck_distance.py b/src/python/example/alpha_rips_persistence_bottleneck_distance.py index 086307ee..d5c33ec8 100755 --- a/src/python/example/alpha_rips_persistence_bottleneck_distance.py +++ b/src/python/example/alpha_rips_persistence_bottleneck_distance.py @@ -35,7 +35,7 @@ args = parser.parse_args() with open(args.file, "r") as f: first_line = f.readline() if (first_line == "OFF\n") or (first_line == "nOFF\n"): - point_cloud = gudhi.read_off(off_file=args.file) + point_cloud = gudhi.read_points_from_off_file(off_file=args.file) print("#####################################################################") print("RipsComplex creation from points read in a OFF file") diff --git a/src/python/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py b/src/python/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py index 0eedd140..4903667e 100755 --- a/src/python/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py +++ b/src/python/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py @@ -47,7 +47,7 @@ with open(args.file, "r") as f: print("#####################################################################") print("EuclideanStrongWitnessComplex creation from points read in a OFF file") - witnesses = gudhi.read_off(off_file=args.file) + witnesses = gudhi.read_points_from_off_file(off_file=args.file) landmarks = gudhi.pick_n_random_points( points=witnesses, nb_points=args.number_of_landmarks ) diff --git a/src/python/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py b/src/python/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py index 1fe55737..339a8577 100755 --- a/src/python/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py +++ b/src/python/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py @@ -46,7 +46,7 @@ with open(args.file, "r") as f: print("#####################################################################") print("EuclideanWitnessComplex creation from points read in a OFF file") - witnesses = gudhi.read_off(off_file=args.file) + witnesses = gudhi.read_points_from_off_file(off_file=args.file) landmarks = gudhi.pick_n_random_points( points=witnesses, nb_points=args.number_of_landmarks ) diff --git a/src/python/example/plot_rips_complex.py b/src/python/example/plot_rips_complex.py index 1c878db1..214a3c0a 100755 --- a/src/python/example/plot_rips_complex.py +++ b/src/python/example/plot_rips_complex.py @@ -2,7 +2,7 @@ import numpy as np import gudhi -points = np.array(gudhi.read_off('../../data/points/Kl.off')) +points = np.array(gudhi.read_points_from_off_file('../../data/points/Kl.off')) rc = gudhi.RipsComplex(points=points, max_edge_length=.2) st = rc.create_simplex_tree(max_dimension=2) # We are only going to plot the triangles diff --git a/src/python/example/rips_complex_diagram_persistence_from_off_file_example.py b/src/python/example/rips_complex_diagram_persistence_from_off_file_example.py index b9074cf9..c757aca7 100755 --- a/src/python/example/rips_complex_diagram_persistence_from_off_file_example.py +++ b/src/python/example/rips_complex_diagram_persistence_from_off_file_example.py @@ -48,7 +48,7 @@ with open(args.file, "r") as f: message = "RipsComplex with max_edge_length=" + repr(args.max_edge_length) print(message) - point_cloud = gudhi.read_off(off_file=args.file) + point_cloud = gudhi.read_points_from_off_file(off_file=args.file) rips_complex = gudhi.RipsComplex( points=point_cloud, max_edge_length=args.max_edge_length ) diff --git a/src/python/gudhi/off_reader.pyx b/src/python/gudhi/off_reader.pyx index 225e981c..ee369976 100644 --- a/src/python/gudhi/off_reader.pyx +++ b/src/python/gudhi/off_reader.pyx @@ -19,7 +19,7 @@ __license__ = "MIT" cdef extern from "Off_reader_interface.h" namespace "Gudhi": vector[vector[double]] read_points_from_OFF_file(string off_file) -def read_off(off_file=''): +def read_points_from_off_file(off_file=''): """Read points from OFF file. :param off_file: An OFF file style name. -- cgit v1.2.3