pymovements.gaze.transforms_numpy.norm#
- pymovements.gaze.transforms_numpy.norm(arr: np.ndarray, axis: int | None = None) np.ndarray | Any #
Take the norm of an array.
The norm is defined by \(\sqrt{x^2 + y^2}\) with \(x\) being the yaw component and \(y\) being the pitch component of a coordinate.
- Parameters:
arr (np.ndarray) – Input velocity sequence.
axis (int | None) – Set axis to take norm. If None it is inferred from arr.shape. (default: None)
- Returns:
Norm of input array.
- Return type:
np.ndarray | Any
- 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])