Skip to content

Commit 32add74

Browse files
committed
Add an example trace for true_consecutive_counts
1 parent b2d987f commit 32add74

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

micall/utils/overlap_stitcher.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ def consecutive_true_counts(arr: np.ndarray) -> np.ndarray:
9797
m = np.maximum.accumulate(z) # running max of that
9898
return c - m
9999

100+
"""
101+
Example trace:
102+
103+
arr = [0, 1, 1, 1, 0, 1, 1, 0]
104+
c = [0, 1, 2, 3, 3, 4, 5, 5] # running count of 1s
105+
z = [0, 0, 0, 0, 3, 0, 0, 5] # counts at zeros
106+
m = [0, 0, 0, 0, 3, 3, 3, 5] # running max of that
107+
c - m = [0, 1, 2, 3, 0, 1, 2, 0]
108+
109+
"""
110+
100111

101112
def exp_accumulate_array_positive(array: np.ndarray) -> np.ndarray:
102113
forward = consecutive_true_counts(array)

0 commit comments

Comments
 (0)