def test_null4(self): (theta, comp) = dcs.quat_angle_diff(self.null_quat, self.quat1) self.assertEqual(theta, None) for i in range(3): self.assertEqual(comp[i], None)
def test_zero_diff3(self): (theta, comp) = dcs.quat_angle_diff(np.column_stack((self.quat1, self.quat1)), self.quat1) np.testing.assert_array_almost_equal(theta, 0) np.testing.assert_array_almost_equal(comp, 0)
def test_zero_diff4(self): temp = np.column_stack( (self.quat1, self.dq1, self.dq2, self.dqq1, self.dqq2)) (theta, comp) = dcs.quat_angle_diff(temp, temp) np.testing.assert_array_almost_equal(theta, 0) np.testing.assert_array_almost_equal(comp, 0)
def test_array3(self): (theta, comp) = dcs.quat_angle_diff(np.column_stack((self.quat1, self.quat1, self.dqq1, self.dqq2)), \ np.column_stack((self.dqq1, self.dqq2, self.quat1, self.quat1))) np.testing.assert_array_almost_equal(theta, self.theta[[0, 1, 0, 1]]) np.testing.assert_array_almost_equal( comp, self.comp[:, [0, 1, 0, 1]] * np.array([1, 1, -1, -1]))
def test_zero_diff1(self): (theta, comp) = dcs.quat_angle_diff(self.quat1, self.quat1) np.testing.assert_array_almost_equal(theta, 0) np.testing.assert_array_almost_equal(comp, 0)
def test_nominal2(self): (theta, comp) = dcs.quat_angle_diff(self.quat1, self.dqq2) np.testing.assert_array_almost_equal(theta, self.theta[1]) np.testing.assert_array_almost_equal(comp, self.comp[:, 1])
def test_array2(self): (theta, comp) = dcs.quat_angle_diff(self.quat1, np.column_stack((self.dqq1, self.dqq2))) np.testing.assert_array_almost_equal(theta, self.theta) np.testing.assert_array_almost_equal(comp, self.comp)
def test_zero_diff4(self): temp = np.column_stack((self.quat1, self.dq1, self.dq2, self.dqq1, self.dqq2)) (theta, comp) = dcs.quat_angle_diff(temp, temp) np.testing.assert_array_almost_equal(theta, 0) np.testing.assert_array_almost_equal(comp, 0)
def test_array3(self): (theta, comp) = dcs.quat_angle_diff(np.column_stack((self.quat1, self.quat1, self.dqq1, self.dqq2)), \ np.column_stack((self.dqq1, self.dqq2, self.quat1, self.quat1))) np.testing.assert_array_almost_equal(theta, self.theta[[0, 1, 0, 1]]) np.testing.assert_array_almost_equal(comp, self.comp[:,[0, 1, 0, 1]] * np.array([1, 1, -1, -1]))