deepof.utils.align_trajectories

deepof.utils.align_trajectories(data: array, mode: str = 'all', run_numba: bool = False) array

Remove rotational variance on the trajectories.

Returns a numpy.array with the positions rotated in a way that the center (0 vector), and body part in the first column of data are aligned with the y-axis.

Parameters:
  • data (numpy.ndarray) – 3D array containing positions of body parts over time, where shape is N (sliding window instances) * m (sliding window size) * l (features)

  • mode (string) – Specifies if all instances of each sliding window get aligned, or only the center

  • run_numba (bool) – Determines if numba versions of functions should be used (run faster but require initial compilation time on first run)

Returns:

2D aligned positions over time.

Return type:

aligned_trajs (np.ndarray)