Skip to content

Commit

Permalink
fixed a bug for bar reader
Browse files Browse the repository at this point in the history
If a column doesn't contain any bars, the software should not fail.
  • Loading branch information
Chilipp committed Jan 28, 2019
1 parent 75a148e commit 6c5eb50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion straditize/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -3450,7 +3450,10 @@ def split_too_long(val=None, fraction=None):

all_indices = []
heights = []
last_start = np.where(~isnan_or_0(arr))[0][0]
try:
last_start = np.where(~isnan_or_0(arr))[0][0]
except IndexError: # no data in here
return [], [], []
last_end = last_start
last_val = last_start_val = arr[last_end]
last_state = state = 1 #: state for increasing (1) or decreasing (-1)
Expand Down
2 changes: 1 addition & 1 deletion straditize/widgets/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1959,7 +1959,7 @@ def get_overlapping_bars(self):
for col, l in enumerate(all_indices):
for (imin, imax) in l:
for col2, l2 in enumerate(all_indices):
if col2 != col and \
if col2 != col and len(l2) and \
((l2 > imin) & (l2 < imax)).any(axis=1).sum() >= 2:
ret[col].append([imin, imax])
break
Expand Down

0 comments on commit 6c5eb50

Please sign in to comment.