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)
|
return get_correlation(frames, start_frame, index, shifted_idx)
|
||||||
else:
|
else:
|
||||||
index = selector(frames[start_frame])
|
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)
|
return get_correlation(frames, start_frame, index, shifted_idx)
|
||||||
elif index.ndim == 2:
|
else:
|
||||||
correlations = []
|
correlations = []
|
||||||
for ind in index:
|
for ind in index:
|
||||||
correlations.append(
|
correlations.append(
|
||||||
get_correlation(frames, start_frame, ind, shifted_idx)
|
get_correlation(frames, start_frame, ind, shifted_idx)
|
||||||
)
|
)
|
||||||
return correlations
|
return correlations
|
||||||
else:
|
|
||||||
raise ValueError(
|
|
||||||
f"Index list of selector has {index.ndim} dimensions, "
|
|
||||||
"but should have 1 or 2"
|
|
||||||
)
|
|
||||||
|
|
||||||
if 1 - skip < window:
|
if 1 - skip < window:
|
||||||
window = 1 - skip
|
window = 1 - skip
|
||||||
|
Loading…
Reference in New Issue
Block a user