compute_displacement#

movement.analysis.kinematics.compute_displacement(data)[source]#

Compute displacement array in cartesian coordinates.

The displacement array is defined as the difference between the position array at time point t and the position array at time point t-1.

As a result, for a given individual and keypoint, the displacement vector at time point t, is the vector pointing from the previous (t-1) to the current (t) position, in cartesian coordinates.

Parameters:

data (xarray.DataArray) – The input data array containing position vectors in cartesian coordinates, with time as a dimension.

Returns:

An xarray DataArray containing displacement vectors in cartesian coordinates.

Return type:

xarray.DataArray

Notes

For the position array of a poses dataset, the displacement array will hold the displacement vectors for every keypoint and every individual.

For the position array of a bboxes dataset, the displacement array will hold the displacement vectors for the centroid of every individual bounding box.

For the shape array of a bboxes dataset, the displacement array will hold vectors with the change in width and height per bounding box, between consecutive time points.