psychopy.tools.mathtools.
quatMagnitude
(q, squared=False, out=None, dtype=None)[source]¶Get the magnitude of a quaternion.
A quaternion is normalized if its magnitude is 1.
q (array_like) – Quaternion(s) in form [x, y, z, w] where w is real and x, y, z are imaginary components.
squared (bool, optional) – If True
return the squared magnitude. If you are just checking if a
quaternion is normalized, the squared magnitude will suffice to avoid
the square root operation.
out (ndarray, optional) – Optional output array. Must be same shape and dtype as the expected output if out was not specified.
dtype (dtype or str, optional) – Data type for computations can either be ‘float32’ or ‘float64’. If out is specified, the data type of out is used and this argument is ignored. If out is not provided, ‘float64’ is used by default.
Magnitude of quaternion q.
float or ndarray