From dcb90cc644f91265c9bd3011a89b5f0b0e9f3869 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Tue, 23 Mar 2021 16:21:00 +0100 Subject: Remove weighted_points, as it is overdesigned --- src/python/doc/alpha_complex_user.rst | 18 ++++++------------ src/python/gudhi/alpha_complex.pyx | 22 ++++++---------------- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/src/python/doc/alpha_complex_user.rst b/src/python/doc/alpha_complex_user.rst index 5e028cdc..f59f69e7 100644 --- a/src/python/doc/alpha_complex_user.rst +++ b/src/python/doc/alpha_complex_user.rst @@ -191,18 +191,12 @@ Then, it is asked to display information about the alpha complex. .. testcode:: from gudhi import AlphaComplex - wgt_ac = AlphaComplex(weighted_points=[[[ 1., -1., -1.], 4.], - [[-1., 1., -1.], 4.], - [[-1., -1., 1.], 4.], - [[ 1., 1., 1.], 4.], - [[ 2., 2., 2.], 1.]]) - # equivalent to: - # wgt_ac = AlphaComplex(points=[[ 1., -1., -1.], - # [-1., 1., -1.], - # [-1., -1., 1.], - # [ 1., 1., 1.], - # [ 2., 2., 2.]], - # weights = [4., 4., 4., 4., 1.]) + wgt_ac = AlphaComplex(points=[[ 1., -1., -1.], + [-1., 1., -1.], + [-1., -1., 1.], + [ 1., 1., 1.], + [ 2., 2., 2.]], + weights = [4., 4., 4., 4., 1.]) stree = wgt_ac.create_simplex_tree() print('Weighted alpha complex is of dimension ', stree.dimension(), ' - ', diff --git a/src/python/gudhi/alpha_complex.pyx b/src/python/gudhi/alpha_complex.pyx index d4c4ba20..9c364b76 100644 --- a/src/python/gudhi/alpha_complex.pyx +++ b/src/python/gudhi/alpha_complex.pyx @@ -56,15 +56,14 @@ cdef class AlphaComplex: cdef Alpha_complex_interface * this_ptr # Fake constructor that does nothing but documenting the constructor - def __init__(self, points=[], off_file='', weights=[], weight_file='', weighted_points=[], - precision='safe'): + def __init__(self, points=[], off_file='', weights=[], weight_file='', precision='safe'): """AlphaComplex constructor. :param points: A list of points in d-Dimension. :type points: Iterable[Iterable[float]] :param off_file: An `OFF file style `_ name. - If an `off_file` is given with `points` or `weighted_points`, only points from the + If an `off_file` is given with `points` as arguments, only points from the file are taken into account. :type off_file: string @@ -73,16 +72,11 @@ cdef class AlphaComplex: :type weights: Iterable[float] :param weight_file: A file containing a list of weights (one per line). - If a `weight_file` is given with `weights` or `weighted_points`, only weights from the + If a `weight_file` is given with `weights` as arguments, only weights from the file are taken into account. :type weight_file: string - :param weighted_points: A list of points in d-Dimension and its weight. - If `weighted_points` are given with `weights` or `points`, these last ones will - not be taken into account. - :type weighted_points: Iterable[Iterable[float], float] - :param precision: Alpha complex precision can be 'fast', 'safe' or 'exact'. Default is 'safe'. :type precision: string @@ -92,16 +86,12 @@ cdef class AlphaComplex: """ # The real cython constructor - def __cinit__(self, points = [], off_file = '', weights=[], weight_file='', weighted_points=[], - precision = 'safe'): - assert precision in ['fast', 'safe', 'exact'], "Alpha complex precision can only be 'fast', 'safe' or 'exact'" + def __cinit__(self, points = [], off_file = '', weights=[], weight_file='', precision = 'safe'): + assert precision in ['fast', 'safe', 'exact'], \ + "Alpha complex precision can only be 'fast', 'safe' or 'exact'" cdef bool fast = precision == 'fast' cdef bool exact = precision == 'exact' - if len(weighted_points) > 0: - points = [wpt[0] for wpt in weighted_points] - weights = [wpt[1] for wpt in weighted_points] - if off_file: if os.path.isfile(off_file): points = read_points_from_off_file(off_file = off_file) -- cgit v1.2.3