summaryrefslogtreecommitdiff
path: root/src/python/gudhi/representations/vector_methods.py
diff options
context:
space:
mode:
authormathieu <mathieu.carriere3@gmail.com>2019-12-11 13:50:21 -0500
committermathieu <mathieu.carriere3@gmail.com>2019-12-11 13:50:21 -0500
commit363ae171ee7f45cf11d01653e4d4e9580117cfd0 (patch)
tree8a7a9f978dfc4c526034aa32753dba6dfdcfa926 /src/python/gudhi/representations/vector_methods.py
parent682f8c8cb18ba898a3d23a82fff454e862541aed (diff)
fixed landscape
Diffstat (limited to 'src/python/gudhi/representations/vector_methods.py')
-rw-r--r--src/python/gudhi/representations/vector_methods.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/python/gudhi/representations/vector_methods.py b/src/python/gudhi/representations/vector_methods.py
index 083551a4..cd532275 100644
--- a/src/python/gudhi/representations/vector_methods.py
+++ b/src/python/gudhi/representations/vector_methods.py
@@ -129,19 +129,19 @@ class Landscape(BaseEstimator, TransformerMixin):
diagram, num_pts_in_diag = X[i], X[i].shape[0]
- ls = np.zeros([self.num_landscapes, self.resolution])
+ ls = np.zeros([self.num_landscapes, self.resolution + self.nan_in_range.sum()])
events = []
- for j in range(self.resolution):
+ for j in range(self.resolution + self.nan_in_range.sum()):
events.append([])
for j in range(num_pts_in_diag):
[px,py] = diagram[j,:2]
- min_idx = np.clip(np.ceil((px - self.sample_range[0]) / step_x).astype(int), 0, self.resolution)
- mid_idx = np.clip(np.ceil((0.5*(py+px) - self.sample_range[0]) / step_x).astype(int), 0, self.resolution)
- max_idx = np.clip(np.ceil((py - self.sample_range[0]) / step_x).astype(int), 0, self.resolution)
+ min_idx = np.clip(np.ceil((px - self.sample_range[0]) / step_x).astype(int), 0, self.resolution + self.nan_in_range.sum())
+ mid_idx = np.clip(np.ceil((0.5*(py+px) - self.sample_range[0]) / step_x).astype(int), 0, self.resolution + self.nan_in_range.sum())
+ max_idx = np.clip(np.ceil((py - self.sample_range[0]) / step_x).astype(int), 0, self.resolution + self.nan_in_range.sum())
- if min_idx < self.resolution and max_idx > 0:
+ if min_idx < self.resolution + self.nan_in_range.sum() and max_idx > 0:
landscape_value = self.sample_range[0] + min_idx * step_x - px
for k in range(min_idx, mid_idx):
@@ -153,7 +153,7 @@ class Landscape(BaseEstimator, TransformerMixin):
events[k].append(landscape_value)
landscape_value -= step_x
- for j in range(self.resolution):
+ for j in range(self.resolution + self.nan_in_range.sum()):
events[j].sort(reverse=True)
for k in range( min(self.num_landscapes, len(events[j])) ):
ls[k,j] = events[j][k]