def test_torotmat(self): """Rotmat test from Quaternion""" np.testing.assert_array_almost_equal(qarray.to_rotmat(self.qeasy[0]), np.array([[ 8.00000000e-01, -2.77555756e-17, 6.00000000e-01], [ 3.60000000e-01, 8.00000000e-01, -4.80000000e-01], [ -4.80000000e-01, 6.00000000e-01, 6.40000000e-01]]) )
def angles2siam(theta, phi, psi): mat_spin2boresight=qarray.rotation([0,1,0], np.pi/2-SPIN2BORESIGHT) mat_theta_phi = qarray.rotation([-math.sin(phi),math.cos(phi),0], theta) mat_psi = qarray.rotation([0,0,1], psi) # detector points to X axis total = qarray.mult(mat_spin2boresight, qarray.mult(mat_theta_phi, mat_psi)) # siam is defined as pointing to Z axis return np.dot(qarray.to_rotmat(total[0]), np.array([[0,0,1],[0,1,0],[1,0,0]]))
def test_fromrotmat(self): np.testing.assert_array_almost_equal( self.qeasy[0], qarray.from_rotmat(qarray.to_rotmat(self.qeasy[0])) )