From 4a089fe4840f09b4aabafa06ad53200baa6d6547 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Mon, 6 Jun 2016 14:54:17 +0000 Subject: bar code persistence tool Copyright modification git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@1251 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: ff7a8baeffbcafe6d074786b6a7956d815edd21b --- .../example/gudhi_graphical_tools_example.py | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 src/cython/example/gudhi_graphical_tools_example.py (limited to 'src/cython/example/gudhi_graphical_tools_example.py') diff --git a/src/cython/example/gudhi_graphical_tools_example.py b/src/cython/example/gudhi_graphical_tools_example.py new file mode 100755 index 00000000..c43b2338 --- /dev/null +++ b/src/cython/example/gudhi_graphical_tools_example.py @@ -0,0 +1,42 @@ +#!/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 . +""" + +__author__ = "Vincent Rouvreau" +__copyright__ = "Copyright (C) 2016 INRIA" +__license__ = "GPL v3" + +print("#####################################################################") +print("Show palette colors values for dimension") + +gudhi.show_palette_values() + +print("#####################################################################") +print("Show bar code 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.bar_code_persistence(persistence) -- cgit v1.2.3 From fee0420f4e8ef4a23934c1966938dfc0f41131be Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 9 Jun 2016 08:31:11 +0000 Subject: Witness complex cythonization Review of graphical tools git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@1264 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 35d1204190e4324cb9f9e4f8679c13c8ad080f51 --- .../example/alpha_complex_from_file_example.py | 2 +- .../example/gudhi_graphical_tools_example.py | 9 +- .../example/rips_complex_from_file_example.py | 2 +- .../example/witness_complex_from_file_example.py | 70 +++++ src/cython/gudhi.pyx | 1 + src/cython/src/cpp/Witness_complex_interface.h | 187 +++++++++++++ .../src/cython/persistence_graphical_tools.py | 35 ++- src/cython/src/cython/witness_complex.pyx | 309 +++++++++++++++++++++ 8 files changed, 597 insertions(+), 18 deletions(-) create mode 100755 src/cython/example/witness_complex_from_file_example.py create mode 100644 src/cython/src/cpp/Witness_complex_interface.h create mode 100644 src/cython/src/cython/witness_complex.pyx (limited to 'src/cython/example/gudhi_graphical_tools_example.py') diff --git a/src/cython/example/alpha_complex_from_file_example.py b/src/cython/example/alpha_complex_from_file_example.py index d1040e83..beb5d101 100755 --- a/src/cython/example/alpha_complex_from_file_example.py +++ b/src/cython/example/alpha_complex_from_file_example.py @@ -59,4 +59,4 @@ print(alpha_complex.betti_numbers()) gudhi.diagram_persistence(diag) -gudhi.bar_code_persistence(diag) +gudhi.barcode_persistence(diag) diff --git a/src/cython/example/gudhi_graphical_tools_example.py b/src/cython/example/gudhi_graphical_tools_example.py index c43b2338..40558bee 100755 --- a/src/cython/example/gudhi_graphical_tools_example.py +++ b/src/cython/example/gudhi_graphical_tools_example.py @@ -34,9 +34,14 @@ print("Show palette colors values for dimension") gudhi.show_palette_values() print("#####################################################################") -print("Show bar code persistence example") +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.bar_code_persistence(persistence) +gudhi.barcode_persistence(persistence) + +print("#####################################################################") +print("Show diagram persistence example") + +gudhi.diagram_persistence(persistence) diff --git a/src/cython/example/rips_complex_from_file_example.py b/src/cython/example/rips_complex_from_file_example.py index 1831a5e9..9385aba0 100755 --- a/src/cython/example/rips_complex_from_file_example.py +++ b/src/cython/example/rips_complex_from_file_example.py @@ -59,4 +59,4 @@ print(rips_complex.betti_numbers()) gudhi.diagram_persistence(diag) -gudhi.bar_code_persistence(diag) +gudhi.barcode_persistence(diag) diff --git a/src/cython/example/witness_complex_from_file_example.py b/src/cython/example/witness_complex_from_file_example.py new file mode 100755 index 00000000..9d1a940f --- /dev/null +++ b/src/cython/example/witness_complex_from_file_example.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python + +import gudhi +import pandas +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 . +""" + +__author__ = "Vincent Rouvreau" +__copyright__ = "Copyright (C) 2016 INRIA" +__license__ = "GPL v3" + +print("#####################################################################") +print("WitnessComplex creation from points read in a file") + +parser = argparse.ArgumentParser(description='WitnessComplex creation from ' + 'points read in a file.', + epilog='Example: ' + 'example/witness_complex_from_file_example.py' + ' data/500_random_points_on_3D_Torus.csv ' + '- Constructs a witness complex with the ' + 'points from the given file. File format ' + 'is X1, X2, ..., Xn') +parser.add_argument('file', type=argparse.FileType('r')) +args = parser.parse_args() + +points = pandas.read_csv(args.file, header=None) + +print("WitnessComplex with number_of_landmarks=5") + +witness_complex = gudhi.WitnessComplex(points=points.values, + number_of_landmarks=200) + +print("filtered_tree=", witness_complex.get_filtered_tree()) + +witness_complex.initialize_filtration() +diag = witness_complex.persistence(homology_coeff_field=2, min_persistence=0.1) + +print("diag=", diag) + +gudhi.diagram_persistence(diag) + +""" +print("betti_numbers()=") +print(witness_complex.betti_numbers()) + +gudhi.diagram_persistence(diag) + +gudhi.barcode_persistence(diag) +""" \ No newline at end of file diff --git a/src/cython/gudhi.pyx b/src/cython/gudhi.pyx index b8cb032e..c16852b8 100644 --- a/src/cython/gudhi.pyx +++ b/src/cython/gudhi.pyx @@ -29,4 +29,5 @@ include "src/cython/mini_simplex_tree.pyx" include "src/cython/rips_complex.pyx" include "src/cython/alpha_complex.pyx" include "src/cython/cubical_complex.pyx" +include "src/cython/witness_complex.pyx" include "src/cython/persistence_graphical_tools.py" diff --git a/src/cython/src/cpp/Witness_complex_interface.h b/src/cython/src/cpp/Witness_complex_interface.h new file mode 100644 index 00000000..bdfea91f --- /dev/null +++ b/src/cython/src/cpp/Witness_complex_interface.h @@ -0,0 +1,187 @@ +/* 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 . + */ + +#ifndef WITNESS_COMPLEX_INTERFACE_H +#define WITNESS_COMPLEX_INTERFACE_H + +#include +#include +#include + +#include "Persistent_cohomology_interface.h" + +#include +#include // std::pair +#include + +namespace Gudhi { + +namespace witness_complex { + +class Witness_complex_interface { + typedef typename Simplex_tree<>::Simplex_handle Simplex_handle; + typedef typename std::pair Insertion_result; + using Simplex = std::vector; + using Filtered_complex = std::pair; + using Complex_tree = std::vector; + + public: + Witness_complex_interface(std::vector>&points, int number_of_landmarks) + : pcoh_(nullptr) { + std::vector > knn; + + Gudhi::witness_complex::landmark_choice_by_furthest_point(points, number_of_landmarks, knn); + Gudhi::witness_complex::witness_complex(knn, number_of_landmarks, points[0].size(), simplex_tree_); + + } + + bool find_simplex(const Simplex& vh) { + return (simplex_tree_.find(vh) != simplex_tree_.null_simplex()); + } + + bool insert_simplex_and_subfaces(const Simplex& complex, Filtration_value filtration = 0) { + Insertion_result result = simplex_tree_.insert_simplex_and_subfaces(complex, filtration); + return (result.second); + } + + Filtration_value simplex_filtration(const Simplex& complex) { + return simplex_tree_.filtration(simplex_tree_.find(complex)); + } + + void remove_maximal_simplex(const Simplex& complex) { + return simplex_tree_.remove_maximal_simplex(simplex_tree_.find(complex)); + } + + Complex_tree get_filtered_tree() { + Complex_tree filtered_tree; + for (auto f_simplex : simplex_tree_.filtration_simplex_range()) { + Simplex simplex; + for (auto vertex : simplex_tree_.simplex_vertex_range(f_simplex)) { + simplex.insert(simplex.begin(), vertex); + } + filtered_tree.push_back(std::make_pair(simplex, simplex_tree_.filtration(f_simplex))); + } + return filtered_tree; + + } + + Complex_tree get_skeleton_tree(int dimension) { + Complex_tree skeleton_tree; + for (auto f_simplex : simplex_tree_.skeleton_simplex_range(dimension)) { + Simplex simplex; + for (auto vertex : simplex_tree_.simplex_vertex_range(f_simplex)) { + simplex.insert(simplex.begin(), vertex); + } + skeleton_tree.push_back(std::make_pair(simplex, simplex_tree_.filtration(f_simplex))); + } + return skeleton_tree; + } + + Complex_tree get_star_tree(const Simplex& complex) { + Complex_tree star_tree; + for (auto f_simplex : simplex_tree_.star_simplex_range(simplex_tree_.find(complex))) { + Simplex simplex; + for (auto vertex : simplex_tree_.simplex_vertex_range(f_simplex)) { + simplex.insert(simplex.begin(), vertex); + } + star_tree.push_back(std::make_pair(simplex, simplex_tree_.filtration(f_simplex))); + } + return star_tree; + } + + Complex_tree get_coface_tree(const Simplex& complex, int dimension) { + Complex_tree coface_tree; + for (auto f_simplex : simplex_tree_.cofaces_simplex_range(simplex_tree_.find(complex), dimension)) { + Simplex simplex; + for (auto vertex : simplex_tree_.simplex_vertex_range(f_simplex)) { + simplex.insert(simplex.begin(), vertex); + } + coface_tree.push_back(std::make_pair(simplex, simplex_tree_.filtration(f_simplex))); + } + return coface_tree; + } + + // Specific to Witness complex because no inheritance + Filtration_value filtration() const { + return simplex_tree_.filtration(); + } + + void set_filtration(Filtration_value fil) { + simplex_tree_.set_filtration(fil); + } + + void initialize_filtration() { + simplex_tree_.initialize_filtration(); + } + + size_t num_vertices() const { + return simplex_tree_.num_vertices(); + } + + size_t num_simplices() { + return simplex_tree_.num_simplices(); + } + + int dimension() const { + return simplex_tree_.dimension(); + } + + void set_dimension(int dimension) { + simplex_tree_.set_dimension(dimension); + } + + std::vector>> get_persistence(int homology_coeff_field, double min_persistence) { + if (pcoh_ != nullptr) { + delete pcoh_; + } + pcoh_ = new Persistent_cohomology_interface>(&simplex_tree_); + return pcoh_->get_persistence(homology_coeff_field, min_persistence); + } + + std::vector get_betti_numbers() const { + if (pcoh_ != nullptr) { + return pcoh_->betti_numbers(); + } + std::vector betti_numbers; + return betti_numbers; + } + + std::vector get_persistent_betti_numbers(Filtration_value from, Filtration_value to) const { + if (pcoh_ != nullptr) { + return pcoh_->persistent_betti_numbers(from, to); + } + std::vector persistent_betti_numbers; + return persistent_betti_numbers; + } + + private: + Simplex_tree<> simplex_tree_; + Persistent_cohomology_interface>* pcoh_; + +}; + +} // namespace witness_complex + +} // namespace Gudhi + +#endif // WITNESS_COMPLEX_INTERFACE_H + diff --git a/src/cython/src/cython/persistence_graphical_tools.py b/src/cython/src/cython/persistence_graphical_tools.py index f25b6b63..247e119e 100755 --- a/src/cython/src/cython/persistence_graphical_tools.py +++ b/src/cython/src/cython/persistence_graphical_tools.py @@ -53,10 +53,13 @@ Only 13 colors for the palette palette = ['#ff0000', '#00ff00', '#0000ff', '#00ffff', '#ff00ff', '#ffff00', '#000000', '#880000', '#008800', '#000088', '#888800', '#880088', '#008888'] - -def show_palette_values(): + +def show_palette_values(alpha=0.6): """This function shows palette color values in function of the dimension. + :param alpha: alpha value in [0.0, 1.0] for horizontal bars (default is + 0.6). + :type alpha: float. :returns: plot -- An horizontal bar plot of dimensions color. """ colors = [] @@ -65,18 +68,20 @@ def show_palette_values(): y_pos = np.arange(len(palette)) - # alpha=0.4 is realy usefull for ugly colors - plt.barh(y_pos, y_pos + 1, align='center', alpha=0.4, color=colors) + plt.barh(y_pos, y_pos + 1, align='center', alpha=alpha, color=colors) plt.ylabel('Dimension') plt.title('Dimension palette values') plt.show() -def bar_code_persistence(persistence): +def barcode_persistence(persistence, alpha=0.6): """This function plots the persistence bar code. :param persistence: The persistence to plot. :type persistence: list of tuples(dimension, tuple(birth, death)). + :param alpha: alpha value in [0.0, 1.0] for horizontal bars (default is + 0.6). + :type alpha: float. :returns: plot -- An horizontal bar plot of persistence. """ (min_birth, max_death) = __min_birth_max_death(persistence) @@ -91,26 +96,28 @@ def bar_code_persistence(persistence): if float(interval[1][1]) != float('inf'): # Finite death case plt.barh(ind, (interval[1][1] - interval[1][0]), height=0.8, - left = interval[1][0], alpha=0.4, + left = interval[1][0], alpha=alpha, color = palette[interval[0]]) else: # Infinite death case for diagram to be nicer plt.barh(ind, (infinity - interval[1][0]), height=0.8, - left = interval[1][0], alpha=0.4, + left = interval[1][0], alpha=alpha, color = palette[interval[0]]) ind = ind + 1 - plt.title('Persistence bar code') - plt.xlabel('Birth - Death') + plt.title('Persistence barcode') # Ends plot on infinity value and starts a little bit before min_birth plt.axis([axis_start, infinity, 0, ind]) plt.show() -def diagram_persistence(persistence): +def diagram_persistence(persistence, alpha=0.6): """This function plots the persistence diagram. :param persistence: The persistence to plot. :type persistence: list of tuples(dimension, tuple(birth, death)). + :param alpha: alpha value in [0.0, 1.0] for points and horizontal infinity + line (default is 0.6). + :type alpha: float. :returns: plot -- An diagram plot of persistence. """ (min_birth, max_death) = __min_birth_max_death(persistence) @@ -125,18 +132,18 @@ def diagram_persistence(persistence): x = np.linspace(axis_start, infinity, 1000) # infinity line and text plt.plot(x, x, color='k', linewidth=1.0) - plt.plot(x, [infinity] * len(x), linewidth=1.0, color='k', alpha=0.4) - plt.text(axis_start, infinity, r'$\infty$', color='k', alpha=0.4) + plt.plot(x, [infinity] * len(x), linewidth=1.0, color='k', alpha=alpha) + plt.text(axis_start, infinity, r'$\infty$', color='k', alpha=alpha) # Draw points in loop for interval in reversed(persistence): if float(interval[1][1]) != float('inf'): # Finite death case - plt.scatter(interval[1][0], interval[1][1], alpha=0.4, + plt.scatter(interval[1][0], interval[1][1], alpha=alpha, color = palette[interval[0]]) else: # Infinite death case for diagram to be nicer - plt.scatter(interval[1][0], infinity, alpha=0.4, + plt.scatter(interval[1][0], infinity, alpha=alpha, color = palette[interval[0]]) ind = ind + 1 diff --git a/src/cython/src/cython/witness_complex.pyx b/src/cython/src/cython/witness_complex.pyx new file mode 100644 index 00000000..b9f354d5 --- /dev/null +++ b/src/cython/src/cython/witness_complex.pyx @@ -0,0 +1,309 @@ +from cython cimport numeric +from libcpp.vector cimport vector +from libcpp.utility cimport pair + +"""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 . +""" + +__author__ = "Vincent Rouvreau" +__copyright__ = "Copyright (C) 2016 INRIA" +__license__ = "GPL v3" + +cdef extern from "Witness_complex_interface.h" namespace "Gudhi": + cdef cppclass Witness_complex_interface "Gudhi::witness_complex::Witness_complex_interface": + Witness_complex_interface(vector[vector[double]] points, int number_of_landmarks) + double filtration() + double simplex_filtration(vector[int] simplex) + void set_filtration(double filtration) + void initialize_filtration() + int num_vertices() + int num_simplices() + void set_dimension(int dimension) + int dimension() + bint find_simplex(vector[int] simplex) + bint insert_simplex_and_subfaces(vector[int] simplex, + double filtration) + vector[pair[vector[int], double]] get_filtered_tree() + vector[pair[vector[int], double]] get_skeleton_tree(int dimension) + vector[pair[vector[int], double]] get_star_tree(vector[int] simplex) + vector[pair[vector[int], double]] get_coface_tree(vector[int] simplex, + int dimension) + void remove_maximal_simplex(vector[int] simplex) + vector[double] get_point(int vertex) + vector[pair[int, pair[double, double]]] get_persistence(int homology_coeff_field, double min_persistence) + vector[int] get_betti_numbers() + vector[int] get_persistent_betti_numbers(double from_value, double to_value) + +# WitnessComplex python interface +cdef class WitnessComplex: + """WitnessComplex is a simplicial complex constructed from ... + + """ + + cdef Witness_complex_interface * thisptr + + #cdef Witness_complex_persistence_interface * pcohptr + + def __cinit__(self, points=None, number_of_landmarks=5): + """WitnessComplex constructor. + + Args: + points (list): A list of points in d-Dimension. + number_of_landmarks (int): Number of landmarks to build the + WitnessComplex. + """ + if points is not None: + self.thisptr = new Witness_complex_interface(points, + number_of_landmarks) + + def __dealloc__(self): + if self.thisptr != NULL: + del self.thisptr + #if self.pcohptr != NULL: + # del self.pcohptr + + def get_filtration(self): + """This function returns the main simplicial complex filtration value. + + :returns: float -- the simplicial complex filtration value. + """ + return self.thisptr.filtration() + + def filtration(self, simplex): + """This function returns the simplicial complex filtration value for a + given N-simplex. + + :param simplex: The N-simplex, represented by a list of vertex. + :type simplex: list of int. + :returns: float -- the simplicial complex filtration value. + """ + return self.thisptr.simplex_filtration(simplex) + + def set_filtration(self, filtration): + """This function sets the main simplicial complex filtration value. + + :param filtration: The filtration value. + :type filtration: float. + """ + self.thisptr.set_filtration( filtration) + + def initialize_filtration(self): + """This function initializes and sorts the simplicial complex + filtration vector. + + .. note:: + + This function must be launched before persistence, betti_numbers, + persistent_betti_numbers or get_filtered_tree after inserting or + removing simplices. + """ + self.thisptr.initialize_filtration() + + def num_vertices(self): + """This function returns the number of vertices of the simplicial + complex. + + :returns: int -- the simplicial complex number of vertices. + """ + return self.thisptr.num_vertices() + + def num_simplices(self): + """This function returns the number of simplices of the simplicial + complex. + + :returns: int -- the simplicial complex number of simplices. + """ + return self.thisptr.num_simplices() + + def dimension(self): + """This function returns the dimension of the simplicial complex. + + :returns: int -- the simplicial complex dimension. + """ + return self.thisptr.dimension() + + def set_dimension(self, dimension): + """This function sets the dimension of the simplicial complex. + + :param dimension: The new dimension value. + :type dimension: int. + """ + self.thisptr.set_dimension(dimension) + + def find(self, simplex): + """This function returns if the N-simplex was found in the simplicial + complex or not. + + :param simplex: The N-simplex to find, represented by a list of vertex. + :type simplex: list of int. + :returns: bool -- true if the simplex was found, false otherwise. + """ + cdef vector[int] complex + for i in simplex: + complex.push_back(i) + return self.thisptr.find_simplex(complex) + + def insert(self, simplex, filtration=0.0): + """This function inserts the given N-simplex with the given filtration + value (default value is '0.0'). + + :param simplex: The N-simplex to insert, represented by a list of + vertex. + :type simplex: list of int. + :param filtration: The filtration value of the simplex. + :type filtration: float. + :returns: bool -- true if the simplex was found, false otherwise. + """ + cdef vector[int] complex + for i in simplex: + complex.push_back(i) + return self.thisptr.insert_simplex_and_subfaces(complex, + filtration) + + def get_filtered_tree(self): + """This function returns the tree sorted by increasing filtration + values. + + :returns: list of tuples(simplex, filtration) -- the tree sorted by + increasing filtration values. + """ + cdef vector[pair[vector[int], double]] coface_tree \ + = self.thisptr.get_filtered_tree() + ct = [] + for filtered_complex in coface_tree: + v = [] + for vertex in filtered_complex.first: + v.append(vertex) + ct.append((v, filtered_complex.second)) + return ct + + def get_skeleton_tree(self, dimension): + """This function returns the tree skeleton of a maximum given + dimension. + + :param dimension: The skeleton dimension value. + :type dimension: int. + :returns: list of tuples(simplex, filtration) -- the skeleton tree + of a maximum dimension. + """ + cdef vector[pair[vector[int], double]] coface_tree \ + = self.thisptr.get_skeleton_tree(dimension) + ct = [] + for filtered_complex in coface_tree: + v = [] + for vertex in filtered_complex.first: + v.append(vertex) + ct.append((v, filtered_complex.second)) + return ct + + def get_star_tree(self, simplex): + """This function returns the star tree of a given N-simplex. + + :param simplex: The N-simplex, represented by a list of vertex. + :type simplex: list of int. + :returns: list of tuples(simplex, filtration) -- the star tree of a + simplex. + """ + cdef vector[int] complex + for i in simplex: + complex.push_back(i) + cdef vector[pair[vector[int], double]] coface_tree \ + = self.thisptr.get_star_tree(complex) + ct = [] + for filtered_complex in coface_tree: + v = [] + for vertex in filtered_complex.first: + v.append(vertex) + ct.append((v, filtered_complex.second)) + return ct + + def get_coface_tree(self, simplex, codimension): + """This function returns the coface tree of a given N-simplex with a + given codimension. + + :param simplex: The N-simplex, represented by a list of vertex. + :type simplex: list of int. + :param codimension: The codimension. If codimension = 0, all cofaces + are returned (equivalent of get_star_tree function) + :type codimension: int. + :returns: list of tuples(simplex, filtration) -- the coface tree of a + simplex. + """ + cdef vector[int] complex + for i in simplex: + complex.push_back(i) + cdef vector[pair[vector[int], double]] coface_tree \ + = self.thisptr.get_coface_tree(complex, codimension) + ct = [] + for filtered_complex in coface_tree: + v = [] + for vertex in filtered_complex.first: + v.append(vertex) + ct.append((v, filtered_complex.second)) + return ct + + def remove_maximal_simplex(self, simplex): + """This function removes a given maximal N-simplex from the simplicial + complex. + + :param simplex: The N-simplex, represented by a list of vertex. + :type simplex: list of int. + """ + self.thisptr.remove_maximal_simplex(simplex) + + def persistence(self, homology_coeff_field=11, min_persistence=0): + """This function returns the persistence of the simplicial complex. + + :param homology_coeff_field: The homology coefficient field. Must be a + prime number + :type homology_coeff_field: int. + :param min_persistence: The minimum persistence value to take into + account (strictly greater than min_persistence). Default value is 0.0. + Sets min_persistence to -1.0 to see all values. + :type min_persistence: float. + :returns: list of tuples(dimension, tuple(birth, death)) -- the star tree of a + simplex. + """ + return self.thisptr.get_persistence(homology_coeff_field, min_persistence) + + def betti_numbers(self): + """This function returns the Betti numbers of the simplicial complex. + + :returns: list of int -- The Betti numbers ([B0, B1, ..., Bn]). + """ + return self.thisptr.get_betti_numbers() + + def persistent_betti_numbers(self, from_value, to_value): + """This function returns the persistent Betti numbers of the + simplicial complex. + + :param from_value: The persistence birth limit to be added in the + numbers (persistent birth <= from_value). + :type from_value: float. + :param to_value: The persistence death limit to be added in the + numbers (persistent death > to_value). + :type to_value: float. + + :returns: list of int -- The persistent Betti numbers ([B0, B1, ..., + Bn]). + """ + return self.thisptr.get_persistent_betti_numbers(from_value, to_value) -- cgit v1.2.3 From 30374ed5154610dc63198742220153aa9387139c Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Mon, 20 Mar 2017 15:48:04 +0000 Subject: Rename barcode_persistence and diagram_persistence functions git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2204 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: f91e283fa6b6b02198ae28a44f41bd761c1c1f48 --- src/cython/cython/persistence_graphical_tools.py | 4 ++-- src/cython/doc/persistence_graphical_tools_ref.rst | 4 ++-- src/cython/doc/persistence_graphical_tools_user.rst | 8 ++++---- src/cython/doc/pyplots/barcode_persistence.py | 2 +- src/cython/doc/pyplots/diagram_persistence.py | 2 +- .../alpha_complex_diagram_persistence_from_off_file_example.py | 2 +- src/cython/example/alpha_rips_persistence_bottleneck_distance.py | 2 -- ...g_witness_complex_diagram_persistence_from_off_file_example.py | 4 ++-- ...n_witness_complex_diagram_persistence_from_off_file_example.py | 4 ++-- src/cython/example/gudhi_graphical_tools_example.py | 4 ++-- ...bical_complex_barcode_persistence_from_perseus_file_example.py | 2 +- ...mplex_diagram_persistence_from_distance_matrix_file_example.py | 2 +- .../rips_complex_diagram_persistence_from_off_file_example.py | 2 +- src/cython/example/rips_persistence_diagram.py | 2 +- .../tangential_complex_plain_homology_from_off_file_example.py | 2 +- 15 files changed, 22 insertions(+), 24 deletions(-) (limited to 'src/cython/example/gudhi_graphical_tools_example.py') diff --git a/src/cython/cython/persistence_graphical_tools.py b/src/cython/cython/persistence_graphical_tools.py index 2a3d9f63..d7287a66 100755 --- a/src/cython/cython/persistence_graphical_tools.py +++ b/src/cython/cython/persistence_graphical_tools.py @@ -73,7 +73,7 @@ def show_palette_values(alpha=0.6): plt.show() -def barcode_persistence(persistence, alpha=0.6): +def plot_barcode_persistence(persistence, alpha=0.6): """This function plots the persistence bar code. :param persistence: The persistence to plot. @@ -108,7 +108,7 @@ def barcode_persistence(persistence, alpha=0.6): plt.axis([axis_start, infinity, 0, ind]) plt.show() -def diagram_persistence(persistence, alpha=0.6): +def plot_diagram_persistence(persistence, alpha=0.6): """This function plots the persistence diagram. :param persistence: The persistence to plot. diff --git a/src/cython/doc/persistence_graphical_tools_ref.rst b/src/cython/doc/persistence_graphical_tools_ref.rst index a12021c4..3d7e4fc7 100644 --- a/src/cython/doc/persistence_graphical_tools_ref.rst +++ b/src/cython/doc/persistence_graphical_tools_ref.rst @@ -4,5 +4,5 @@ Persistence graphical tools reference manual .. autofunction:: gudhi.__min_birth_max_death .. autofunction:: gudhi.show_palette_values -.. autofunction:: gudhi.barcode_persistence -.. autofunction:: gudhi.diagram_persistence +.. autofunction:: gudhi.plot_barcode_persistence +.. autofunction:: gudhi.plot_diagram_persistence diff --git a/src/cython/doc/persistence_graphical_tools_user.rst b/src/cython/doc/persistence_graphical_tools_user.rst index 1a5195c5..2644aa11 100644 --- a/src/cython/doc/persistence_graphical_tools_user.rst +++ b/src/cython/doc/persistence_graphical_tools_user.rst @@ -33,7 +33,7 @@ This function can display the persistence result as a barcode: periodic_cc = gudhi.PeriodicCubicalComplex(perseus_file='3d_torus.txt') diag = periodic_cc.persistence() - gudhi.barcode_persistence(diag) + gudhi.plot_barcode_persistence(diag) .. plot:: @@ -41,7 +41,7 @@ This function can display the persistence result as a barcode: periodic_cc = gudhi.PeriodicCubicalComplex(perseus_file='3d_torus.txt') diag = periodic_cc.persistence() - gudhi.barcode_persistence(diag) + gudhi.plot_barcode_persistence(diag) Show persistence as a diagram ----------------------------- @@ -55,7 +55,7 @@ This function can display the persistence result as a diagram: rips_complex = gudhi.RipsComplex(off_file='tore3D_300.off', max_edge_length=2.0) simplex_tree = rips_complex.create_simplex_tree(max_dimension=3) diag = simplex_tree.persistence() - gudhi.diagram_persistence(diag) + gudhi.plot_diagram_persistence(diag) .. plot:: @@ -64,4 +64,4 @@ This function can display the persistence result as a diagram: rips_complex = gudhi.RipsComplex(off_file='tore3D_300.off', max_edge_length=2.0) simplex_tree = rips_complex.create_simplex_tree(max_dimension=3) diag = simplex_tree.persistence() - gudhi.diagram_persistence(diag) + gudhi.plot_diagram_persistence(diag) diff --git a/src/cython/doc/pyplots/barcode_persistence.py b/src/cython/doc/pyplots/barcode_persistence.py index 95bbd343..9fcb33d0 100755 --- a/src/cython/doc/pyplots/barcode_persistence.py +++ b/src/cython/doc/pyplots/barcode_persistence.py @@ -2,4 +2,4 @@ import gudhi periodic_cc = gudhi.PeriodicCubicalComplex(perseus_file='../3d_torus.txt') diag = periodic_cc.persistence() -gudhi.barcode_persistence(diag) +gudhi.plot_barcode_persistence(diag) diff --git a/src/cython/doc/pyplots/diagram_persistence.py b/src/cython/doc/pyplots/diagram_persistence.py index b006b0bf..fbb6e60b 100755 --- a/src/cython/doc/pyplots/diagram_persistence.py +++ b/src/cython/doc/pyplots/diagram_persistence.py @@ -2,4 +2,4 @@ import gudhi alpha_complex = gudhi.AlphaComplex(off_file='../tore3D_300.off') diag = alpha_complex.persistence() -gudhi.diagram_persistence(diag) +gudhi.plot_diagram_persistence(diag) diff --git a/src/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py b/src/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py index ae03aa67..9714b382 100755 --- a/src/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py +++ b/src/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py @@ -63,7 +63,7 @@ with open(args.file, 'r') as f: print(simplex_tree.betti_numbers()) if args.no_diagram == False: - gudhi.diagram_persistence(diag) + gudhi.plot_diagram_persistence(diag) else: print(args.file, "is not a valid OFF file") diff --git a/src/cython/example/alpha_rips_persistence_bottleneck_distance.py b/src/cython/example/alpha_rips_persistence_bottleneck_distance.py index 04a59b44..cd64704b 100755 --- a/src/cython/example/alpha_rips_persistence_bottleneck_distance.py +++ b/src/cython/example/alpha_rips_persistence_bottleneck_distance.py @@ -42,8 +42,6 @@ parser.add_argument("-t", "--threshold", type=float, default=0.5) parser.add_argument("-d", "--max_dimension", type=int, default=1) args = parser.parse_args() -print(repr(float('inf'))) -print(repr(math.sqrt(float('inf')))) with open(args.file, 'r') as f: first_line = f.readline() if (first_line == 'OFF\n') or (first_line == 'nOFF\n'): diff --git a/src/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py b/src/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py index 6c3e3a8a..3addf708 100755 --- a/src/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py +++ b/src/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py @@ -34,7 +34,7 @@ parser = argparse.ArgumentParser(description='EuclideanStrongWitnessComplex crea epilog='Example: ' 'example/witness_complex_diagram_persistence_from_off_file_example.py ' '-f ../data/points/tore3D_300.off -a 1.0 -n 20 -d 2' - '- Constructs a alpha complex with the ' + '- 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) @@ -70,7 +70,7 @@ with open(args.file, 'r') as f: print(simplex_tree.betti_numbers()) if args.no_diagram == False: - gudhi.diagram_persistence(diag) + gudhi.plot_diagram_persistence(diag) else: print(args.file, "is not a valid OFF file") diff --git a/src/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py b/src/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py index 7f04a98e..1e7d788a 100755 --- a/src/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py +++ b/src/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py @@ -34,7 +34,7 @@ parser = argparse.ArgumentParser(description='EuclideanWitnessComplex creation f epilog='Example: ' 'example/witness_complex_diagram_persistence_from_off_file_example.py ' '-f ../data/points/tore3D_300.off -a 1.0 -n 20 -d 2' - '- Constructs a alpha complex with the ' + '- 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) @@ -70,7 +70,7 @@ with open(args.file, 'r') as f: print(simplex_tree.betti_numbers()) if args.no_diagram == False: - gudhi.diagram_persistence(diag) + gudhi.plot_diagram_persistence(diag) else: print(args.file, "is not a valid OFF file") diff --git a/src/cython/example/gudhi_graphical_tools_example.py b/src/cython/example/gudhi_graphical_tools_example.py index 40558bee..f1aa5d73 100755 --- a/src/cython/example/gudhi_graphical_tools_example.py +++ b/src/cython/example/gudhi_graphical_tools_example.py @@ -39,9 +39,9 @@ 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.barcode_persistence(persistence) +gudhi.plot_barcode_persistence(persistence) print("#####################################################################") print("Show diagram persistence example") -gudhi.diagram_persistence(persistence) +gudhi.plot_diagram_persistence(persistence) diff --git a/src/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py b/src/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py index a9545ee9..128706b2 100755 --- a/src/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py +++ b/src/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py @@ -71,6 +71,6 @@ if is_file_perseus(args.file): print("betti_numbers()=") print(periodic_cubical_complex.betti_numbers()) if args.no_barcode == False: - gudhi.barcode_persistence(diag) + gudhi.plot_barcode_persistence(diag) else: print(args.file, "is not a valid perseus style file") diff --git a/src/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py b/src/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py index 2b726f90..5f1416be 100755 --- a/src/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py +++ b/src/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py @@ -64,7 +64,7 @@ with open(args.file, 'r') as f: print(simplex_tree.betti_numbers()) if args.no_diagram == False: - gudhi.diagram_persistence(diag) + gudhi.plot_diagram_persistence(diag) else: print(args.file, "is not a valid OFF file") diff --git a/src/cython/example/rips_complex_diagram_persistence_from_off_file_example.py b/src/cython/example/rips_complex_diagram_persistence_from_off_file_example.py index eb1c4ed5..4f888e77 100755 --- a/src/cython/example/rips_complex_diagram_persistence_from_off_file_example.py +++ b/src/cython/example/rips_complex_diagram_persistence_from_off_file_example.py @@ -64,7 +64,7 @@ with open(args.file, 'r') as f: print(simplex_tree.betti_numbers()) if args.no_diagram == False: - gudhi.diagram_persistence(diag) + gudhi.plot_diagram_persistence(diag) else: print(args.file, "is not a valid OFF file") diff --git a/src/cython/example/rips_persistence_diagram.py b/src/cython/example/rips_persistence_diagram.py index e485b2f5..3d51f379 100755 --- a/src/cython/example/rips_persistence_diagram.py +++ b/src/cython/example/rips_persistence_diagram.py @@ -39,4 +39,4 @@ simplex_tree = rips.create_simplex_tree(max_dimension=1) diag = simplex_tree.persistence(homology_coeff_field=2, min_persistence=0) print("diag=", diag) -gudhi.diagram_persistence(diag) +gudhi.plot_diagram_persistence(diag) diff --git a/src/cython/example/tangential_complex_plain_homology_from_off_file_example.py b/src/cython/example/tangential_complex_plain_homology_from_off_file_example.py index be4c40be..a3fc9911 100755 --- a/src/cython/example/tangential_complex_plain_homology_from_off_file_example.py +++ b/src/cython/example/tangential_complex_plain_homology_from_off_file_example.py @@ -59,7 +59,7 @@ with open(args.file, 'r') as f: print(st.betti_numbers()) if args.no_diagram == False: - gudhi.diagram_persistence(diag) + gudhi.plot_diagram_persistence(diag) else: print(args.file, "is not a valid OFF file") -- cgit v1.2.3 From 0724c2bcab0fa444ecf8178c27f59ca788a0aa03 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Wed, 22 Mar 2017 21:19:15 +0000 Subject: Rename plot_persistence_diagram and barcode git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2220 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 66a06ffdc62d5284119df80c3f104a48568cd241 --- src/cython/cython/persistence_graphical_tools.py | 4 ++-- src/cython/doc/persistence_graphical_tools_ref.rst | 4 ++-- src/cython/doc/persistence_graphical_tools_user.rst | 8 ++++---- src/cython/doc/pyplots/barcode_persistence.py | 2 +- src/cython/doc/pyplots/diagram_persistence.py | 2 +- .../alpha_complex_diagram_persistence_from_off_file_example.py | 2 +- ...g_witness_complex_diagram_persistence_from_off_file_example.py | 2 +- ...n_witness_complex_diagram_persistence_from_off_file_example.py | 2 +- src/cython/example/gudhi_graphical_tools_example.py | 4 ++-- ...bical_complex_barcode_persistence_from_perseus_file_example.py | 2 +- ...mplex_diagram_persistence_from_distance_matrix_file_example.py | 2 +- .../rips_complex_diagram_persistence_from_off_file_example.py | 2 +- src/cython/example/rips_persistence_diagram.py | 2 +- .../tangential_complex_plain_homology_from_off_file_example.py | 2 +- 14 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src/cython/example/gudhi_graphical_tools_example.py') diff --git a/src/cython/cython/persistence_graphical_tools.py b/src/cython/cython/persistence_graphical_tools.py index d7287a66..a984633e 100755 --- a/src/cython/cython/persistence_graphical_tools.py +++ b/src/cython/cython/persistence_graphical_tools.py @@ -73,7 +73,7 @@ def show_palette_values(alpha=0.6): plt.show() -def plot_barcode_persistence(persistence, alpha=0.6): +def plot_persistence_barcode(persistence, alpha=0.6): """This function plots the persistence bar code. :param persistence: The persistence to plot. @@ -108,7 +108,7 @@ def plot_barcode_persistence(persistence, alpha=0.6): plt.axis([axis_start, infinity, 0, ind]) plt.show() -def plot_diagram_persistence(persistence, alpha=0.6): +def plot_persistence_diagram(persistence, alpha=0.6): """This function plots the persistence diagram. :param persistence: The persistence to plot. diff --git a/src/cython/doc/persistence_graphical_tools_ref.rst b/src/cython/doc/persistence_graphical_tools_ref.rst index 3d7e4fc7..27c2f68a 100644 --- a/src/cython/doc/persistence_graphical_tools_ref.rst +++ b/src/cython/doc/persistence_graphical_tools_ref.rst @@ -4,5 +4,5 @@ Persistence graphical tools reference manual .. autofunction:: gudhi.__min_birth_max_death .. autofunction:: gudhi.show_palette_values -.. autofunction:: gudhi.plot_barcode_persistence -.. autofunction:: gudhi.plot_diagram_persistence +.. autofunction:: gudhi.plot_persistence_barcode +.. autofunction:: gudhi.plot_persistence_diagram diff --git a/src/cython/doc/persistence_graphical_tools_user.rst b/src/cython/doc/persistence_graphical_tools_user.rst index 2644aa11..f713e971 100644 --- a/src/cython/doc/persistence_graphical_tools_user.rst +++ b/src/cython/doc/persistence_graphical_tools_user.rst @@ -33,7 +33,7 @@ This function can display the persistence result as a barcode: periodic_cc = gudhi.PeriodicCubicalComplex(perseus_file='3d_torus.txt') diag = periodic_cc.persistence() - gudhi.plot_barcode_persistence(diag) + gudhi.plot_persistence_barcode(diag) .. plot:: @@ -41,7 +41,7 @@ This function can display the persistence result as a barcode: periodic_cc = gudhi.PeriodicCubicalComplex(perseus_file='3d_torus.txt') diag = periodic_cc.persistence() - gudhi.plot_barcode_persistence(diag) + gudhi.plot_persistence_barcode(diag) Show persistence as a diagram ----------------------------- @@ -55,7 +55,7 @@ This function can display the persistence result as a diagram: rips_complex = gudhi.RipsComplex(off_file='tore3D_300.off', max_edge_length=2.0) simplex_tree = rips_complex.create_simplex_tree(max_dimension=3) diag = simplex_tree.persistence() - gudhi.plot_diagram_persistence(diag) + gudhi.plot_persistence_diagram(diag) .. plot:: @@ -64,4 +64,4 @@ This function can display the persistence result as a diagram: rips_complex = gudhi.RipsComplex(off_file='tore3D_300.off', max_edge_length=2.0) simplex_tree = rips_complex.create_simplex_tree(max_dimension=3) diag = simplex_tree.persistence() - gudhi.plot_diagram_persistence(diag) + gudhi.plot_persistence_diagram(diag) diff --git a/src/cython/doc/pyplots/barcode_persistence.py b/src/cython/doc/pyplots/barcode_persistence.py index 9fcb33d0..c06ac5a7 100755 --- a/src/cython/doc/pyplots/barcode_persistence.py +++ b/src/cython/doc/pyplots/barcode_persistence.py @@ -2,4 +2,4 @@ import gudhi periodic_cc = gudhi.PeriodicCubicalComplex(perseus_file='../3d_torus.txt') diag = periodic_cc.persistence() -gudhi.plot_barcode_persistence(diag) +gudhi.plot_persistence_barcode(diag) diff --git a/src/cython/doc/pyplots/diagram_persistence.py b/src/cython/doc/pyplots/diagram_persistence.py index fbb6e60b..b4714fe3 100755 --- a/src/cython/doc/pyplots/diagram_persistence.py +++ b/src/cython/doc/pyplots/diagram_persistence.py @@ -2,4 +2,4 @@ import gudhi alpha_complex = gudhi.AlphaComplex(off_file='../tore3D_300.off') diag = alpha_complex.persistence() -gudhi.plot_diagram_persistence(diag) +gudhi.plot_persistence_diagram(diag) diff --git a/src/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py b/src/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py index 9714b382..adedc7d2 100755 --- a/src/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py +++ b/src/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py @@ -63,7 +63,7 @@ with open(args.file, 'r') as f: print(simplex_tree.betti_numbers()) if args.no_diagram == False: - gudhi.plot_diagram_persistence(diag) + gudhi.plot_persistence_diagram(diag) else: print(args.file, "is not a valid OFF file") diff --git a/src/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py b/src/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py index 3addf708..2474fc87 100755 --- a/src/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py +++ b/src/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py @@ -70,7 +70,7 @@ with open(args.file, 'r') as f: print(simplex_tree.betti_numbers()) if args.no_diagram == False: - gudhi.plot_diagram_persistence(diag) + gudhi.plot_persistence_diagram(diag) else: print(args.file, "is not a valid OFF file") diff --git a/src/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py b/src/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py index 1e7d788a..5a75417b 100755 --- a/src/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py +++ b/src/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py @@ -70,7 +70,7 @@ with open(args.file, 'r') as f: print(simplex_tree.betti_numbers()) if args.no_diagram == False: - gudhi.plot_diagram_persistence(diag) + gudhi.plot_persistence_diagram(diag) else: print(args.file, "is not a valid OFF file") diff --git a/src/cython/example/gudhi_graphical_tools_example.py b/src/cython/example/gudhi_graphical_tools_example.py index f1aa5d73..bc3b16ec 100755 --- a/src/cython/example/gudhi_graphical_tools_example.py +++ b/src/cython/example/gudhi_graphical_tools_example.py @@ -39,9 +39,9 @@ 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_barcode_persistence(persistence) +gudhi.plot_persistence_barcode(persistence) print("#####################################################################") print("Show diagram persistence example") -gudhi.plot_diagram_persistence(persistence) +gudhi.plot_persistence_diagram(persistence) diff --git a/src/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py b/src/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py index 128706b2..db530161 100755 --- a/src/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py +++ b/src/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py @@ -71,6 +71,6 @@ if is_file_perseus(args.file): print("betti_numbers()=") print(periodic_cubical_complex.betti_numbers()) if args.no_barcode == False: - gudhi.plot_barcode_persistence(diag) + gudhi.plot_persistence_barcode(diag) else: print(args.file, "is not a valid perseus style file") diff --git a/src/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py b/src/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py index 5f1416be..664eb5c4 100755 --- a/src/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py +++ b/src/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py @@ -64,7 +64,7 @@ with open(args.file, 'r') as f: print(simplex_tree.betti_numbers()) if args.no_diagram == False: - gudhi.plot_diagram_persistence(diag) + gudhi.plot_persistence_diagram(diag) else: print(args.file, "is not a valid OFF file") diff --git a/src/cython/example/rips_complex_diagram_persistence_from_off_file_example.py b/src/cython/example/rips_complex_diagram_persistence_from_off_file_example.py index 4f888e77..4c21b98e 100755 --- a/src/cython/example/rips_complex_diagram_persistence_from_off_file_example.py +++ b/src/cython/example/rips_complex_diagram_persistence_from_off_file_example.py @@ -64,7 +64,7 @@ with open(args.file, 'r') as f: print(simplex_tree.betti_numbers()) if args.no_diagram == False: - gudhi.plot_diagram_persistence(diag) + gudhi.plot_persistence_diagram(diag) else: print(args.file, "is not a valid OFF file") diff --git a/src/cython/example/rips_persistence_diagram.py b/src/cython/example/rips_persistence_diagram.py index 3d51f379..4e5cd2c8 100755 --- a/src/cython/example/rips_persistence_diagram.py +++ b/src/cython/example/rips_persistence_diagram.py @@ -39,4 +39,4 @@ simplex_tree = rips.create_simplex_tree(max_dimension=1) diag = simplex_tree.persistence(homology_coeff_field=2, min_persistence=0) print("diag=", diag) -gudhi.plot_diagram_persistence(diag) +gudhi.plot_persistence_diagram(diag) diff --git a/src/cython/example/tangential_complex_plain_homology_from_off_file_example.py b/src/cython/example/tangential_complex_plain_homology_from_off_file_example.py index a3fc9911..4845eb47 100755 --- a/src/cython/example/tangential_complex_plain_homology_from_off_file_example.py +++ b/src/cython/example/tangential_complex_plain_homology_from_off_file_example.py @@ -59,7 +59,7 @@ with open(args.file, 'r') as f: print(st.betti_numbers()) if args.no_diagram == False: - gudhi.plot_diagram_persistence(diag) + gudhi.plot_persistence_diagram(diag) else: print(args.file, "is not a valid OFF file") -- cgit v1.2.3