Fixed to find dimension of selector output
This commit is contained in:
parent
5fdc9c8698
commit
87ffa1e67e
@ -22,7 +22,7 @@ def log_indices(first: int, last: int, num: int = 100) -> np.ndarray:
|
|||||||
def shifted_correlation(
|
def shifted_correlation(
|
||||||
function: Callable,
|
function: Callable,
|
||||||
frames: Coordinates,
|
frames: Coordinates,
|
||||||
selector: ArrayLike = None,
|
selector: Optional[Callable] = None,
|
||||||
segments: int = 10,
|
segments: int = 10,
|
||||||
skip: float = 0.1,
|
skip: float = 0.1,
|
||||||
window: float = 0.5,
|
window: float = 0.5,
|
||||||
@ -102,7 +102,12 @@ def shifted_correlation(
|
|||||||
if len(index) == 0:
|
if len(index) == 0:
|
||||||
return np.zeros(len(shifted_idx))
|
return np.zeros(len(shifted_idx))
|
||||||
|
|
||||||
elif isinstance(index[0], int) or isinstance(index[0], bool):
|
elif (
|
||||||
|
isinstance(index[0], int)
|
||||||
|
or isinstance(index[0], bool)
|
||||||
|
or isinstance(index[0], np.integer)
|
||||||
|
or isinstance(index[0], np.bool_)
|
||||||
|
):
|
||||||
return get_correlation(frames, start_frame, index, shifted_idx)
|
return get_correlation(frames, start_frame, index, shifted_idx)
|
||||||
else:
|
else:
|
||||||
correlations = []
|
correlations = []
|
||||||
@ -110,7 +115,12 @@ def shifted_correlation(
|
|||||||
if len(ind) == 0:
|
if len(ind) == 0:
|
||||||
correlations.append(np.zeros(len(shifted_idx)))
|
correlations.append(np.zeros(len(shifted_idx)))
|
||||||
|
|
||||||
elif isinstance(ind[0], int) or isinstance(ind[0], bool):
|
elif (
|
||||||
|
isinstance(ind[0], int)
|
||||||
|
or isinstance(ind[0], bool)
|
||||||
|
or isinstance(ind[0], np.integer)
|
||||||
|
or isinstance(ind[0], np.bool_)
|
||||||
|
):
|
||||||
correlations.append(
|
correlations.append(
|
||||||
get_correlation(frames, start_frame, ind, shifted_idx)
|
get_correlation(frames, start_frame, ind, shifted_idx)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user