numba_quaternion package¶
- class numba_quaternion.Quaternion(array_complex: 'np.ndarray[np.complexfloating]')[source]¶
Bases:
object- property abs: ndarray[floating]¶
- array_complex: ndarray[complexfloating]¶
- property azimuthal_equidistant_projection_polar_with_orientation: ndarray[floating][source]¶
Convert from detector pointing to Azimuthal equidistant projection in polar coordinate with orientation.
Returned array is in radian, has the last dimension with 3 elements, 1st as the angular distance to North pole, 2nd as the azimuth, 3rd as the orientation in angle.
- property azimuthal_equidistant_projection_with_orientation: ndarray[floating][source]¶
Convert from detector pointing to Azimuthal equidistant projection in cartesian coordinate with orientation.
Returned array is in radian, has the last dimension with 3 elements, 1st as the horizontal angular position, 2nd as the vertical angular position, 3rd as the orientation in angle.
- property conjugate: Quaternion¶
- classmethod from_array(array: ndarray[floating]) Quaternion[source]¶
Create Quaternion from real array with last axis as w, x, y, z.
- classmethod from_azimuthal_equidistant_projection_polar_with_orientation(array: ndarray[floating]) Quaternion[source]¶
- classmethod from_lastcol_array(array: ndarray[floating]) Quaternion[source]¶
Create Quaternion from real array with last axis as x, y, z, w.
Convention used in TOAST.
- classmethod from_rotation_matrix(array: ndarray[floating]) Quaternion[source]¶
- property inverse: Quaternion¶
- property norm: ndarray[floating]¶
- property normalize: Quaternion¶
- rotate(other: Quaternion) Quaternion[source]¶
- numba_quaternion.azimuthal_equidistant_projection_polar_with_orientation_to_rotation_matrix(array: ndarray[floating]) ndarray[floating][source]¶
Convert Azimuthal equidistant projection in polar coordinate with orientation to detector pointing.
Input array is in radian, has the last dimension with 3 elements, 1st as the angular distance to North pole, 2nd as the azimuth, 3rd as the orientation in angle.
- numba_quaternion.canonical_quat_to_lastcol(quat: ndarray[floating]) ndarray[floating][source]¶
Convert from real-part-in-first-column to real-part-in-last-column
- numba_quaternion.complex_to_float(array: ndarray[complexfloating]) ndarray[floating][source]¶
View a complex array as real, splitting each element into 2 in the last axis.
- numba_quaternion.dist_spherical(p: ndarray[complexfloating], q: ndarray[complexfloating]) float[source]¶
Great circle distance between 2 detector quaternions.
- numba_quaternion.dist_spherical_pairwise(ps: ndarray[complexfloating]) ndarray[floating][source]¶
Pair-wise great circle distances between detector quaternions.
Assume input is a 1-dim array of quarternions (2d-array) and return pairwise distance in 1d-array, ordered in “row-major” and “j>i” directions. E.g. for 3 detectors, [(0, 1), (0, 2), (1, 2)] ordering.
- numba_quaternion.dist_spherical_pairwise_from_lastcol_array(ps: ndarray[floating]) ndarray[floating][source]¶
- numba_quaternion.float_to_complex(array: ndarray[floating]) ndarray[complexfloating][source]¶
View a real array as complex, pairing adjacent elements in the last axis.
- numba_quaternion.lastcol_quat_to_canonical(quat: ndarray[floating]) ndarray[floating][source]¶
Convert from real-part-in-last-column to real-part-in-first-column
- numba_quaternion.matmul(p: ndarray[complexfloating], q: ndarray[complexfloating]) ndarray[complexfloating][source]¶
Perform quarternion matrix multiplication using complex matrix multiplication
- numba_quaternion.mul(p: ndarray[complexfloating], q: ndarray[complexfloating]) ndarray[complexfloating][source]¶
Perform quarternion multiplication using complex multiplication
- numba_quaternion.quat_to_azimuthal_equidistant_projection_polar_with_orientation(quats: ndarray[complexfloating]) ndarray[floating][source]¶
Convert from detector pointing to Azimuthal equidistant projection in polar coordinate with orientation.
Returned array is in radian, has the last dimension with 3 elements, 1st as the angular distance to North pole, 2nd as the azimuth, 3rd as the orientation in angle.
- numba_quaternion.quat_to_azimuthal_equidistant_projection_with_orientation(quats: ndarray[complexfloating]) ndarray[floating][source]¶
Convert from detector pointing to Azimuthal equidistant projection in cartesian coordinate with orientation.
Returned array is in radian, has the last dimension with 3 elements, 1st as the horizontal angular position, 2nd as the vertical angular position, 3rd as the orientation in angle.
- numba_quaternion.quat_to_rotation_matrix(quats: ndarray[complexfloating]) ndarray[floating][source]¶
Convert quaternion to rotation matrix.
- numba_quaternion.rotate(p: ndarray[complexfloating], v: ndarray[complexfloating]) ndarray[complexfloating][source]¶
Rotate v by p respecting Numpy broadcasting rule.
- numba_quaternion.rotate_2d(p: ndarray[complexfloating], v: ndarray[complexfloating]) list[ndarray[complexfloating]][source]¶
Rotate each row of v by p and stack at an axis.
- Parameters:
v – 2d-array
- numba_quaternion.rotation_matrix_to_quat(m: ndarray[floating]) ndarray[complexfloating][source]¶
Convert rotation matrix to quaternion.
See https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion