def test_right_handed(self): x = np.array([1, 0, 0]) y = np.array([0, 1, 0]) z = np.array([0, 0, 1]) self.assertTrue(np.allclose(su.rotate_about_axis(x, z, LAL_PI / 2), y)) self.assertTrue(np.allclose(su.rotate_about_axis(y, x, LAL_PI / 2), z)) self.assertTrue(np.allclose(su.rotate_about_axis(z, y, LAL_PI / 2), x))
def test_norm(self): for i in xrange(n_tests): x = random_unit_xyz() phi = random.uniform(0, LAL_TWOPI) axis = random_unit_xyz() self.assertAlmostEqual(norm(su.rotate_about_axis(x, axis, phi)), 1)
def test_identity(self): # spinning a vector about itself should always return the original for i in xrange(n_tests): x = random_unit_xyz() phi = random.uniform(0, LAL_TWOPI) self.assertTrue(np.allclose(x, su.rotate_about_axis(x, x, phi)))