Skip to content

Commit 76110b7

Browse files
authored
Update persistent_entropy.py
1 parent e807816 commit 76110b7

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

persim/persistent_entropy.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,11 @@ def persistent_entropy(
7373
ps = []
7474
for dgm in dgms:
7575
l = dgm[:, 1] - dgm[:, 0]
76-
if all(l>0):
77-
L = np.sum(l)
78-
p = l / L
79-
E = -np.sum(p * np.log(p))
80-
if normalize == True:
81-
E = E / np.log(len(l))
82-
ps.append(E)
83-
else:
84-
raise Exception("A bar is born after dying")
76+
L = np.sum(l)
77+
p = l / L
78+
E = -np.sum(p * np.log(p))
79+
if normalize == True:
80+
E = E / np.log(len(l))
81+
ps.append(E)
8582

8683
return np.array(ps)

0 commit comments

Comments
 (0)