summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGard Spreemann <gspr@nonempty.org>2021-04-30 15:08:19 +0200
committerGard Spreemann <gspr@nonempty.org>2021-04-30 15:08:19 +0200
commit9841a3c845905c9b278ddb7828260a3d6fa5fce7 (patch)
treea238f1971c8481e5c78dddbbee4ef592732cc9c1
parent7d3fba5d1561b3241b914583ac420434e788e27f (diff)
Allow specifying range for uniform predefined grid for compatibility with old class
-rw-r--r--src/python/gudhi/representations/vector_methods.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/python/gudhi/representations/vector_methods.py b/src/python/gudhi/representations/vector_methods.py
index 82f071d7..86afaa1c 100644
--- a/src/python/gudhi/representations/vector_methods.py
+++ b/src/python/gudhi/representations/vector_methods.py
@@ -359,8 +359,8 @@ class BettiCurve2(BaseEstimator, TransformerMixin):
Parameters
----------
- predefined_grid: 1d array or None, default=None
- Predefined filtration grid points at which to compute the Betti curves. Must be strictly ordered. Infinities are OK. If None (default), a grid will be computed that captures all changes in Betti numbers in the provided data.
+ predefined_grid: 1d array, triple or None, default=None
+ Predefined filtration grid points at which to compute the Betti curves. Must be strictly ordered. Infinities are OK. If a triple of the form (l, u, n), the grid will be uniform from l to u in n steps. If None (default), a grid will be computed that captures all changes in Betti numbers in the provided data.
Attributes
----------
@@ -382,7 +382,13 @@ class BettiCurve2(BaseEstimator, TransformerMixin):
"""
def __init__(self, predefined_grid = None):
- self.predefined_grid = predefined_grid
+ if isinstance(predefined_grid, tuple):
+ if len(predefined_grid) != 3:
+ raise ValueError("Expected array, None or triple.")
+
+ self.predefined_grid = np.linspace(predefined_grid[0], predefined_grid[1], predefined_grid[2])
+ else:
+ self.predefined_grid = predefined_grid
def is_fitted(self):