compute_angular_acceleration#

movement.kinematics.compute_angular_acceleration(data, window=None, in_degrees=False)[source]#

Compute the angular acceleration of a 2D orientation.

The orientation is given as 2D vectors, e.g. the output of compute_forward_vector().

Parameters:
  • data (DataArray) – The input orientation vectors, containing time and space as dimensions. space must have exactly the coordinates ["x", "y"]. The vectors need not be of unit length.

  • window (int | None) – If None (default), the angular acceleration is computed by differentiating the central-difference angular velocity. Otherwise, the size of the centred rolling window, representing the fixed number of observations to which a least-squares quadratic is fitted; the angular acceleration is its second derivative. Must be an odd integer greater than 2, and requires a uniformly sampled time coordinate.

  • in_degrees (bool) – If False (default), the output is in radians per unit of time squared. If True, it is in degrees per unit of time squared.

Returns:

The angular acceleration, with the dimensions of the input, without space. The unit of time is that of the time coordinate (seconds or frames).

Return type:

DataArray

See also

compute_angular_time_derivative

The underlying function used.

compute_angular_velocity

The first time-derivative of orientation.

Examples

>>> from movement.kinematics import (
...     compute_angular_acceleration,
...     compute_forward_vector,
... )
>>> head_vector = compute_forward_vector(
...     ds.position, "left_ear", "right_ear"
... )

Least-squares estimate over the 9 observations centred on each time point, in degrees per unit of time squared:

>>> aha = compute_angular_acceleration(
...     head_vector, window=9, in_degrees=True
... )

Examples using compute_angular_acceleration#

Compute angular velocity and acceleration

Compute angular velocity and acceleration