wormpose.pose.eigenworms

Utility functions to deal with eigenworms

wormpose.pose.eigenworms.load_eigenworms_matrix(eigenworms_matrix_path: str) numpy.ndarray[source]

Load eigenworms matrix into numpy array from csv file

Parameters

eigenworms_matrix_path – path of the csv file

Returns

numpy array of the eigenworms matrix

wormpose.pose.eigenworms.modes_to_theta(modes: numpy.ndarray, eigenworms_matrix: numpy.ndarray) numpy.ndarray[source]

Convert modes to angles with an eigenworms matrix

Parameters
  • modes

  • eigenworms_matrix

Returns

the angles corresponding to the modes

wormpose.pose.eigenworms.theta_to_modes(theta: numpy.ndarray, eigenworms_matrix: numpy.ndarray) numpy.ndarray[source]

Convert angles to modes with an eigenworms matrix. We subtract the mean angle before converting.

Parameters
  • theta – angle vector, numpy array of shape (N,)

  • eigenworms_matrix

Returns

the modes corresponding to the angles