summaryrefslogtreecommitdiff
path: root/cython/example
diff options
context:
space:
mode:
Diffstat (limited to 'cython/example')
-rwxr-xr-xcython/example/alpha_complex_diagram_persistence_from_off_file_example.py72
-rwxr-xr-xcython/example/alpha_complex_from_points_example.py67
-rwxr-xr-xcython/example/alpha_rips_persistence_bottleneck_distance.py101
-rwxr-xr-xcython/example/bottleneck_basic_example.py46
-rwxr-xr-xcython/example/coordinate_graph_induced_complex.py68
-rwxr-xr-xcython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py79
-rwxr-xr-xcython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py79
-rwxr-xr-xcython/example/functional_graph_induced_complex.py69
-rwxr-xr-xcython/example/gudhi_graphical_tools_example.py49
-rwxr-xr-xcython/example/nerve_of_a_covering.py70
-rwxr-xr-xcython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py76
-rwxr-xr-xcython/example/random_cubical_complex_persistence_example.py58
-rwxr-xr-xcython/example/rips_complex_diagram_persistence_from_correlation_matrix_file_example.py84
-rwxr-xr-xcython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py67
-rwxr-xr-xcython/example/rips_complex_diagram_persistence_from_off_file_example.py74
-rwxr-xr-xcython/example/rips_complex_from_points_example.py40
-rwxr-xr-xcython/example/rips_persistence_diagram.py43
-rwxr-xr-xcython/example/simplex_tree_example.py63
-rwxr-xr-xcython/example/tangential_complex_plain_homology_from_off_file_example.py69
-rwxr-xr-xcython/example/voronoi_graph_induced_complex.py65
-rwxr-xr-xcython/example/witness_complex_from_nearest_landmark_table.py46
21 files changed, 0 insertions, 1385 deletions
diff --git a/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py b/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py
deleted file mode 100755
index 4abe22d4..00000000
--- a/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-import argparse
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 Inria"
-__license__ = "GPL v3"
-
-parser = argparse.ArgumentParser(description='AlphaComplex creation from '
- 'points read in a OFF file.',
- epilog='Example: '
- 'example/alpha_complex_diagram_persistence_from_off_file_example.py '
- '-f ../data/points/tore3D_300.off -a 0.6'
- '- Constructs a alpha complex with the '
- 'points from the given OFF file.')
-parser.add_argument("-f", "--file", type=str, required=True)
-parser.add_argument("-a", "--max_alpha_square", type=float, default=0.5)
-parser.add_argument("-b", "--band", type=float, default=0.)
-parser.add_argument('--no-diagram', default=False, action='store_true' , help='Flag for not to display the diagrams')
-
-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'):
- print("#####################################################################")
- print("AlphaComplex creation from points read in a OFF file")
-
- message = "AlphaComplex with max_edge_length=" + repr(args.max_alpha_square)
- print(message)
-
- alpha_complex = gudhi.AlphaComplex(off_file=args.file)
- simplex_tree = alpha_complex.create_simplex_tree(max_alpha_square=args.max_alpha_square)
-
- message = "Number of simplices=" + repr(simplex_tree.num_simplices())
- print(message)
-
- diag = simplex_tree.persistence()
-
- print("betti_numbers()=")
- print(simplex_tree.betti_numbers())
-
- if args.no_diagram == False:
- pplot = gudhi.plot_persistence_diagram(diag, band=args.band)
- pplot.show()
- else:
- print(args.file, "is not a valid OFF file")
-
- f.close()
diff --git a/cython/example/alpha_complex_from_points_example.py b/cython/example/alpha_complex_from_points_example.py
deleted file mode 100755
index ad73c744..00000000
--- a/cython/example/alpha_complex_from_points_example.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/env python
-
-from gudhi import AlphaComplex, SimplexTree
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 Inria"
-__license__ = "GPL v3"
-
-print("#####################################################################")
-print("AlphaComplex creation from points")
-alpha_complex = AlphaComplex(points=[[0, 0], [1, 0], [0, 1], [1, 1]])
-simplex_tree = alpha_complex.create_simplex_tree(max_alpha_square=60.0)
-
-if simplex_tree.find([0, 1]):
- print("[0, 1] Found !!")
-else:
- print("[0, 1] Not found...")
-
-if simplex_tree.find([4]):
- print("[4] Found !!")
-else:
- print("[4] Not found...")
-
-if simplex_tree.insert([0, 1, 2], filtration=4.0):
- print("[0, 1, 2] Inserted !!")
-else:
- print("[0, 1, 2] Not inserted...")
-
-if simplex_tree.insert([0, 1, 4], filtration=4.0):
- print("[0, 1, 4] Inserted !!")
-else:
- print("[0, 1, 4] Not inserted...")
-
-if simplex_tree.find([4]):
- print("[4] Found !!")
-else:
- print("[4] Not found...")
-
-print("dimension=", simplex_tree.dimension())
-print("filtrations=", simplex_tree.get_filtration())
-print("star([0])=", simplex_tree.get_star([0]))
-print("coface([0], 1)=", simplex_tree.get_cofaces([0], 1))
-
-print("point[0]=", alpha_complex.get_point(0))
-print("point[5]=", alpha_complex.get_point(5))
diff --git a/cython/example/alpha_rips_persistence_bottleneck_distance.py b/cython/example/alpha_rips_persistence_bottleneck_distance.py
deleted file mode 100755
index b51fa7a8..00000000
--- a/cython/example/alpha_rips_persistence_bottleneck_distance.py
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-import argparse
-import math
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 Inria"
-__license__ = "GPL v3"
-
-parser = argparse.ArgumentParser(description='AlphaComplex and RipsComplex '
- 'persistence creation from points read in '
- 'a OFF file. Bottleneck distance computation'
- ' on each dimension',
- epilog='Example: '
- 'example/alpha_rips_persistence_bottleneck_distance.py '
- '-f ../data/points/tore3D_1307.off -t 0.15 -d 3')
-parser.add_argument("-f", "--file", type=str, required=True)
-parser.add_argument("-t", "--threshold", type=float, default=0.5)
-parser.add_argument("-d", "--max_dimension", type=int, default=1)
-
-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)
- print("#####################################################################")
- print("RipsComplex creation from points read in a OFF file")
-
- message = "RipsComplex with max_edge_length=" + repr(args.threshold)
- print(message)
-
- rips_complex = gudhi.RipsComplex(points=point_cloud,
- max_edge_length=args.threshold)
-
- rips_stree = rips_complex.create_simplex_tree(max_dimension=args.max_dimension)
-
- message = "Number of simplices=" + repr(rips_stree.num_simplices())
- print(message)
-
- rips_diag = rips_stree.persistence()
-
- print("#####################################################################")
- print("AlphaComplex creation from points read in a OFF file")
-
- message = "AlphaComplex with max_edge_length=" + repr(args.threshold)
- print(message)
-
- alpha_complex = gudhi.AlphaComplex(points=point_cloud)
- alpha_stree = alpha_complex.create_simplex_tree(max_alpha_square=(args.threshold * args.threshold))
-
- message = "Number of simplices=" + repr(alpha_stree.num_simplices())
- print(message)
-
- alpha_diag = alpha_stree.persistence()
-
- max_b_distance = 0.0
- for dim in range(args.max_dimension):
- # Alpha persistence values needs to be transform because filtration
- # values are alpha square values
- funcs = [math.sqrt, math.sqrt]
- alpha_intervals = []
- for interval in alpha_stree.persistence_intervals_in_dimension(dim):
- alpha_intervals.append(map(lambda func,value: func(value), funcs, interval))
-
- rips_intervals = rips_stree.persistence_intervals_in_dimension(dim)
- bottleneck_distance = gudhi.bottleneck_distance(rips_intervals, alpha_intervals)
- message = "In dimension " + repr(dim) + ", bottleneck distance = " + repr(bottleneck_distance)
- print(message)
- max_b_distance = max(bottleneck_distance, max_b_distance)
-
- print("================================================================================")
- message = "Bottleneck distance is " + repr(max_b_distance)
- print(message)
-
- else:
- print(args.file, "is not a valid OFF file")
-
- f.close()
diff --git a/cython/example/bottleneck_basic_example.py b/cython/example/bottleneck_basic_example.py
deleted file mode 100755
index 287956e7..00000000
--- a/cython/example/bottleneck_basic_example.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Francois Godi, Vincent Rouvreau
-
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Francois Godi, Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 Inria"
-__license__ = "GPL v3"
-
-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 = "diag1=" + repr(diag1)
-print(message)
-
-message = "diag2=" + repr(diag2)
-print(message)
-
-message = "Bottleneck distance approximation=" + repr(gudhi.bottleneck_distance(diag1, diag2, 0.1))
-print(message)
-
-message = "Bottleneck distance exact value=" + repr(gudhi.bottleneck_distance(diag1, diag2))
-print(message)
-
diff --git a/cython/example/coordinate_graph_induced_complex.py b/cython/example/coordinate_graph_induced_complex.py
deleted file mode 100755
index 9e93109a..00000000
--- a/cython/example/coordinate_graph_induced_complex.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-import argparse
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- Copyright (C) 2018 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2018 Inria"
-__license__ = "GPL v3"
-
-parser = argparse.ArgumentParser(description='Coordinate GIC '
- 'from points read in a OFF file.',
- epilog='Example: '
- 'example/coordinate_graph_induced_complex.py '
- '-f ../data/points/KleinBottle5D.off -c 0 -v'
- '- Constructs the coordinate GIC with the '
- 'points from the given OFF file.')
-parser.add_argument("-f", "--file", type=str, required=True)
-parser.add_argument("-c", "--coordinate", type=int, default=0)
-parser.add_argument("-v", "--verbose", default=False, action='store_true' , help='Flag for program verbosity')
-
-args = parser.parse_args()
-
-nerve_complex = gudhi.CoverComplex()
-nerve_complex.set_verbose(args.verbose)
-
-if (nerve_complex.read_point_cloud(args.file)):
- nerve_complex.set_type('GIC')
- nerve_complex.set_color_from_coordinate(args.coordinate)
- nerve_complex.set_function_from_coordinate(args.coordinate)
- nerve_complex.set_graph_from_automatic_rips()
- nerve_complex.set_automatic_resolution()
- nerve_complex.set_gain()
- nerve_complex.set_cover_from_function()
- nerve_complex.find_simplices()
- nerve_complex.plot_dot()
- simplex_tree = nerve_complex.create_simplex_tree()
- nerve_complex.compute_PD()
- if (args.verbose):
- print('Iterator on coordinate GIC simplices')
- result_str = 'Coordinate GIC is of dimension ' + \
- repr(simplex_tree.dimension()) + ' - ' + \
- repr(simplex_tree.num_simplices()) + ' simplices - ' + \
- repr(simplex_tree.num_vertices()) + ' vertices.'
- print(result_str)
- for filtered_value in simplex_tree.get_filtration():
- print(filtered_value[0])
diff --git a/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py b/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py
deleted file mode 100755
index 3b29781f..00000000
--- a/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-import argparse
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 Inria"
-__license__ = "GPL v3"
-
-parser = argparse.ArgumentParser(description='EuclideanStrongWitnessComplex creation from '
- 'points read in a OFF file.',
- epilog='Example: '
- 'example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py '
- '-f ../data/points/tore3D_300.off -a 1.0 -n 20 -d 2'
- '- Constructs a strong witness complex with the '
- 'points from the given OFF file.')
-parser.add_argument("-f", "--file", type=str, required=True)
-parser.add_argument("-a", "--max_alpha_square", type=float, required=True)
-parser.add_argument("-n", "--number_of_landmarks", type=int, required=True)
-parser.add_argument("-d", "--limit_dimension", type=int, required=True)
-parser.add_argument("-b", "--band", type=float, default=0.)
-parser.add_argument('--no-diagram', default=False, action='store_true' , help='Flag for not to display the diagrams')
-
-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'):
- print("#####################################################################")
- print("EuclideanStrongWitnessComplex creation from points read in a OFF file")
-
- witnesses = gudhi.read_off(off_file=args.file)
- landmarks = gudhi.pick_n_random_points(points=witnesses, nb_points=args.number_of_landmarks)
-
- message = "EuclideanStrongWitnessComplex with max_edge_length=" + repr(args.max_alpha_square) + \
- " - Number of landmarks=" + repr(args.number_of_landmarks)
- print(message)
-
- witness_complex = gudhi.EuclideanStrongWitnessComplex(witnesses=witnesses, landmarks=landmarks)
- simplex_tree = witness_complex.create_simplex_tree(max_alpha_square=args.max_alpha_square,
- limit_dimension=args.limit_dimension)
-
- message = "Number of simplices=" + repr(simplex_tree.num_simplices())
- print(message)
-
- diag = simplex_tree.persistence()
-
- print("betti_numbers()=")
- print(simplex_tree.betti_numbers())
-
- if args.no_diagram == False:
- pplot = gudhi.plot_persistence_diagram(diag, band=args.band)
- pplot.show()
- else:
- print(args.file, "is not a valid OFF file")
-
- f.close()
diff --git a/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py b/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py
deleted file mode 100755
index db34962d..00000000
--- a/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-import argparse
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 Inria"
-__license__ = "GPL v3"
-
-parser = argparse.ArgumentParser(description='EuclideanWitnessComplex creation from '
- 'points read in a OFF file.',
- epilog='Example: '
- 'example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py '
- '-f ../data/points/tore3D_300.off -a 1.0 -n 20 -d 2'
- '- Constructs a weak witness complex with the '
- 'points from the given OFF file.')
-parser.add_argument("-f", "--file", type=str, required=True)
-parser.add_argument("-a", "--max_alpha_square", type=float, required=True)
-parser.add_argument("-n", "--number_of_landmarks", type=int, required=True)
-parser.add_argument("-d", "--limit_dimension", type=int, required=True)
-parser.add_argument("-b", "--band", type=float, default=0.)
-parser.add_argument('--no-diagram', default=False, action='store_true' , help='Flag for not to display the diagrams')
-
-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'):
- print("#####################################################################")
- print("EuclideanWitnessComplex creation from points read in a OFF file")
-
- witnesses = gudhi.read_off(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) + \
- " - Number of landmarks=" + repr(args.number_of_landmarks)
- print(message)
-
- witness_complex = gudhi.EuclideanWitnessComplex(witnesses=witnesses, landmarks=landmarks)
- simplex_tree = witness_complex.create_simplex_tree(max_alpha_square=args.max_alpha_square,
- limit_dimension=args.limit_dimension)
-
- message = "Number of simplices=" + repr(simplex_tree.num_simplices())
- print(message)
-
- diag = simplex_tree.persistence()
-
- print("betti_numbers()=")
- print(simplex_tree.betti_numbers())
-
- if args.no_diagram == False:
- pplot = gudhi.plot_persistence_diagram(diag, band=args.band)
- pplot.show()
- else:
- print(args.file, "is not a valid OFF file")
-
- f.close()
diff --git a/cython/example/functional_graph_induced_complex.py b/cython/example/functional_graph_induced_complex.py
deleted file mode 100755
index 6ad7c2ec..00000000
--- a/cython/example/functional_graph_induced_complex.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-import argparse
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- Copyright (C) 2018 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2018 Inria"
-__license__ = "GPL v3"
-
-parser = argparse.ArgumentParser(description='Functional GIC '
- 'from points read in a OFF file.',
- epilog='Example: '
- 'example/functional_graph_induced_complex.py '
- '-o ../data/points/COIL_database/lucky_cat.off '
- '-f ../data/points/COIL_database/lucky_cat_PCA1'
- '- Constructs the functional GIC with the '
- 'points from the given OFF and function files.')
-parser.add_argument("-o", "--off-file", type=str, required=True)
-parser.add_argument("-f", "--function-file", type=str, required=True)
-parser.add_argument("-v", "--verbose", default=False, action='store_true' , help='Flag for program verbosity')
-
-args = parser.parse_args()
-
-nerve_complex = gudhi.CoverComplex()
-nerve_complex.set_verbose(args.verbose)
-
-if (nerve_complex.read_point_cloud(args.off_file)):
- nerve_complex.set_type('GIC')
- nerve_complex.set_color_from_file(args.function_file)
- nerve_complex.set_function_from_file(args.function_file)
- nerve_complex.set_graph_from_automatic_rips()
- nerve_complex.set_automatic_resolution()
- nerve_complex.set_gain()
- nerve_complex.set_cover_from_function()
- nerve_complex.find_simplices()
- nerve_complex.plot_dot()
- simplex_tree = nerve_complex.create_simplex_tree()
- nerve_complex.compute_PD()
- if (args.verbose):
- print('Iterator on functional GIC simplices')
- result_str = 'Functional GIC is of dimension ' + \
- repr(simplex_tree.dimension()) + ' - ' + \
- repr(simplex_tree.num_simplices()) + ' simplices - ' + \
- repr(simplex_tree.num_vertices()) + ' vertices.'
- print(result_str)
- for filtered_value in simplex_tree.get_filtration():
- print(filtered_value[0])
diff --git a/cython/example/gudhi_graphical_tools_example.py b/cython/example/gudhi_graphical_tools_example.py
deleted file mode 100755
index ac3d146c..00000000
--- a/cython/example/gudhi_graphical_tools_example.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 Inria"
-__license__ = "GPL v3"
-
-print("#####################################################################")
-print("Show barcode persistence example")
-
-persistence = [(2, (1.0, float('inf'))), (1, (1.4142135623730951, float('inf'))),
- (1, (1.4142135623730951, float('inf'))), (0, (0.0, float('inf'))),
- (0, (0.0, 1.0)), (0, (0.0, 1.0)), (0, (0.0, 1.0))]
-gudhi.plot_persistence_barcode(persistence)
-
-print("#####################################################################")
-print("Show diagram persistence example")
-
-pplot = gudhi.plot_persistence_diagram(persistence)
-pplot.show()
-
-print("#####################################################################")
-print("Show diagram persistence example with a confidence band")
-
-pplot = gudhi.plot_persistence_diagram(persistence, band=0.2)
-pplot.show()
diff --git a/cython/example/nerve_of_a_covering.py b/cython/example/nerve_of_a_covering.py
deleted file mode 100755
index c5577cb1..00000000
--- a/cython/example/nerve_of_a_covering.py
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-import argparse
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- Copyright (C) 2018 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2018 Inria"
-__license__ = "GPL v3"
-
-parser = argparse.ArgumentParser(description='Nerve of a covering creation '
- 'from points read in a OFF file.',
- epilog='Example: '
- 'example/nerve_of_a_covering.py '
- '-f ../data/points/human.off -c 2 -r 10 -g 0.3'
- '- Constructs Nerve of a covering with the '
- 'points from the given OFF file.')
-parser.add_argument("-f", "--file", type=str, required=True)
-parser.add_argument("-c", "--coordinate", type=int, default=0)
-parser.add_argument("-r", "--resolution", type=int, default=10)
-parser.add_argument("-g", "--gain", type=float, default=0.3)
-parser.add_argument("-v", "--verbose", default=False, action='store_true' , help='Flag for program verbosity')
-
-args = parser.parse_args()
-
-nerve_complex = gudhi.CoverComplex()
-nerve_complex.set_verbose(args.verbose)
-
-if (nerve_complex.read_point_cloud(args.file)):
- nerve_complex.set_type('Nerve')
- nerve_complex.set_color_from_coordinate(args.coordinate)
- nerve_complex.set_function_from_coordinate(args.coordinate)
- nerve_complex.set_graph_from_OFF()
- nerve_complex.set_resolution_with_interval_number(args.resolution)
- nerve_complex.set_gain(args.gain)
- nerve_complex.set_cover_from_function()
- nerve_complex.find_simplices()
- nerve_complex.write_info()
- simplex_tree = nerve_complex.create_simplex_tree()
- nerve_complex.compute_PD()
- if (args.verbose):
- print('Iterator on graph induced complex simplices')
- result_str = 'Nerve is of dimension ' + \
- repr(simplex_tree.dimension()) + ' - ' + \
- repr(simplex_tree.num_simplices()) + ' simplices - ' + \
- repr(simplex_tree.num_vertices()) + ' vertices.'
- print(result_str)
- for filtered_value in simplex_tree.get_filtration():
- print(filtered_value[0])
diff --git a/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py b/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py
deleted file mode 100755
index 5f968bf1..00000000
--- a/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-import argparse
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 Inria"
-__license__ = "GPL v3"
-
-def is_file_perseus(file):
- num_lines = open(file).read().count('\n')
- try:
- f = open(file)
- num_dim = int(f.readline())
- coeff = 1
- for dim in range(0, num_dim):
- try:
- line = int(f.readline())
- coeff *= abs(line)
- except ValueError:
- return False
- if num_lines == (1 + num_dim + coeff):
- return True
- else:
- return False
- except ValueError:
- return False
-
-parser = argparse.ArgumentParser(description='Periodic cubical complex from a '
- 'Perseus-style file name.',
- epilog='Example: '
- './periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py'
- ' -f ../data/bitmap/CubicalTwoSphere.txt')
-
-parser.add_argument("-f", "--file", type=str, required=True)
-parser.add_argument('--no-barcode', default=False, action='store_true' , help='Flag for not to display the barcodes')
-
-args = parser.parse_args()
-
-if is_file_perseus(args.file):
- print("#####################################################################")
- print("PeriodicCubicalComplex creation")
- periodic_cubical_complex = gudhi.PeriodicCubicalComplex(perseus_file=args.file)
-
- print("persistence(homology_coeff_field=3, min_persistence=0)=")
- diag = periodic_cubical_complex.persistence(homology_coeff_field=3, min_persistence=0)
- print(diag)
-
- print("betti_numbers()=")
- print(periodic_cubical_complex.betti_numbers())
- if args.no_barcode == False:
- gudhi.plot_persistence_barcode(diag)
-else:
- print(args.file, "is not a valid perseus style file")
diff --git a/cython/example/random_cubical_complex_persistence_example.py b/cython/example/random_cubical_complex_persistence_example.py
deleted file mode 100755
index 80ff2452..00000000
--- a/cython/example/random_cubical_complex_persistence_example.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-import numpy
-from functools import reduce
-import argparse
-import operator
-
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 Inria"
-__license__ = "GPL v3"
-
-parser = argparse.ArgumentParser(description='Random cubical complex.',
- epilog='Example: '
- './random_cubical_complex_persistence_example.py'
- ' 10 10 10 - Constructs a random cubical '
- 'complex in a dimension [10, 10, 10] (aka. '
- '1000 random top dimensional cells).')
-parser.add_argument('dimension', type=int, nargs="*",
- help='Cubical complex dimensions')
-
-args = parser.parse_args()
-dimension_multiplication = reduce(operator.mul, args.dimension, 1)
-
-if dimension_multiplication > 1:
- print("#####################################################################")
- print("CubicalComplex creation")
- cubical_complex = gudhi.CubicalComplex(dimensions=args.dimension,
- top_dimensional_cells = numpy.random.rand(dimension_multiplication))
-
- print("persistence(homology_coeff_field=2, min_persistence=0)=")
- print(cubical_complex.persistence(homology_coeff_field=2, min_persistence=0))
-
- print("betti_numbers()=")
- print(cubical_complex.betti_numbers())
diff --git a/cython/example/rips_complex_diagram_persistence_from_correlation_matrix_file_example.py b/cython/example/rips_complex_diagram_persistence_from_correlation_matrix_file_example.py
deleted file mode 100755
index 0c9dfc43..00000000
--- a/cython/example/rips_complex_diagram_persistence_from_correlation_matrix_file_example.py
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-import sys
-import argparse
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2017 Inria"
-__license__ = "GPL v3"
-
-parser = argparse.ArgumentParser(description='RipsComplex creation from '
- 'a correlation matrix read in a csv file.',
- epilog='Example: '
- 'example/rips_complex_diagram_persistence_from_correlation_matrix_file_example.py '
- '-f ../data/correlation_matrix/lower_triangular_correlation_matrix.csv -e 12.0 -d 3'
- '- Constructs a Rips complex with the '
- 'correlation matrix from the given csv file.')
-parser.add_argument("-f", "--file", type=str, required=True)
-parser.add_argument("-c", "--min_edge_correlation", type=float, default=0.5)
-parser.add_argument("-d", "--max_dimension", type=int, default=1)
-parser.add_argument("-b", "--band", type=float, default=0.)
-parser.add_argument('--no-diagram', default=False, action='store_true' , help='Flag for not to display the diagrams')
-
-args = parser.parse_args()
-
-if not (-1. < args.min_edge_correlation < 1.):
- print("Wrong value of the treshold corelation (should be between -1 and 1).")
- sys.exit(1)
-
-print("#####################################################################")
-print("Caution: as persistence diagrams points will be under the diagonal,")
-print("bottleneck distance and persistence graphical tool will not work")
-print("properly, this is a known issue.")
-
-print("#####################################################################")
-print("RipsComplex creation from correlation matrix read in a csv file")
-
-message = "RipsComplex with min_edge_correlation=" + repr(args.min_edge_correlation)
-print(message)
-
-correlation_matrix = gudhi.read_lower_triangular_matrix_from_csv_file(csv_file=args.file)
-# Given a correlation matrix M, we compute component-wise M'[i,j] = 1-M[i,j] to get a distance matrix:
-distance_matrix = [[1.-correlation_matrix[i][j] for j in range(len(correlation_matrix[i]))] for i in range(len(correlation_matrix))]
-
-rips_complex = gudhi.RipsComplex(distance_matrix=distance_matrix,
- max_edge_length=1.-args.min_edge_correlation)
-simplex_tree = rips_complex.create_simplex_tree(max_dimension=args.max_dimension)
-
-message = "Number of simplices=" + repr(simplex_tree.num_simplices())
-print(message)
-
-diag = simplex_tree.persistence()
-
-print("betti_numbers()=")
-print(simplex_tree.betti_numbers())
-
-# invert the persistence diagram
-invert_diag = [(diag[pers][0],(1.-diag[pers][1][0], 1.-diag[pers][1][1])) for pers in range(len(diag))]
-
-if args.no_diagram == False:
- pplot = gudhi.plot_persistence_diagram(invert_diag, band=args.band)
- pplot.show()
diff --git a/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py b/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py
deleted file mode 100755
index 4d2ed577..00000000
--- a/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-import argparse
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 Inria"
-__license__ = "GPL v3"
-
-parser = argparse.ArgumentParser(description='RipsComplex creation from '
- 'a distance matrix read in a csv file.',
- epilog='Example: '
- 'example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py '
- '-f ../data/distance_matrix/lower_triangular_distance_matrix.csv -e 12.0 -d 3'
- '- Constructs a Rips complex with the '
- 'distance matrix from the given csv file.')
-parser.add_argument("-f", "--file", type=str, required=True)
-parser.add_argument("-e", "--max_edge_length", type=float, default=0.5)
-parser.add_argument("-d", "--max_dimension", type=int, default=1)
-parser.add_argument("-b", "--band", type=float, default=0.)
-parser.add_argument('--no-diagram', default=False, action='store_true' , help='Flag for not to display the diagrams')
-
-args = parser.parse_args()
-
-print("#####################################################################")
-print("RipsComplex creation from distance matrix read in a csv file")
-
-message = "RipsComplex with max_edge_length=" + repr(args.max_edge_length)
-print(message)
-
-distance_matrix = gudhi.read_lower_triangular_matrix_from_csv_file(csv_file=args.file)
-rips_complex = gudhi.RipsComplex(distance_matrix=distance_matrix, max_edge_length=args.max_edge_length)
-simplex_tree = rips_complex.create_simplex_tree(max_dimension=args.max_dimension)
-
-message = "Number of simplices=" + repr(simplex_tree.num_simplices())
-print(message)
-
-diag = simplex_tree.persistence()
-
-print("betti_numbers()=")
-print(simplex_tree.betti_numbers())
-
-if args.no_diagram == False:
- pplot = gudhi.plot_persistence_diagram(diag, band=args.band)
- pplot.show()
diff --git a/cython/example/rips_complex_diagram_persistence_from_off_file_example.py b/cython/example/rips_complex_diagram_persistence_from_off_file_example.py
deleted file mode 100755
index d15d5eb0..00000000
--- a/cython/example/rips_complex_diagram_persistence_from_off_file_example.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-import argparse
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 Inria"
-__license__ = "GPL v3"
-
-parser = argparse.ArgumentParser(description='RipsComplex creation from '
- 'points read in a OFF file.',
- epilog='Example: '
- 'example/rips_complex_diagram_persistence_from_off_file_example.py '
- '-f ../data/points/tore3D_300.off -a 0.6'
- '- Constructs a Rips complex with the '
- 'points from the given OFF file.')
-parser.add_argument("-f", "--file", type=str, required=True)
-parser.add_argument("-e", "--max_edge_length", type=float, default=0.5)
-parser.add_argument("-d", "--max_dimension", type=int, default=1)
-parser.add_argument("-b", "--band", type=float, default=0.)
-parser.add_argument('--no-diagram', default=False, action='store_true' , help='Flag for not to display the diagrams')
-
-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'):
- print("#####################################################################")
- print("RipsComplex creation from points read in a OFF file")
-
- message = "RipsComplex with max_edge_length=" + repr(args.max_edge_length)
- print(message)
-
- point_cloud = gudhi.read_off(off_file=args.file)
- rips_complex = gudhi.RipsComplex(points=point_cloud, max_edge_length=args.max_edge_length)
- simplex_tree = rips_complex.create_simplex_tree(max_dimension=args.max_dimension)
-
- message = "Number of simplices=" + repr(simplex_tree.num_simplices())
- print(message)
-
- diag = simplex_tree.persistence()
-
- print("betti_numbers()=")
- print(simplex_tree.betti_numbers())
-
- if args.no_diagram == False:
- pplot = gudhi.plot_persistence_diagram(diag, band=args.band)
- pplot.show()
- else:
- print(args.file, "is not a valid OFF file")
-
- f.close()
diff --git a/cython/example/rips_complex_from_points_example.py b/cython/example/rips_complex_from_points_example.py
deleted file mode 100755
index ffa9d91f..00000000
--- a/cython/example/rips_complex_from_points_example.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 Inria"
-__license__ = "GPL v3"
-
-print("#####################################################################")
-print("RipsComplex creation from points")
-rips = gudhi.RipsComplex(points=[[0, 0], [1, 0], [0, 1], [1, 1]],
- max_edge_length=42)
-
-simplex_tree = rips.create_simplex_tree(max_dimension=1)
-
-print("filtrations=", simplex_tree.get_filtration())
-print("star([0])=", simplex_tree.get_star([0]))
-print("coface([0], 1)=", simplex_tree.get_cofaces([0], 1))
diff --git a/cython/example/rips_persistence_diagram.py b/cython/example/rips_persistence_diagram.py
deleted file mode 100755
index 7a6a9f46..00000000
--- a/cython/example/rips_persistence_diagram.py
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Marc Glisse
-
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Marc Glisse"
-__copyright__ = "Copyright (C) 2016 Inria"
-__license__ = "GPL v3"
-
-print("#####################################################################")
-print("RipsComplex creation from points")
-rips = gudhi.RipsComplex(points=[[0, 0], [1, 0], [0, 1], [1, 1]],
- max_edge_length=42)
-
-simplex_tree = rips.create_simplex_tree(max_dimension=1)
-
-
-diag = simplex_tree.persistence(homology_coeff_field=2, min_persistence=0)
-print("diag=", diag)
-
-pplot = gudhi.plot_persistence_diagram(diag)
-pplot.show()
diff --git a/cython/example/simplex_tree_example.py b/cython/example/simplex_tree_example.py
deleted file mode 100755
index 28679015..00000000
--- a/cython/example/simplex_tree_example.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 Inria"
-__license__ = "GPL v3"
-
-print("#####################################################################")
-print("SimplexTree creation from insertion")
-
-st = gudhi.SimplexTree()
-
-if st.insert([0, 1]):
- print("Inserted !!")
-else:
- print("Not inserted...")
-
-if st.find([0, 1]):
- print("Found !!")
-else:
- print("Not found...")
-
-if st.insert([0, 1, 2], filtration=4.0):
- print("Inserted !!")
-else:
- print("Not inserted...")
-
-print("dimension=", st.dimension())
-
-st.initialize_filtration()
-print("filtration=", st.get_filtration())
-print("filtration[1, 2]=", st.filtration([1, 2]))
-print("filtration[4, 2]=", st.filtration([4, 2]))
-
-print("num_simplices=", st.num_simplices())
-print("num_vertices=", st.num_vertices())
-
-print("skeleton[2]=", st.get_skeleton(2))
-print("skeleton[1]=", st.get_skeleton(1))
-print("skeleton[0]=", st.get_skeleton(0))
diff --git a/cython/example/tangential_complex_plain_homology_from_off_file_example.py b/cython/example/tangential_complex_plain_homology_from_off_file_example.py
deleted file mode 100755
index 0f8f5e80..00000000
--- a/cython/example/tangential_complex_plain_homology_from_off_file_example.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-import argparse
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 Inria"
-__license__ = "GPL v3"
-
-parser = argparse.ArgumentParser(description='TangentialComplex creation from '
- 'points read in a OFF file.',
- epilog='Example: '
- 'example/tangential_complex_plain_homology_from_off_file_example.py '
- '-f ../data/points/tore3D_300.off -i 3'
- '- Constructs a tangential complex with the '
- 'points from the given OFF file')
-parser.add_argument("-f", "--file", type=str, required=True)
-parser.add_argument("-i", "--intrisic_dim", type=int, required=True)
-parser.add_argument("-b", "--band", type=float, default=0.)
-parser.add_argument('--no-diagram', default=False, action='store_true' , help='Flag for not to display the diagrams')
-
-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'):
- print("#####################################################################")
- print("TangentialComplex creation from points read in a OFF file")
-
- tc = gudhi.TangentialComplex(intrisic_dim = args.intrisic_dim, off_file=args.file)
- st = tc.create_simplex_tree()
-
- message = "Number of simplices=" + repr(st.num_simplices())
- print(message)
-
- diag = st.persistence(persistence_dim_max = True)
-
- print("betti_numbers()=")
- print(st.betti_numbers())
-
- if args.no_diagram == False:
- pplot = gudhi.plot_persistence_diagram(diag, band=args.band)
- pplot.show()
- else:
- print(args.file, "is not a valid OFF file")
-
- f.close()
diff --git a/cython/example/voronoi_graph_induced_complex.py b/cython/example/voronoi_graph_induced_complex.py
deleted file mode 100755
index 8266a0e4..00000000
--- a/cython/example/voronoi_graph_induced_complex.py
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/env python
-
-import gudhi
-import argparse
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- Copyright (C) 2018 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2018 Inria"
-__license__ = "GPL v3"
-
-parser = argparse.ArgumentParser(description='Voronoi GIC '
- 'from points read in a OFF file.',
- epilog='Example: '
- 'example/voronoi_graph_induced_complex.py '
- '-f ../data/points/human.off -n 700 -v'
- '- Constructs the Voronoi GIC with the '
- 'points from the given OFF file.')
-parser.add_argument("-f", "--file", type=str, required=True)
-parser.add_argument("-n", "--subsample-nb-points", type=int, default=100)
-parser.add_argument("-v", "--verbose", default=False, action='store_true' , help='Flag for program verbosity')
-
-args = parser.parse_args()
-
-nerve_complex = gudhi.CoverComplex()
-nerve_complex.set_verbose(args.verbose)
-
-if (nerve_complex.read_point_cloud(args.file)):
- nerve_complex.set_type('GIC')
- nerve_complex.set_color_from_coordinate()
- nerve_complex.set_graph_from_OFF()
- nerve_complex.set_cover_from_Voronoi(args.subsample_nb_points)
- nerve_complex.find_simplices()
- nerve_complex.plot_off()
- simplex_tree = nerve_complex.create_simplex_tree()
- nerve_complex.compute_PD()
- if (args.verbose):
- print('Iterator on graph induced complex simplices')
- result_str = 'Graph induced complex is of dimension ' + \
- repr(simplex_tree.dimension()) + ' - ' + \
- repr(simplex_tree.num_simplices()) + ' simplices - ' + \
- repr(simplex_tree.num_vertices()) + ' vertices.'
- print(result_str)
- for filtered_value in simplex_tree.get_filtration():
- print(filtered_value[0])
diff --git a/cython/example/witness_complex_from_nearest_landmark_table.py b/cython/example/witness_complex_from_nearest_landmark_table.py
deleted file mode 100755
index e6b295ee..00000000
--- a/cython/example/witness_complex_from_nearest_landmark_table.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env python
-
-from gudhi import StrongWitnessComplex, SimplexTree
-
-"""This file is part of the Gudhi Library. The Gudhi library
- (Geometric Understanding in Higher Dimensions) is a generic C++
- library for computational topology.
-
- Author(s): Vincent Rouvreau
-
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 Inria"
-__license__ = "GPL v3"
-
-print("#####################################################################")
-print("WitnessComplex creation from nearest landmark table")
-nearest_landmark_table = [[[0, 0], [1, 1], [2, 2], [3, 3], [4, 4]],
- [[1, 0], [2, 1], [3, 2], [4, 3], [0, 4]],
- [[2, 0], [3, 1], [4, 2], [0, 3], [1, 4]],
- [[3, 0], [4, 1], [0, 2], [1, 3], [2, 4]],
- [[4, 0], [0, 1], [1, 2], [2, 3], [3, 4]]]
-
-witness_complex = StrongWitnessComplex(nearest_landmark_table=nearest_landmark_table)
-simplex_tree = witness_complex.create_simplex_tree(max_alpha_square=4.1)
-
-message = "Number of simplices: " + repr(simplex_tree.num_simplices())
-print(message)
-
-diag = simplex_tree.persistence(min_persistence=-0.1, homology_coeff_field=11)
-print(diag)