pymovements.transforms.cut_into_subsequences

pymovements.transforms.cut_into_subsequences(arr: ndarray, window_size: int, keep_padded: bool = True) ndarray[source]

Cut sequence into subsequences of equal length.

Parameters:
  • arr (np.ndarray) – Input sequence of shape (N, L, C).

  • window_size (int) – size of subsequences

  • keep_padded (bool) – If True, last subsequence (if not of length window_size) is kept in the output array and padded with np.nan.

Returns:

Output sequence with new window length of shape (N’, L’, C)

Return type:

np.ndarray