summaryrefslogtreecommitdiff
path: root/src/python/gudhi/representations/vector_methods.py
diff options
context:
space:
mode:
authorGard Spreemann <gspr@nonempty.org>2021-04-28 16:11:34 +0200
committerGard Spreemann <gspr@nonempty.org>2021-04-28 16:11:34 +0200
commit7d3fba5d1561b3241b914583ac420434e788e27f (patch)
treeeebea33029714bbe1920461600bea8e3cce155de /src/python/gudhi/representations/vector_methods.py
parent79f002efaa1584e89f85928e464dd73ea64593b6 (diff)
Handle an empty list of persistence diagrams
Diffstat (limited to 'src/python/gudhi/representations/vector_methods.py')
-rw-r--r--src/python/gudhi/representations/vector_methods.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/python/gudhi/representations/vector_methods.py b/src/python/gudhi/representations/vector_methods.py
index 5133a64c..82f071d7 100644
--- a/src/python/gudhi/representations/vector_methods.py
+++ b/src/python/gudhi/representations/vector_methods.py
@@ -417,6 +417,9 @@ class BettiCurve2(BaseEstimator, TransformerMixin):
"""
if self.predefined_grid is None:
+ if not X:
+ X = [np.zeros((0, 2))]
+
N = len(X)
events = np.concatenate([pd.flatten(order="F") for pd in X], axis=0)
@@ -469,6 +472,9 @@ class BettiCurve2(BaseEstimator, TransformerMixin):
if not self.is_fitted():
raise NotFittedError("Not fitted.")
+ if not X:
+ X = [np.zeros((0, 2))]
+
N = len(X)
events = np.concatenate([pd.flatten(order="F") for pd in X], axis=0)