compute_head_direction_vector#
- movement.kinematics.compute_head_direction_vector(data, left_keypoint, right_keypoint, camera_view='top_down')[source]#
Compute the 2D head direction vector given two keypoints on the head.
This function is an alias for
compute_forward_vector()
. For more detailed information on how the head direction vector is computed, please refer to the documentation for that function.- Parameters:
data (xarray.DataArray) – The input data representing position. This must contain the two chosen keypoints corresponding to the left and right of the head.
left_keypoint (str) – Name of the left keypoint, e.g., “left_ear”
right_keypoint (str) – Name of the right keypoint, e.g., “right_ear”
camera_view (Literal["top_down", "bottom_up"], optional) – The camera viewing angle, used to determine the upwards direction of the animal. Can be either
"top_down"
(where the upwards direction is [0, 0, -1]), or"bottom_up"
(where the upwards direction is [0, 0, 1]). If left unspecified, the camera view is assumed to be"top_down"
.
- Returns:
An xarray DataArray representing the head direction vector, with dimensions matching the input data array, but without the
keypoints
dimension.- Return type: