summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com>2022-11-14 13:26:45 +0100
committerGitHub <noreply@github.com>2022-11-14 13:26:45 +0100
commit969f3daea0eed3deb26c47365b1a03a9629d48b5 (patch)
treec73a4ed73b25a968ca24710fcab8f91ee3eb2a25
parent3e30893ee41aba1311f6338eda2060cae2b9507d (diff)
parent7c17408897a95a1f74626e8ff0ec8101ac4f92fd (diff)
Merge pull request #725 from mglisse/rips_points
Make RipsComplex construction less confusing
-rw-r--r--.github/next_release.md3
-rw-r--r--src/python/gudhi/rips_complex.pyx13
-rwxr-xr-xsrc/python/test/test_simplex_generators.py2
3 files changed, 10 insertions, 8 deletions
diff --git a/.github/next_release.md b/.github/next_release.md
index 81599b2c..d5fcef1c 100644
--- a/.github/next_release.md
+++ b/.github/next_release.md
@@ -9,6 +9,9 @@ Below is a list of changes made since GUDHI 3.6.0:
- [Module](link)
- ...
+- [Rips complex](https://gudhi.inria.fr/python/latest/rips_complex_user.html)
+ - Construction now rejects positional arguments, you need to specify `points=X`.
+
- Installation
- c++17 is the new minimal standard to compile the library. This implies Visual Studio minimal version is now 2017.
diff --git a/src/python/gudhi/rips_complex.pyx b/src/python/gudhi/rips_complex.pyx
index c3470292..d748f91e 100644
--- a/src/python/gudhi/rips_complex.pyx
+++ b/src/python/gudhi/rips_complex.pyx
@@ -41,31 +41,30 @@ cdef class RipsComplex:
cdef Rips_complex_interface thisref
# Fake constructor that does nothing but documenting the constructor
- def __init__(self, points=None, distance_matrix=None,
+ def __init__(self, *, points=None, distance_matrix=None,
max_edge_length=float('inf'), sparse=None):
"""RipsComplex constructor.
- :param max_edge_length: Rips value.
- :type max_edge_length: float
-
:param points: A list of points in d-Dimension.
- :type points: list of list of float
+ :type points: List[List[float]]
Or
:param distance_matrix: A distance matrix (full square or lower
triangular).
- :type points: list of list of float
+ :type distance_matrix: List[List[float]]
And in both cases
+ :param max_edge_length: Rips value.
+ :type max_edge_length: float
:param sparse: If this is not None, it switches to building a sparse
Rips and represents the approximation parameter epsilon.
:type sparse: float
"""
# The real cython constructor
- def __cinit__(self, points=None, distance_matrix=None,
+ def __cinit__(self, *, points=None, distance_matrix=None,
max_edge_length=float('inf'), sparse=None):
if sparse is not None:
if distance_matrix is not None:
diff --git a/src/python/test/test_simplex_generators.py b/src/python/test/test_simplex_generators.py
index 8a9b4844..c567d4c1 100755
--- a/src/python/test/test_simplex_generators.py
+++ b/src/python/test/test_simplex_generators.py
@@ -14,7 +14,7 @@ import numpy as np
def test_flag_generators():
pts = np.array([[0, 0], [0, 1.01], [1, 0], [1.02, 1.03], [100, 0], [100, 3.01], [103, 0], [103.02, 3.03]])
- r = gudhi.RipsComplex(pts, max_edge_length=4)
+ r = gudhi.RipsComplex(points=pts, max_edge_length=4)
st = r.create_simplex_tree(max_dimension=50)
st.persistence()
g = st.flag_persistence_generators()