Selector now also works correctly on lists.
This commit is contained in:
parent
7dd2074ee5
commit
0870a94b44
@ -99,20 +99,18 @@ def shifted_correlation(
|
||||
return get_correlation(frames, start_frame, index, shifted_idx)
|
||||
else:
|
||||
index = selector(frames[start_frame])
|
||||
if index.ndim == 1:
|
||||
if len(index) == 0:
|
||||
return np.zeros(len(idx))
|
||||
|
||||
if isinstance(index[0], int) or isinstance(index[0], bool):
|
||||
return get_correlation(frames, start_frame, index, shifted_idx)
|
||||
elif index.ndim == 2:
|
||||
else:
|
||||
correlations = []
|
||||
for ind in index:
|
||||
correlations.append(
|
||||
get_correlation(frames, start_frame, ind, shifted_idx)
|
||||
)
|
||||
return correlations
|
||||
else:
|
||||
raise ValueError(
|
||||
f"Index list of selector has {index.ndim} dimensions, "
|
||||
"but should have 1 or 2"
|
||||
)
|
||||
|
||||
if 1 - skip < window:
|
||||
window = 1 - skip
|
||||
|
Loading…
Reference in New Issue
Block a user