summaryrefslogtreecommitdiff
path: root/src/python/gudhi/alpha_complex.pyx
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2021-03-24 15:27:11 +0100
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2021-03-24 15:27:11 +0100
commit77e577eb28ca7622553cd0527db76d46b473c445 (patch)
tree74c279ec1b90292a2df33dbe7a4dca0a6673af71 /src/python/gudhi/alpha_complex.pyx
parent0f19f5ecd180ac92458d5257696f1f367de54ca8 (diff)
Remove read_weights and depreciate off_file
Diffstat (limited to 'src/python/gudhi/alpha_complex.pyx')
-rw-r--r--src/python/gudhi/alpha_complex.pyx30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/python/gudhi/alpha_complex.pyx b/src/python/gudhi/alpha_complex.pyx
index 9c364b76..5d181391 100644
--- a/src/python/gudhi/alpha_complex.pyx
+++ b/src/python/gudhi/alpha_complex.pyx
@@ -18,10 +18,11 @@ from libcpp cimport bool
from libc.stdint cimport intptr_t
import errno
import os
+import warnings
from gudhi.simplex_tree cimport *
from gudhi.simplex_tree import SimplexTree
-from gudhi import read_points_from_off_file, read_weights
+from gudhi import read_points_from_off_file
__author__ = "Vincent Rouvreau"
__copyright__ = "Copyright (C) 2016 Inria"
@@ -56,54 +57,45 @@ 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='', precision='safe'):
+ def __init__(self, points=[], off_file='', weights=[], 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 <fileformats.html#off-file-format>`_ name.
- If an `off_file` is given with `points` as arguments, only points from the
- file are taken into account.
+ :param off_file: **[deprecated]** An `OFF file style <fileformats.html#off-file-format>`_
+ name.
+ If an `off_file` is given with `points` as arguments, only points from the file are
+ taken into account.
:type off_file: string
:param weights: A list of weights. If set, the number of weights must correspond to the
number of points.
: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` as arguments, only weights from the
- file are taken into account.
-
- :type weight_file: string
-
:param precision: Alpha complex precision can be 'fast', 'safe' or 'exact'. Default is
'safe'.
:type precision: string
- :raises FileNotFoundError: If `off_file` and/or `weight_file` is set but not found.
+ :raises FileNotFoundError: **[deprecated]** If `off_file` is set but not found.
:raises ValueError: In case of inconsistency between the number of points and weights.
"""
# The real cython constructor
- def __cinit__(self, points = [], off_file = '', weights=[], weight_file='', precision = 'safe'):
+ def __cinit__(self, points = [], off_file = '', weights=[], 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 off_file:
+ warnings.warn("off_file is a deprecated parameter, please consider using gudhi.read_points_from_off_file",
+ DeprecationWarning)
if os.path.isfile(off_file):
points = read_points_from_off_file(off_file = off_file)
else:
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), off_file)
- if weight_file:
- if os.path.isfile(weight_file):
- weights = read_weights(weight_file = weight_file)
- else:
- raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), weight_file)
-
# weights are set but is inconsistent with the number of points
if len(weights) != 0 and len(weights) != len(points):
raise ValueError("Inconsistency between the number of points and weights")