Skip to content

Commit

Permalink
Limited try/except block
Browse files Browse the repository at this point in the history
  • Loading branch information
liebharc committed Jan 5, 2024
1 parent 267b35e commit df9981c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions oemer/rhythm_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,18 @@ def scan_dot(
# touch the nearby note.
try:
cur_scan_line = note_id_map[int(start_y):int(bbox[3]), int(right_bound)]
ids = set(np.unique(cur_scan_line))
if -1 in ids:
ids.remove(-1)
if len(ids) > 0:
break
right_bound += 1
if right_bound >= bbox[2] + unit_size:
break
except IndexError as e:
print(e)
break

ids = set(np.unique(cur_scan_line))
if -1 in ids:
ids.remove(-1)
if len(ids) > 0:
break
right_bound += 1
if right_bound >= bbox[2] + unit_size:
break

left_bound = bbox[2] + round(unit_size*0.4)
dot_region = symbols[int(start_y):int(bbox[3]), int(left_bound):int(right_bound)]
Expand Down

0 comments on commit df9981c

Please sign in to comment.