summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Rouvreau <vincent.rouvreau@inria.fr>2021-11-04 17:26:04 +0100
committerVincent Rouvreau <vincent.rouvreau@inria.fr>2021-11-04 17:26:04 +0100
commit7c26436a703a476d28cf568949275d26d1827c36 (patch)
tree6a3b94691aa5444e1a32351df7cea789b1a81914
parenta2761c01ceb26a057b94be1d45433335704c1581 (diff)
code review: use len instead of .shape[0]
-rw-r--r--src/python/gudhi/cubical_complex.pyx5
-rw-r--r--src/python/gudhi/periodic_cubical_complex.pyx5
-rw-r--r--src/python/gudhi/simplex_tree.pyx5
3 files changed, 6 insertions, 9 deletions
diff --git a/src/python/gudhi/cubical_complex.pyx b/src/python/gudhi/cubical_complex.pyx
index 04569bd8..8e244bb8 100644
--- a/src/python/gudhi/cubical_complex.pyx
+++ b/src/python/gudhi/cubical_complex.pyx
@@ -283,7 +283,6 @@ cdef class CubicalComplex:
assert self.pcohptr != NULL, "compute_persistence() must be called before persistence_intervals_in_dimension()"
piid = np.array(self.pcohptr.intervals_in_dimension(dimension))
# Workaround https://github.com/GUDHI/gudhi-devel/issues/507
- if piid.shape[0] == 0:
+ if len(piid) == 0:
return np.empty(shape = [0, 2])
- else:
- return piid
+ return piid
diff --git a/src/python/gudhi/periodic_cubical_complex.pyx b/src/python/gudhi/periodic_cubical_complex.pyx
index bd91ccde..6c21e902 100644
--- a/src/python/gudhi/periodic_cubical_complex.pyx
+++ b/src/python/gudhi/periodic_cubical_complex.pyx
@@ -282,7 +282,6 @@ cdef class PeriodicCubicalComplex:
assert self.pcohptr != NULL, "compute_persistence() must be called before persistence_intervals_in_dimension()"
piid = np.array(self.pcohptr.intervals_in_dimension(dimension))
# Workaround https://github.com/GUDHI/gudhi-devel/issues/507
- if piid.shape[0] == 0:
+ if len(piid) == 0:
return np.empty(shape = [0, 2])
- else:
- return piid
+ return piid
diff --git a/src/python/gudhi/simplex_tree.pyx b/src/python/gudhi/simplex_tree.pyx
index e9bac036..c3720936 100644
--- a/src/python/gudhi/simplex_tree.pyx
+++ b/src/python/gudhi/simplex_tree.pyx
@@ -543,10 +543,9 @@ cdef class SimplexTree:
assert self.pcohptr != NULL, "compute_persistence() must be called before persistence_intervals_in_dimension()"
piid = np.array(self.pcohptr.intervals_in_dimension(dimension))
# Workaround https://github.com/GUDHI/gudhi-devel/issues/507
- if piid.shape[0] == 0:
+ if len(piid) == 0:
return np.empty(shape = [0, 2])
- else:
- return piid
+ return piid
def persistence_pairs(self):
"""This function returns a list of persistence birth and death simplices pairs.