def test_rotation(self): self.Rx, self.Ry = utility.get_rotation_matrix(['x', 'y']) self.Rz = utility.get_rotation_matrix('z') A = num.array([1, 0, 0]) B = num.array([0, 1, 0]) C = num.array([0, 0, 1]) num.testing.assert_allclose(self.Rz(90).dot(A), B, rtol=0., atol=1e-6) num.testing.assert_allclose(self.Rx(90).dot(B), C, rtol=0., atol=1e-6) num.testing.assert_allclose(self.Ry(90).dot(C), A, rtol=0., atol=1e-6)
def __init__(self, **kwargs): n = 1000 self._beta_mapping = num.linspace(0, pi, n) self._u_mapping = \ (3. / 4. * self._beta_mapping) - \ (1. / 2. * num.sin(2. * self._beta_mapping)) + \ (1. / 16. * num.sin(4. * self._beta_mapping)) self.lambda_factor_matrix = num.array( [[sqrt3, -1., sqrt2], [0., 2., sqrt2], [-sqrt3, -1., sqrt2]], dtype='float64') self.R = get_rotation_matrix() self.roty_pi4 = self.R['y'](-pi4) self.rotx_pi = self.R['x'](pi) self._lune_lambda_matrix = num.zeros((3, 3), dtype='float64') Source.__init__(self, **kwargs)
def __setstate__(self, state): self.__dict__.update(state) self.R = get_rotation_matrix()