pymovements.gaze.transforms.norm#

pymovements.gaze.transforms.norm(arr: np.ndarray, axis: int | None = None) np.ndarray | Any[source]#

Takes the norm sqrt(x^2 + y^2).

Parameters:
  • arr (np.ndarray) – velocity sequence

  • axis (int, optional) – axis to take norm. If None it is inferred from arr.shape.

Return type:

np.ndarray

Raises:

ValueError – If no axis is given but the array dimensions are lager than 3. In that case the axis cannot be inferred.

Examples

>>> arr = np.array([[1., 1., 1., 1., 1., 1.], [1., 1., 1., 1., 1., 1.]])
>>> norm(arr=arr)
array([1.41421356, 1.41421356, 1.41421356, 1.41421356, 1.41421356,
       1.41421356])