compute_norm#
- movement.utils.vector.compute_norm(data)[source]#
Compute the norm of the vectors along the spatial dimension.
The norm of a vector is its magnitude, also called Euclidean norm, 2-norm or Euclidean length. Note that if the input data is expressed in polar coordinates, the magnitude of a vector is the same as its radial coordinate
rho
.- Parameters:
data (xarray.DataArray) – The input data array containing either
space
orspace_pol
as a dimension.- Returns:
A data array holding the norm of the input vectors. Note that this output array has no spatial dimension but preserves all other dimensions of the input data array (see Notes).
- Return type:
Notes
If the input data array is a
position
array, this function will compute the magnitude of the position vectors, for every individual and keypoint, at every timestep. If the input data array is ashape
array of a bounding boxes dataset, it will compute the magnitude of the shape vectors (i.e., the diagonal of the bounding box), for every individual and at every timestep.