Selector now checks for to many dimensions.

This commit is contained in:
Sebastian Kloth 2024-01-09 13:46:46 +01:00
parent 0870a94b44
commit a559f72221

View File

@ -100,16 +100,25 @@ def shifted_correlation(
else: else:
index = selector(frames[start_frame]) index = selector(frames[start_frame])
if len(index) == 0: if len(index) == 0:
return np.zeros(len(idx)) return np.zeros(len(shifted_idx))
if isinstance(index[0], int) or isinstance(index[0], bool): elif isinstance(index[0], int) or isinstance(index[0], bool):
return get_correlation(frames, start_frame, index, shifted_idx) return get_correlation(frames, start_frame, index, shifted_idx)
else: else:
correlations = [] correlations = []
for ind in index: for ind in index:
correlations.append( if len(ind) == 0:
get_correlation(frames, start_frame, ind, shifted_idx) correlations.append(np.zeros(len(shifted_idx)))
)
elif isinstance(ind[0], int) or isinstance(ind[0], bool):
correlations.append(
get_correlation(frames, start_frame, ind, shifted_idx)
)
else:
raise ValueError(
"selector has more than two dimensions or does not "
"contain int or bool types"
)
return correlations return correlations
if 1 - skip < window: if 1 - skip < window: