From 1e283611d2999003353e57f429bc9a0513fb0508 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 31 May 2016 09:53:04 +0000 Subject: Rename files using PEP8 recommendations git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@1226 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 4fb27e76a494266c9f79f411c03633f68e2da525 --- src/cython/example/Alpha_complex_example.py | 45 ---------------- src/cython/example/Mini_simplex_tree_example.py | 46 ---------------- src/cython/example/Rips_complex_example.py | 15 ------ src/cython/example/Simplex_tree_example.py | 42 --------------- src/cython/example/alpha_complex_example.py | 71 ++++++++++++++++++++++++ src/cython/example/mini_simplex_tree_example.py | 72 +++++++++++++++++++++++++ src/cython/example/rips_complex_example.py | 41 ++++++++++++++ src/cython/example/simplex_tree_example.py | 68 +++++++++++++++++++++++ 8 files changed, 252 insertions(+), 148 deletions(-) delete mode 100755 src/cython/example/Alpha_complex_example.py delete mode 100755 src/cython/example/Mini_simplex_tree_example.py delete mode 100755 src/cython/example/Rips_complex_example.py delete mode 100755 src/cython/example/Simplex_tree_example.py create mode 100755 src/cython/example/alpha_complex_example.py create mode 100755 src/cython/example/mini_simplex_tree_example.py create mode 100755 src/cython/example/rips_complex_example.py create mode 100755 src/cython/example/simplex_tree_example.py (limited to 'src/cython/example') diff --git a/src/cython/example/Alpha_complex_example.py b/src/cython/example/Alpha_complex_example.py deleted file mode 100755 index a724b0c4..00000000 --- a/src/cython/example/Alpha_complex_example.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python - -import gudhi - -print("#####################################################################") -print("AlphaComplex creation from points") -alpha_complex = gudhi.AlphaComplex(points=[[0, 0], [1, 0], [0, 1], [1, 1]], - max_alpha_square=60.0) - -if alpha_complex.find([0, 1]): - print("[0, 1] Found !!") -else: - print("[0, 1] Not found...") - -if alpha_complex.find([4]): - print("[4] Found !!") -else: - print("[4] Not found...") - -if alpha_complex.insert([0, 1, 2], filtration=4.0): - print("[0, 1, 2] Inserted !!") -else: - print("[0, 1, 2] Not inserted...") - -if alpha_complex.insert([0, 1, 4], filtration=4.0): - print("[0, 1, 4] Inserted !!") -else: - print("[0, 1, 4] Not inserted...") - -if alpha_complex.find([4]): - print("[4] Found !!") -else: - print("[4] Not found...") - -print("dimension=", alpha_complex.dimension()) -print("filtered_tree=", alpha_complex.get_filtered_tree()) -print("star([0])=", alpha_complex.get_star_tree([0])) -print("coface([0], 1)=", alpha_complex.get_coface_tree([0], 1)) - -print("point[0]=", alpha_complex.get_point(0)) -print("point[5]=", alpha_complex.get_point(5)) - -alpha_complex.initialize_filtration() -print("persistence(2)=", alpha_complex.persistence(homology_coeff_field=2, - min_persistence=0)) diff --git a/src/cython/example/Mini_simplex_tree_example.py b/src/cython/example/Mini_simplex_tree_example.py deleted file mode 100755 index 6cd5bf29..00000000 --- a/src/cython/example/Mini_simplex_tree_example.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python - -import gudhi - -print("#####################################################################") -print("MiniSimplexTree creation from insertion") - -""" Complex to build. - 1 3 - o---o - /X\ / - o---o o - 2 0 4 -""" - -triangle012 = [0, 1, 2] -edge03 = [0, 3] -edge13 = [1, 3] -vertex4 = [4] -mini_st = gudhi.MiniSimplexTree() -mini_st.insert(triangle012) -mini_st.insert(edge03) -mini_st.insert(edge13) -mini_st.insert(vertex4) - -# FIXME: Remove this line -mini_st.set_dimension(2) - -# initialize_filtration required before plain_homology -mini_st.initialize_filtration() - -print("plain_homology(2)=", mini_st.plain_homology(2)) - -edge02 = [0, 2] -if mini_st.find(edge02): - # Only coface is 012 - print("coface(edge02,1)=", mini_st.get_coface_tree(edge02, 1)) - -if mini_st.get_coface_tree(triangle012, 1) == []: - # Precondition: Check the simplex has no coface before removing it. - mini_st.remove_maximal_simplex(triangle012) - -# initialize_filtration required after removing -mini_st.initialize_filtration() - -print("filtered_tree after triangle012 removal =", mini_st.get_filtered_tree()) diff --git a/src/cython/example/Rips_complex_example.py b/src/cython/example/Rips_complex_example.py deleted file mode 100755 index 6a39fc77..00000000 --- a/src/cython/example/Rips_complex_example.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python - -import gudhi - -print("#####################################################################") -print("RipsComplex creation from points") -rips = gudhi.RipsComplex(points=[[0, 0], [1, 0], [0, 1], [1, 1]], - max_dimension=1, max_edge_length=42) - -print("filtered_tree=", rips.get_filtered_tree()) -print("star([0])=", rips.get_star_tree([0])) -print("coface([0], 1)=", rips.get_coface_tree([0], 1)) - -print("persistence(2)=", rips.persistence(homology_coeff_field=2, - min_persistence=0)) diff --git a/src/cython/example/Simplex_tree_example.py b/src/cython/example/Simplex_tree_example.py deleted file mode 100755 index e8585d83..00000000 --- a/src/cython/example/Simplex_tree_example.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python - -import gudhi - -st = gudhi.SimplexTree() - -print("#####################################################################") -print("SimplexTree creation from insertion") -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...") - -# FIXME: Remove this line -st.set_dimension(3) -print("dimension=", st.dimension()) - -st.set_filtration(4.0) -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_tree[2]=", st.get_skeleton_tree(2)) -print("skeleton_tree[1]=", st.get_skeleton_tree(1)) -print("skeleton_tree[0]=", st.get_skeleton_tree(0)) - -print("persistence(2)=", st.persistence(homology_coeff_field=2, - min_persistence=0)) diff --git a/src/cython/example/alpha_complex_example.py b/src/cython/example/alpha_complex_example.py new file mode 100755 index 00000000..6996b692 --- /dev/null +++ b/src/cython/example/alpha_complex_example.py @@ -0,0 +1,71 @@ +#!/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 Saclay (France) + + 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 . +""" + +__author__ = "Vincent Rouvreau" +__copyright__ = "Copyright (C) 2016 INRIA Saclay (France)" +__license__ = "GPL v3" + +print("#####################################################################") +print("AlphaComplex creation from points") +alpha_complex = gudhi.AlphaComplex(points=[[0, 0], [1, 0], [0, 1], [1, 1]], + max_alpha_square=60.0) + +if alpha_complex.find([0, 1]): + print("[0, 1] Found !!") +else: + print("[0, 1] Not found...") + +if alpha_complex.find([4]): + print("[4] Found !!") +else: + print("[4] Not found...") + +if alpha_complex.insert([0, 1, 2], filtration=4.0): + print("[0, 1, 2] Inserted !!") +else: + print("[0, 1, 2] Not inserted...") + +if alpha_complex.insert([0, 1, 4], filtration=4.0): + print("[0, 1, 4] Inserted !!") +else: + print("[0, 1, 4] Not inserted...") + +if alpha_complex.find([4]): + print("[4] Found !!") +else: + print("[4] Not found...") + +print("dimension=", alpha_complex.dimension()) +print("filtered_tree=", alpha_complex.get_filtered_tree()) +print("star([0])=", alpha_complex.get_star_tree([0])) +print("coface([0], 1)=", alpha_complex.get_coface_tree([0], 1)) + +print("point[0]=", alpha_complex.get_point(0)) +print("point[5]=", alpha_complex.get_point(5)) + +alpha_complex.initialize_filtration() +print("persistence(2)=", alpha_complex.persistence(homology_coeff_field=2, + min_persistence=0)) diff --git a/src/cython/example/mini_simplex_tree_example.py b/src/cython/example/mini_simplex_tree_example.py new file mode 100755 index 00000000..0461a1df --- /dev/null +++ b/src/cython/example/mini_simplex_tree_example.py @@ -0,0 +1,72 @@ +#!/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 Saclay (France) + + 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 . +""" + +__author__ = "Vincent Rouvreau" +__copyright__ = "Copyright (C) 2016 INRIA Saclay (France)" +__license__ = "GPL v3" + +print("#####################################################################") +print("MiniSimplexTree creation from insertion") + +""" Complex to build. + 1 3 + o---o + /X\ / + o---o o + 2 0 4 +""" + +triangle012 = [0, 1, 2] +edge03 = [0, 3] +edge13 = [1, 3] +vertex4 = [4] +mini_st = gudhi.MiniSimplexTree() +mini_st.insert(triangle012) +mini_st.insert(edge03) +mini_st.insert(edge13) +mini_st.insert(vertex4) + +# FIXME: Remove this line +mini_st.set_dimension(2) + +# initialize_filtration required before plain_homology +mini_st.initialize_filtration() + +print("plain_homology(2)=", mini_st.plain_homology(2)) + +edge02 = [0, 2] +if mini_st.find(edge02): + # Only coface is 012 + print("coface(edge02,1)=", mini_st.get_coface_tree(edge02, 1)) + +if mini_st.get_coface_tree(triangle012, 1) == []: + # Precondition: Check the simplex has no coface before removing it. + mini_st.remove_maximal_simplex(triangle012) + +# initialize_filtration required after removing +mini_st.initialize_filtration() + +print("filtered_tree after triangle012 removal =", mini_st.get_filtered_tree()) diff --git a/src/cython/example/rips_complex_example.py b/src/cython/example/rips_complex_example.py new file mode 100755 index 00000000..eba3f298 --- /dev/null +++ b/src/cython/example/rips_complex_example.py @@ -0,0 +1,41 @@ +#!/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 Saclay (France) + + 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 . +""" + +__author__ = "Vincent Rouvreau" +__copyright__ = "Copyright (C) 2016 INRIA Saclay (France)" +__license__ = "GPL v3" + +print("#####################################################################") +print("RipsComplex creation from points") +rips = gudhi.RipsComplex(points=[[0, 0], [1, 0], [0, 1], [1, 1]], + max_dimension=1, max_edge_length=42) + +print("filtered_tree=", rips.get_filtered_tree()) +print("star([0])=", rips.get_star_tree([0])) +print("coface([0], 1)=", rips.get_coface_tree([0], 1)) + +print("persistence(2)=", rips.persistence(homology_coeff_field=2, + min_persistence=0)) diff --git a/src/cython/example/simplex_tree_example.py b/src/cython/example/simplex_tree_example.py new file mode 100755 index 00000000..bdaabca2 --- /dev/null +++ b/src/cython/example/simplex_tree_example.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +import gudhi + +st = gudhi.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 Saclay (France) + + 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 . +""" + +__author__ = "Vincent Rouvreau" +__copyright__ = "Copyright (C) 2016 INRIA Saclay (France)" +__license__ = "GPL v3" + +print("#####################################################################") +print("SimplexTree creation from insertion") +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...") + +# FIXME: Remove this line +st.set_dimension(3) +print("dimension=", st.dimension()) + +st.set_filtration(4.0) +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_tree[2]=", st.get_skeleton_tree(2)) +print("skeleton_tree[1]=", st.get_skeleton_tree(1)) +print("skeleton_tree[0]=", st.get_skeleton_tree(0)) + +print("persistence(2)=", st.persistence(homology_coeff_field=2, + min_persistence=0)) -- cgit v1.2.3