diff --git a/src/mdevaluate/correlation.py b/src/mdevaluate/correlation.py index d78c43a..786f57b 100644 --- a/src/mdevaluate/correlation.py +++ b/src/mdevaluate/correlation.py @@ -100,16 +100,25 @@ def shifted_correlation( else: index = selector(frames[start_frame]) 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) else: correlations = [] for ind in index: - correlations.append( - get_correlation(frames, start_frame, ind, shifted_idx) - ) + if len(ind) == 0: + 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 if 1 - skip < window: