Skip to content

Commit 2bbe609

Browse files
Jakub Sliacanjsliacan
Jakub Sliacan
authored andcommitted
Update split & strip correction function
Let the smallest event be 3 readings long (instead of 4 previously). Also, if the event is at index 0 (adjacent to a button press) then never consider it too short. It probably just overlaps with the press.
1 parent 9fac0fc commit 2bbe609

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/modularity.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ def dispersion_score(L):
138138

139139
def strip_and_split(part, lat_dists, threshold):
140140
"""
141+
If the part consists of multiple "events" (has a few horizontal parts with too much time separation)
142+
then split the part into subparts. However, ignore subparts that are too small (<4 in length). Except if
143+
it's the first part on the very left of the interval (contains index 0). Then keep that - it might correspond
144+
to an event that overlaps with the button press.
145+
141146
INPUT:
142147
part - a list representing a part in a partition of vertices (indices corresponding to values in lat_dists
143148
lat_dists - a list of lateral distances associated with a certain button press
@@ -167,13 +172,13 @@ def strip_and_split(part, lat_dists, threshold):
167172
subparts.append(sp)
168173
sp = []
169174

170-
# discard subparts of length 4 or less
175+
# discard subparts of length 3 or less, unless at the beginning (overlap with press)
171176
no_tiny_subparts = []
172177
for sp in subparts:
173-
if len(sp) > 4:
178+
if sp[0] == 0:
179+
no_tiny_subparts.append(sp)
180+
continue
181+
if len(sp) > 3:
174182
no_tiny_subparts.append(sp)
175183

176-
# print("orig. part:", part)
177-
# print("subparts :", subparts)
178-
# print("no_tiny :", no_tiny_subparts)
179184
return no_tiny_subparts

0 commit comments

Comments
 (0)