diff --git a/navipy/database/__init__.py b/navipy/database/__init__.py index ce50392ea5b53c09278410c6562e9e8af6ee3cd2..36970e8f1d7311dea414135e06e0b59a5bfee3dc 100644 --- a/navipy/database/__init__.py +++ b/navipy/database/__init__.py @@ -267,7 +267,7 @@ class DataBase(): [convention][alpha_1] [convention][alpha_2] **where convention can be: - rxyz, rxzy, ryxz, ryzx, rzyx, rzxy + xyz, xzy, yxz, yzx, zyx, zxy *in case of quaternions the index should be ['location']['x'] ['location']['y'] @@ -297,7 +297,7 @@ class DataBase(): else: msg = 'Old database without convention column' self._logger.warnings(msg) - convention = 'rxyz' + convention = 'xyz' if (convention in mconst._AXES2TUPLE.keys()) or \ convention == 'quaternion': found_convention = True @@ -528,7 +528,7 @@ class DataBase(): self._logger.warning("you are loading a database with old\ conventions, it will be transformed\ automatically into the new one") - self.__convention = 'rxyz' + self.__convention = 'xyz' return self.__convention @property @@ -597,8 +597,8 @@ class DataBase(): convention = toreturn.rotconv_id if convention != 'quaternion': tuples = [('location', 'x'), ('location', 'y'), - ('location', 'z'), ('rxyz', 'alpha_0'), - ('rxyz', 'alpha_1'), ('rxyz', 'alpha_2')] + ('location', 'z'), ('xyz', 'alpha_0'), + ('xyz', 'alpha_1'), ('xyz', 'alpha_2')] index = pd.MultiIndex.from_tuples(tuples, names=['position', 'orientation']) @@ -640,7 +640,7 @@ class DataBase(): [convention][alpha_1] [convention][alpha_2] **where convention can be: - rxyz, rxzy, ryxz, ryzx, rzyx, rzxy + xyz, xzy, yxz, yzx, zyx, zxy *in case of quaternions the index should be ['location']['x'] ['location']['y'] @@ -759,7 +759,7 @@ class DataBase(): [convention][alpha_1] [convention][alpha_2] **where convention can be: - rxyz, rxzy, ryxz, ryzx, rzyx, rzxy + xyz, xzy, yxz, yzx, zyx, zxy *in case of quaternions the index should be ['location']['x'] ['location']['y'] diff --git a/navipy/database/test.py b/navipy/database/test.py index 973f4c747a9deabb329c4101e16b657c1972c7e6..ed7763a2b0019bea7d0d75e2e7f4e4e59906264d 100644 --- a/navipy/database/test.py +++ b/navipy/database/test.py @@ -105,8 +105,8 @@ class TestCase(unittest.TestCase): # convention = rows[1] tuples = [('location', 'x'), ('location', 'y'), - ('location', 'z'), ('rxyz', 'alpha_0'), - ('rxyz', 'alpha_1'), ('rxyz', 'alpha_2')] + ('location', 'z'), ('xyz', 'alpha_0'), + ('xyz', 'alpha_1'), ('xyz', 'alpha_2')] index = pd.MultiIndex.from_tuples(tuples, names=['position', 'orientation']) @@ -114,34 +114,34 @@ class TestCase(unittest.TestCase): posorient['location']['x'] = rows[6] posorient['location']['y'] = rows[7] posorient['location']['z'] = rows[8] - posorient['rxyz']['alpha_0'] = rows[3] - posorient['rxyz']['alpha_1'] = rows[5] - posorient['rxyz']['alpha_2'] = rows[4] + posorient['xyz']['alpha_0'] = rows[3] + posorient['xyz']['alpha_1'] = rows[5] + posorient['xyz']['alpha_2'] = rows[4] posid = self.mydb.get_posid(posorient) assert posid == 1 # incorrect case missing column tuples = [('location', 'y'), - ('location', 'z'), ('rxyz', 'alpha_0'), - ('rxyz', 'alpha_1'), ('rxyz', 'alpha_2')] + ('location', 'z'), ('xyz', 'alpha_0'), + ('xyz', 'alpha_1'), ('xyz', 'alpha_2')] index = pd.MultiIndex.from_tuples(tuples, names=['position', 'orientation']) posorient2 = pd.Series(index=index) posorient2['location']['y'] = rows[7] posorient2['location']['z'] = rows[8] - posorient2['rxyz']['alpha_0'] = rows[3] - posorient2['rxyz']['alpha_1'] = rows[5] - posorient2['rxyz']['alpha_2'] = rows[4] + posorient2['xyz']['alpha_0'] = rows[3] + posorient2['xyz']['alpha_1'] = rows[5] + posorient2['xyz']['alpha_2'] = rows[4] with self.assertRaises(Exception): posid = self.mydb.get_posid(posorient2) # incorrect case None tuples = [('location', 'x'), ('location', 'y'), - ('location', 'z'), ('rxyz', 'alpha_0'), - ('rxyz', 'alpha_1'), ('rxyz', 'alpha_2')] + ('location', 'z'), ('xyz', 'alpha_0'), + ('xyz', 'alpha_1'), ('xyz', 'alpha_2')] index = pd.MultiIndex.from_tuples(self.tuples, names=['position', 'orientation']) @@ -149,16 +149,16 @@ class TestCase(unittest.TestCase): posorient3['location']['x'] = None posorient3['location']['y'] = rows[7] posorient3['location']['z'] = rows[8] - posorient3['rxyz']['alpha_0'] = rows[3] - posorient3['rxyz']['alpha_1'] = rows[5] - posorient3['rxyz']['alpha_2'] = rows[4] + posorient3['xyz']['alpha_0'] = rows[3] + posorient3['xyz']['alpha_1'] = rows[5] + posorient3['xyz']['alpha_2'] = rows[4] with self.assertRaises(ValueError): posid = self.mydb.get_posid(posorient2) # incorrect case nan tuples = [('location', 'x'), ('location', 'y'), - ('location', 'z'), ('rxyz', 'alpha_0'), - ('rxyz', 'alpha_1'), ('rxyz', 'alpha_2')] + ('location', 'z'), ('xyz', 'alpha_0'), + ('xyz', 'alpha_1'), ('xyz', 'alpha_2')] index = pd.MultiIndex.from_tuples(self.tuples, names=['position', 'orientation']) @@ -166,9 +166,9 @@ class TestCase(unittest.TestCase): posorient2['location']['x'] = np.nan posorient2['location']['y'] = rows[7] posorient2['location']['z'] = rows[8] - posorient2['rxyz']['alpha_0'] = rows[3] - posorient2['rxyz']['alpha_1'] = rows[5] - posorient2['rxyz']['alpha_2'] = rows[4] + posorient2['xyz']['alpha_0'] = rows[3] + posorient2['xyz']['alpha_1'] = rows[5] + posorient2['xyz']['alpha_2'] = rows[4] with self.assertRaises(ValueError): posid = self.mydb.get_posid(posorient2) @@ -177,16 +177,16 @@ class TestCase(unittest.TestCase): posorient2['location']['x'] = rows[6] posorient2['location']['y'] = rows[7] posorient2['location']['z'] = rows[8] - posorient2['rxyz']['alpha_0'] = rows[3] - posorient2['rxyz']['alpha_1'] = rows[5] - posorient2['rxyz']['alpha_2'] = rows[4] + posorient2['xyz']['alpha_0'] = rows[3] + posorient2['xyz']['alpha_1'] = rows[5] + posorient2['xyz']['alpha_2'] = rows[4] with self.assertRaises(TypeError): self.mydb.get_posid(posorient2) # not working case empty tuples = [('location', 'x'), ('location', 'y'), - ('location', 'z'), ('rxyz', 'alpha_0'), - ('rxyz', 'alpha_1'), ('rxyz', 'alpha_2')] + ('location', 'z'), ('xyz', 'alpha_0'), + ('xyz', 'alpha_1'), ('xyz', 'alpha_2')] index = pd.MultiIndex.from_tuples(self.tuples, names=['position', 'orientation']) @@ -210,8 +210,8 @@ class TestCase(unittest.TestCase): rows = c.fetchall()[0] # working case tuples = [('location', 'x'), ('location', 'y'), - ('location', 'z'), ('rxyz', 'alpha_0'), - ('rxyz', 'alpha_1'), ('rxyz', 'alpha_2')] + ('location', 'z'), ('xyz', 'alpha_0'), + ('xyz', 'alpha_1'), ('xyz', 'alpha_2')] index = pd.MultiIndex.from_tuples(tuples, names=['position', 'orientation']) @@ -219,33 +219,33 @@ class TestCase(unittest.TestCase): posorient['location']['x'] = rows[6] posorient['location']['y'] = rows[7] posorient['location']['z'] = rows[8] - posorient['rxyz']['alpha_0'] = rows[3] - posorient['rxyz']['alpha_1'] = rows[5] - posorient['rxyz']['alpha_2'] = rows[4] + posorient['xyz']['alpha_0'] = rows[3] + posorient['xyz']['alpha_1'] = rows[5] + posorient['xyz']['alpha_2'] = rows[4] posid = self.mydb.read_posorient(posorient=posorient) # print(posid) assert posid['location']['x'] == posorient['location']['x'] # incorrect case missing column tuples = [('location', 'y'), - ('location', 'z'), ('rxyz', 'alpha_0'), - ('rxyz', 'alpha_1'), ('rxyz', 'alpha_2')] + ('location', 'z'), ('xyz', 'alpha_0'), + ('xyz', 'alpha_1'), ('xyz', 'alpha_2')] index = pd.MultiIndex.from_tuples(tuples, names=['position', 'orientation']) posorient2 = pd.Series(index=index) posorient2['location']['y'] = rows[7] posorient2['location']['z'] = rows[8] - posorient2['rxyz']['alpha_0'] = rows[3] - posorient2['rxyz']['alpha_1'] = rows[5] - posorient2['rxyz']['alpha_2'] = rows[4] + posorient2['xyz']['alpha_0'] = rows[3] + posorient2['xyz']['alpha_1'] = rows[5] + posorient2['xyz']['alpha_2'] = rows[4] with self.assertRaises(ValueError): self.mydb.read_posorient(posorient=posorient2) # incorrect case None tuples = [('location', 'x'), ('location', 'y'), - ('location', 'z'), ('rxyz', 'alpha_0'), - ('rxyz', 'alpha_1'), ('rxyz', 'alpha_2')] + ('location', 'z'), ('xyz', 'alpha_0'), + ('xyz', 'alpha_1'), ('xyz', 'alpha_2')] index = pd.MultiIndex.from_tuples(tuples, names=['position', 'orientation']) @@ -253,16 +253,16 @@ class TestCase(unittest.TestCase): posorient2['location']['x'] = None posorient2['location']['y'] = rows[7] posorient2['location']['z'] = rows[8] - posorient2['rxyz']['alpha_0'] = rows[3] - posorient2['rxyz']['alpha_1'] = rows[5] - posorient2['rxyz']['alpha_2'] = rows[4] + posorient2['xyz']['alpha_0'] = rows[3] + posorient2['xyz']['alpha_1'] = rows[5] + posorient2['xyz']['alpha_2'] = rows[4] with self.assertRaises(ValueError): self.mydb.read_posorient(posorient=posorient2) # incorrect case nan tuples = [('location', 'x'), ('location', 'y'), - ('location', 'z'), ('rxyz', 'alpha_0'), - ('rxyz', 'alpha_1'), ('rxyz', 'alpha_2')] + ('location', 'z'), ('xyz', 'alpha_0'), + ('xyz', 'alpha_1'), ('xyz', 'alpha_2')] index = pd.MultiIndex.from_tuples(tuples, names=['position', 'orientation']) @@ -270,29 +270,29 @@ class TestCase(unittest.TestCase): posorient2['location']['x'] = np.nan posorient2['location']['y'] = rows[7] posorient2['location']['z'] = rows[8] - posorient2['rxyz']['alpha_0'] = rows[3] - posorient2['rxyz']['alpha_1'] = rows[5] - posorient2['rxyz']['alpha_2'] = rows[4] + posorient2['xyz']['alpha_0'] = rows[3] + posorient2['xyz']['alpha_1'] = rows[5] + posorient2['xyz']['alpha_2'] = rows[4] with self.assertRaises(ValueError): self.mydb.read_posorient(posorient=posorient2) # incorrect case no pandas series but dict posorient2 = {} posorient2['location'] = {} - posorient2['rxyz'] = {} + posorient2['xyz'] = {} posorient2['location']['x'] = rows[6] posorient2['location']['y'] = rows[7] posorient2['location']['z'] = rows[8] - posorient2['rxyz']['alpha_0'] = rows[3] - posorient2['rxyz']['alpha_1'] = rows[5] - posorient2['rxyz']['alpha_2'] = rows[4] + posorient2['xyz']['alpha_0'] = rows[3] + posorient2['xyz']['alpha_1'] = rows[5] + posorient2['xyz']['alpha_2'] = rows[4] with self.assertRaises(TypeError): self.mydb.read_posorient(posorient=posorient2) # not working case empty tuples = [('location', 'x'), ('location', 'y'), - ('location', 'z'), ('rxyz', 'alpha_0'), - ('rxyz', 'alpha_1'), ('rxyz', 'alpha_2')] + ('location', 'z'), ('xyz', 'alpha_0'), + ('xyz', 'alpha_1'), ('xyz', 'alpha_2')] index = pd.MultiIndex.from_tuples(tuples, names=['position', 'orientation']) @@ -317,8 +317,8 @@ class TestCase(unittest.TestCase): rows = c.fetchall()[0] # working case tuples = [('location', 'x'), ('location', 'y'), - ('location', 'z'), ('rxyz', 'alpha_0'), - ('rxyz', 'alpha_1'), ('rxyz', 'alpha_2')] + ('location', 'z'), ('xyz', 'alpha_0'), + ('xyz', 'alpha_1'), ('xyz', 'alpha_2')] index = pd.MultiIndex.from_tuples(tuples, names=['position', 'orientation']) @@ -326,9 +326,9 @@ class TestCase(unittest.TestCase): posorient['location']['x'] = rows[6] posorient['location']['y'] = rows[7] posorient['location']['z'] = rows[8] - posorient['rxyz']['alpha_0'] = rows[3] - posorient['rxyz']['alpha_1'] = rows[5] - posorient['rxyz']['alpha_2'] = rows[4] + posorient['xyz']['alpha_0'] = rows[3] + posorient['xyz']['alpha_1'] = rows[5] + posorient['xyz']['alpha_2'] = rows[4] for rowid in [0, -2]: with self.assertRaises(ValueError): # print("rowid",rowid) @@ -347,12 +347,12 @@ class TestCase(unittest.TestCase): assert posoriend2['location']['x'] == posorient['location']['x'] assert posoriend2['location']['y'] == posorient['location']['y'] assert posoriend2['location']['z'] == posorient['location']['z'] - assert (posoriend2['rxyz']['alpha_0'] == - posorient['rxyz']['alpha_0']) - assert (posoriend2['rxyz']['alpha_1'] == - posorient['rxyz']['alpha_1']) - assert (posoriend2['rxyz']['alpha_2'] == - posorient['rxyz']['alpha_2']) + assert (posoriend2['xyz']['alpha_0'] == + posorient['xyz']['alpha_0']) + assert (posoriend2['xyz']['alpha_1'] == + posorient['xyz']['alpha_1']) + assert (posoriend2['xyz']['alpha_2'] == + posorient['xyz']['alpha_2']) def test_scene_id(self): """ @@ -407,17 +407,17 @@ class TestCase(unittest.TestCase): rows = c.fetchall()[0] # working case tuples = [('location', 'x'), ('location', 'y'), - ('location', 'z'), ('rxyz', 'alpha_0'), - ('rxyz', 'alpha_1'), ('rxyz', 'alpha_2')] + ('location', 'z'), ('xyz', 'alpha_0'), + ('xyz', 'alpha_1'), ('xyz', 'alpha_2')] index = pd.MultiIndex.from_tuples(tuples, names=['position', 'orientation']) posorient = pd.Series(index=index) posorient['location']['x'] = rows[6] posorient['location']['y'] = rows[7] posorient['location']['z'] = rows[8] - posorient['rxyz']['alpha_0'] = rows[3] - posorient['rxyz']['alpha_1'] = rows[5] - posorient['rxyz']['alpha_2'] = rows[4] + posorient['xyz']['alpha_0'] = rows[3] + posorient['xyz']['alpha_1'] = rows[5] + posorient['xyz']['alpha_2'] = rows[4] image = self.mydb.scene(posorient=posorient) self.assertIsNotNone(image) self.assertFalse(sum(image.shape) == 0) @@ -427,24 +427,24 @@ class TestCase(unittest.TestCase): # incorrect case missing column tuples = [('location', 'x'), ('location', 'y'), - ('location', 'z'), ('rxyz', 'alpha_0'), - ('rxyz', 'alpha_1'), ('rxyz', 'alpha_2')] + ('location', 'z'), ('xyz', 'alpha_0'), + ('xyz', 'alpha_1'), ('xyz', 'alpha_2')] index = pd.MultiIndex.from_tuples(tuples, names=['position', 'orientation']) posorient2 = pd.Series(index=index) posorient2['location']['y'] = rows[7] posorient2['location']['z'] = rows[8] - posorient2['rxyz']['alpha_0'] = rows[3] - posorient2['rxyz']['alpha_1'] = rows[5] - posorient2['rxyz']['alpha_2'] = rows[4] + posorient2['xyz']['alpha_0'] = rows[3] + posorient2['xyz']['alpha_1'] = rows[5] + posorient2['xyz']['alpha_2'] = rows[4] with self.assertRaises(Exception): image = self.mydb.scene(posorient=posorient2) # incorrect case None tuples = [('location', 'x'), ('location', 'y'), - ('location', 'z'), ('rxyz', 'alpha_0'), - ('rxyz', 'alpha_1'), ('rxyz', 'alpha_2')] + ('location', 'z'), ('xyz', 'alpha_0'), + ('xyz', 'alpha_1'), ('xyz', 'alpha_2')] index = pd.MultiIndex.from_tuples(tuples, names=['position', 'orientation']) @@ -452,16 +452,16 @@ class TestCase(unittest.TestCase): posorient2['location']['x'] = None posorient2['location']['y'] = rows[7] posorient2['location']['z'] = rows[8] - posorient2['rxyz']['alpha_0'] = rows[3] - posorient2['rxyz']['alpha_1'] = rows[5] - posorient2['rxyz']['alpha_2'] = rows[4] + posorient2['xyz']['alpha_0'] = rows[3] + posorient2['xyz']['alpha_1'] = rows[5] + posorient2['xyz']['alpha_2'] = rows[4] with self.assertRaises(ValueError): image = self.mydb.scene(posorient=posorient2) # incorrect case nan tuples = [('location', 'x'), ('location', 'y'), - ('location', 'z'), ('rxyz', 'alpha_0'), - ('rxyz', 'alpha_1'), ('rxyz', 'alpha_2')] + ('location', 'z'), ('xyz', 'alpha_0'), + ('xyz', 'alpha_1'), ('xyz', 'alpha_2')] index = pd.MultiIndex.from_tuples(tuples, names=['position', 'orientation']) @@ -469,22 +469,22 @@ class TestCase(unittest.TestCase): posorient2['location']['x'] = np.nan posorient2['location']['y'] = rows[7] posorient2['location']['z'] = rows[8] - posorient2['rxyz']['alpha_0'] = rows[3] - posorient2['rxyz']['alpha_1'] = rows[5] - posorient2['rxyz']['alpha_2'] = rows[4] + posorient2['xyz']['alpha_0'] = rows[3] + posorient2['xyz']['alpha_1'] = rows[5] + posorient2['xyz']['alpha_2'] = rows[4] with self.assertRaises(ValueError): image = self.mydb.scene(posorient=posorient2) # incorrect case no pandas series but dict posorient2 = {} posorient2['location'] = {} - posorient2['rxyz'] = {} + posorient2['xyz'] = {} posorient2['location']['x'] = rows[6] posorient2['location']['y'] = rows[7] posorient2['location']['z'] = rows[8] - posorient2['rxyz']['alpha_0'] = rows[3] - posorient2['rxyz']['alpha_1'] = rows[5] - posorient2['rxyz']['alpha_2'] = rows[4] + posorient2['xyz']['alpha_0'] = rows[3] + posorient2['xyz']['alpha_1'] = rows[5] + posorient2['xyz']['alpha_2'] = rows[4] with self.assertRaises(TypeError): image = self.mydb.scene(posorient=posorient2) diff --git a/navipy/maths/coordinates.py b/navipy/maths/coordinates.py index 6fe6826cd4afb76129096bec6c1ff08d13ee236a..2e22bb603d4affe9334a597b4f5420f3fbf08328 100644 --- a/navipy/maths/coordinates.py +++ b/navipy/maths/coordinates.py @@ -24,7 +24,7 @@ def spherical_to_cartesian(elevation, azimuth, radius=1): def cartesian_to_spherical_vectors(cart_vec, angles, - viewing_direction, axes='rzyx'): + viewing_direction, axes='zyx'): """Now we need the cartesian vector as a spherical vecotr. A vector in cartesian coordinates can be transform as one in the spherical coordinates following the transformation: diff --git a/navipy/maths/test_euler.py b/navipy/maths/test_euler.py index c1ea9666cd38028b10e2236a2b5104f39604764b..26f2506502aa68b5b46f4ddc412d678d1775283a 100644 --- a/navipy/maths/test_euler.py +++ b/navipy/maths/test_euler.py @@ -67,8 +67,8 @@ class TestEuler(unittest.TestCase): test if errors are raised correctly when parameters of wrong type etc are passed to the euler.from_quaternion function """ - for a, b, c, d in [(None, 2, 6, 'rxyz'), (9.0, 'w', 2, 'rxyz'), - (5.0, 4.0, None, 'rxyz'), + for a, b, c, d in [(None, 2, 6, 'xyz'), (9.0, 'w', 2, 'xyz'), + (5.0, 4.0, None, 'xyz'), (1.0, 2.0, 3.0, 'w')]: with self.assertRaises(ValueError): euler.from_quaternion([a, b, c, d]) @@ -95,11 +95,11 @@ class TestEuler(unittest.TestCase): of wrong type, value are passed to the euler.angle_rate_matrix function """ - for a, b, c, d in [(None, 2, 6, 'rxyz'), (5.0, 4.0, None, 'xyx')]: + for a, b, c, d in [(None, 2, 6, 'xyz'), (5.0, 4.0, None, 'xyx')]: with self.assertRaises(TypeError): euler.angle_rate_matrix(a, b, c, d) - # for a, b, c, d in [(9.0, np.nan, 2, 'rxyz')]: + # for a, b, c, d in [(9.0, np.nan, 2, 'xyz')]: # with self.assertRaises(ValueError): # euler.angle_rate_matrix(a, b, c, d) @@ -183,7 +183,7 @@ class TestEuler(unittest.TestCase): # db = 0.3 # dc = 1 - # rxyz + # xyz MR3 = np.transpose(R3(ec)) MR2 = np.transpose(R2(eb)) e1 = [1, 0, 0] @@ -195,7 +195,7 @@ class TestEuler(unittest.TestCase): M = angle_rate_matrix(ea, eb, ec, 'xyz') self.assertTrue(np.all(rotM == M)) - # ryzx + # yzx MRk = np.transpose(R1(ec)) MRj = np.transpose(R3(eb)) e1 = [1, 0, 0] @@ -207,7 +207,7 @@ class TestEuler(unittest.TestCase): M = angle_rate_matrix(ea, eb, ec, 'yzx') self.assertTrue(np.allclose(rotM, M)) - # ryxz + # yxz MRk = np.transpose(R3(ec)) MRj = np.transpose(R1(eb)) e1 = [1, 0, 0] @@ -219,7 +219,7 @@ class TestEuler(unittest.TestCase): M = angle_rate_matrix(ea, eb, ec, 'yxz') self.assertTrue(np.allclose(rotM, M)) - # rxzy + # xzy MRk = np.transpose(R2(ec)) MRj = np.transpose(R3(eb)) e1 = [1, 0, 0] @@ -231,7 +231,7 @@ class TestEuler(unittest.TestCase): M = angle_rate_matrix(ea, eb, ec, 'xzy') self.assertTrue(np.allclose(rotM, M)) - # rzxy + # zxy MRk = np.transpose(R2(ec)) MRj = np.transpose(R1(eb)) e1 = [1, 0, 0] @@ -243,7 +243,7 @@ class TestEuler(unittest.TestCase): M = angle_rate_matrix(ea, eb, ec, 'zxy') self.assertTrue(np.allclose(rotM, M)) - # rxzx + # xzx MRk = np.transpose(R1(ec)) MRj = np.transpose(R3(eb)) e1 = [1, 0, 0] @@ -255,7 +255,7 @@ class TestEuler(unittest.TestCase): M = angle_rate_matrix(ea, eb, ec, 'xzx') self.assertTrue(np.allclose(rotM, M)) - # rzxz + # zxz # c = np.cos # s = np.sin MRk = np.transpose(R3(ec)) @@ -277,7 +277,7 @@ class TestEuler(unittest.TestCase): M = angle_rate_matrix(ea, eb, ec, 'zxz') self.assertTrue(np.allclose(rotM, M)) - # rxyx + # xyx MRk = np.transpose(R1(ec)) MRj = np.transpose(R2(eb)) e1 = [1, 0, 0] @@ -289,7 +289,7 @@ class TestEuler(unittest.TestCase): M = angle_rate_matrix(ea, eb, ec, 'xyx') self.assertTrue(np.allclose(rotM, M)) - # ryxy + # yxy MRk = np.transpose(R2(ec)) MRj = np.transpose(R1(eb)) e1 = [1, 0, 0] @@ -301,7 +301,7 @@ class TestEuler(unittest.TestCase): M = angle_rate_matrix(ea, eb, ec, 'yxy') self.assertTrue(np.allclose(rotM, M)) - # ryzy + # yzy MRk = np.transpose(R2(ec)) MRj = np.transpose(R3(eb)) e1 = [1, 0, 0] @@ -313,7 +313,7 @@ class TestEuler(unittest.TestCase): M = angle_rate_matrix(ea, eb, ec, 'yzy') self.assertTrue(np.allclose(rotM, M)) - # rzyz + # zyz MRk = np.transpose(R3(ec)) MRj = np.transpose(R2(eb)) e1 = [1, 0, 0] diff --git a/navipy/maths/test_quaternion.py b/navipy/maths/test_quaternion.py index e49bbe01cb1ca25776235ed61026c97318a661aa..19a51d479c2dc34697202eaf7de7a555fa7984f2 100644 --- a/navipy/maths/test_quaternion.py +++ b/navipy/maths/test_quaternion.py @@ -18,7 +18,7 @@ class TestQuaternions(unittest.TestCase): [0.99810947, 0.06146124, 0, 0])) def test_matrix(self): - matrix = quat.matrix([0.99810947, 0.06146124, 0, 0], 'rxyz') + matrix = quat.matrix([0.99810947, 0.06146124, 0, 0], 'xyz') self.assertTrue(np.allclose(matrix, ht.rotation_matrix(0.123, [1, 0, 0]))) diff --git a/navipy/moving/agent.py b/navipy/moving/agent.py index 6632530791a02397dfa4cb2cc4f578ac3f60c444..cad764834c812a531e2f44a9f9312dab30874042 100644 --- a/navipy/moving/agent.py +++ b/navipy/moving/agent.py @@ -70,7 +70,7 @@ def velocities_columns(convention): class AbstractAgent(): - def __init__(self, convention='rzyx'): + def __init__(self, convention='zyx'): self._brain = DefaultBrain() self._alter_posorientvel = defaultcallback tuples = posorient_columns(convention) diff --git a/navipy/moving/test_agent.py b/navipy/moving/test_agent.py index 69b19b3127cca25ca0957cbc972a01bc7342b4f0..da7dd0f55fea928a5da9802dbe6ebf9c3a4593ca 100644 --- a/navipy/moving/test_agent.py +++ b/navipy/moving/test_agent.py @@ -18,7 +18,7 @@ version = float(nx.__version__) class BrainTest(Brain): def __init__(self, renderer=None): Brain.__init__(self, renderer=renderer) - convention = 'rzyx' + convention = 'zyx' tuples = [('location', 'x'), ('location', 'y'), ('location', 'z'), (convention, 'alpha_0'), (convention, 'alpha_1'), (convention, 'alpha_2')] @@ -48,7 +48,7 @@ class TestNavipyMovingAgent(unittest.TestCase): self.mydb_filename = pkg_resources.resource_filename( 'navipy', 'resources/database.db') self.mydb = navidb.DataBase(self.mydb_filename, mode='r') - self.convention = 'rzyx' + self.convention = 'zyx' self.brain = BrainTest(self.mydb) tuples = [('location', 'x'), ('location', 'y'), ('location', 'z'), (self.convention, 'alpha_0'), diff --git a/navipy/processing/test_OpticFlow.py b/navipy/processing/test_OpticFlow.py index 9ff3628149f6bc8279489465b370cd4812781384..c3b7a3be10f82c9d145f7a01d653bf36df20cf1b 100644 --- a/navipy/processing/test_OpticFlow.py +++ b/navipy/processing/test_OpticFlow.py @@ -37,7 +37,7 @@ class TestCase(unittest.TestCase): self.scene[:, :, 1, 0] = np.array(distance).copy() self.scene[:, :, 2, 0] = np.array(distance).copy() self.scene[:, :, 3, 0] = np.array(distance).copy() - self.convention = 'rxyz' + self.convention = 'xyz' tuples = [('location', 'x'), ('location', 'y'), ('location', 'z'), ('location', 'dx'), ('location', 'dy'), ('location', 'dz'), @@ -59,7 +59,7 @@ class TestCase(unittest.TestCase): def test_wrong_convention(self): """ this test checks if an error is raised - when none or a convention other than 'rxyz' + when none or a convention other than 'xyz' is used """ velocity = pd.Series(index=['x', 'y', 'z', @@ -463,15 +463,15 @@ class TestCase(unittest.TestCase): velocity['location']['x'] = x velocity['location']['y'] = y velocity['location']['z'] = z - velocity['rxyz']['alpha_0'] = yaw - velocity['rxyz']['alpha_1'] = pitch - velocity['rxyz']['alpha_2'] = roll + velocity['xyz']['alpha_0'] = yaw + velocity['xyz']['alpha_1'] = pitch + velocity['xyz']['alpha_2'] = roll velocity['location']['dx'] = dx velocity['location']['dy'] = dy velocity['location']['dz'] = dz - velocity['rxyz']['dalpha_0'] = dyaw - velocity['rxyz']['dalpha_1'] = dpitch - velocity['rxyz']['dalpha_2'] = droll + velocity['xyz']['dalpha_0'] = dyaw + velocity['xyz']['dalpha_1'] = dpitch + velocity['xyz']['dalpha_2'] = droll rof, hof, vof = mcode.optic_flow(scene, viewing_directions, velocity) @@ -731,7 +731,7 @@ class TestCase(unittest.TestCase): M3 = rotation_matrix(-ypr[0], rotatedax) scale, shear, angles, translate, perspective = - decompose_matrix(M3,'rxyz') + decompose_matrix(M3,'xyz') print("angels", angles) vec = np.transpose(np.dot(M3[:3,:3], np.transpose(vec))) print("old vec", vec) @@ -740,8 +740,8 @@ class TestCase(unittest.TestCase): angles=[ypr[0], ypr[1],ypr[2], -ypr[0], -ypr[1], -ypr[2]] #for c in ['xyz','xyx','xzy','xzx','yzx','yzy','yxz','yxy', - # 'zxy','zxz','zyx','zyz','rzyx','rxyx','ryzx','rxzx', - # 'rxzy','ryzy','rzxy','ryxy','ryxz','rzxz','rxyz','rzyz']: + # 'zxy','zxz','zyx','zyz','zyx','xyx','yzx','xzx', + # 'xzy','yzy','zxy','yxy','yxz','zxz','xyz','zyz']: for al in angles: for bl in angles: for cl in angles: @@ -749,7 +749,7 @@ class TestCase(unittest.TestCase): angles=[al, bl,cl], translate=None, perspective=None, - axes='rzyx')[:3,:3] + axes='zyx')[:3,:3] #M= np.transpose(M) vec = np.dot(np.transpose(M), vec) if (np.isclose(vec[0], oldvec[0]) or diff --git a/navipy/sensors/blendtest_renderer.py b/navipy/sensors/blendtest_renderer.py index 7554787eb82f06f5246660b3fe67480e80e8a337..8da8f3425a44926d2c8262b7312dce87da8d360b 100644 --- a/navipy/sensors/blendtest_renderer.py +++ b/navipy/sensors/blendtest_renderer.py @@ -14,7 +14,7 @@ class TestBlenderRender_renderer(unittest.TestCase): """ Prepare for the test """ - convention = 'rxyz' + convention = 'xyz' index = pd.MultiIndex.from_tuples( [('location', 'x'), ('location', 'y'), ('location', 'z'), (convention, 'alpha_0'), @@ -39,7 +39,7 @@ class TestBlenderRender_renderer(unittest.TestCase): Test if images rendered from two different conventions match \ one another """ - convention = 'ryzx' + convention = 'yzx' index = pd.MultiIndex.from_tuples( [('location', 'x'), ('location', 'y'), ('location', 'z'), (convention, 'alpha_0'), @@ -79,7 +79,7 @@ class TestBlenderRender_renderer(unittest.TestCase): y = np.linspace(-0.5, 0.5, 5) z = [3] alpha_0 = [0] - rotconv = 'rzyx' + rotconv = 'zyx' db_reffilename = pkg_resources.resource_filename( 'navipy', 'resources/database.db') db_ref = DataBase(db_reffilename, mode='r') diff --git a/navipy/sensors/blendtestyxz.py b/navipy/sensors/blendtestyxz.py index f6569d15399a890e54e878600a24d4de4bf9030d..9310c6171dc42405175268133ad68a944fab1d71 100644 --- a/navipy/sensors/blendtestyxz.py +++ b/navipy/sensors/blendtestyxz.py @@ -11,7 +11,7 @@ class TestBlenderRender_renderer(unittest.TestCase): """ Prepare for the test """ - self.conventions = ['rxyz', 'rxzy', 'ryzx', 'ryxz', 'rzxy', 'rzyx'] + self.conventions = ['xyz', 'xzy', 'yzx', 'yxz', 'zxy', 'zyx'] self.renderer = BlenderRender() def test_diff_euler_2_euler(self): diff --git a/navipy/sensors/renderer.py b/navipy/sensors/renderer.py index 8a44c6c4d13bc779b33b62291e076a2d3ce628d7..7f8b79588fd30c32d417b8b2d7a9045eb42bd0ef 100644 --- a/navipy/sensors/renderer.py +++ b/navipy/sensors/renderer.py @@ -134,7 +134,7 @@ class AbstractRender(): x, y, z, alpha_0=[0], alpha_1=[0], alpha_2=[0], q_0=None, q_1=None, q_2=None, q_3=None, - rotconv='rzyx'): + rotconv='zyx'): # Check inputs if rotconv == 'quaternion': if (q_0 is None) or \ @@ -552,7 +552,7 @@ class BlenderRender(AbstractRender): [convention][alpha_1] [convention][alpha_2] **where convention can be: - rxyz, rxzy, ryxz, ryzx, rzyx, rzxy + xyz, xzy, yxz, yzx, zyx, zxy *in case of quaternions the index should be ['location']['x'] ['location']['y'] diff --git a/navipy/trajectories/__init__.py b/navipy/trajectories/__init__.py index aff0b8d4b508eb79dc123c770a42db9527a61e1f..c1ec848fa6b327abe2df0e972d9731d22196778c 100644 --- a/navipy/trajectories/__init__.py +++ b/navipy/trajectories/__init__.py @@ -65,7 +65,7 @@ def _invmarkerstransform(index_i, trajectory, class Trajectory(pd.DataFrame): - def __init__(self, rotconv='rzyx', indeces=np.arange(1)): + def __init__(self, rotconv='zyx', indeces=np.arange(1)): columns = self.__build_columns(rotconv) super().__init__(index=indeces, columns=columns) self.__rotconv = rotconv diff --git a/navipy/trajectories/random.py b/navipy/trajectories/random.py index c6f38db630e1cfdd9d8d78c540e96427ac9bf7cc..626f05ee96e8f9da0bfda8ec43bc076ae2dcbf27 100644 --- a/navipy/trajectories/random.py +++ b/navipy/trajectories/random.py @@ -29,7 +29,7 @@ from navipy.trajectories import Trajectory def yawpitchroll(yaw, pitch, roll): - return matrix(yaw, pitch, roll, axes='rzyx')[:3, :3] + return matrix(yaw, pitch, roll, axes='zyx')[:3, :3] def generate_trajectory(starting_point, speed, yaw, pitch, roll): @@ -56,7 +56,7 @@ flying at speed (plausibly changing over time), 'speed and roll should have the same number of point' trajectory = Trajectory(indeces=np.arange(speed.shape[0]), - rotconv='rzyx') + rotconv='zyx') trajectory.loc[0, 'location'] = starting_point for i in trajectory.index[1:]: speed_orient = np.dot(yawpitchroll( diff --git a/navipy/trajectories/test_trajectory.py b/navipy/trajectories/test_trajectory.py index d8f74e83c50c088ff6ddd9b9202c17c2e7b5854a..f5f09e89b06cbeed892fd789b7f3ff85be8909c3 100644 --- a/navipy/trajectories/test_trajectory.py +++ b/navipy/trajectories/test_trajectory.py @@ -38,7 +38,7 @@ class TestTrajectoryTransform(unittest.TestCase): trajectory.loc[:, col] = trajectory.loc[:, col] / 2 # forward non_tested_euler = ['xzy', 'xzx', 'yxy', - 'rxzx', 'rxzy', 'ryxy'] + 'xzx', 'xzy', 'yxy'] print('EULER NOT TESTED!!: ', non_tested_euler) for euler_axes in list(htconst._AXES2TUPLE.keys()): trajectory.rotation_mode = euler_axes diff --git a/orientation/examples/bumblebee_thorax_orientation.py b/orientation/examples/bumblebee_thorax_orientation.py index 11c0926cdcb7416632c30f3bd80e9b4244336413..efa9fb208da602e6709a4b2415e580c98ba809c5 100644 --- a/orientation/examples/bumblebee_thorax_orientation.py +++ b/orientation/examples/bumblebee_thorax_orientation.py @@ -10,7 +10,7 @@ markers = pd.read_hdf(bumblebee_flight, 'markers') markers = markers.astype(float) markers_thorax = [0, 1, 2] -axes = 'rzyx' +axes = 'zyx' triangle_mode = 'y-axis=2-1' yawpitchroll = pd.DataFrame(index=markers.index, diff --git a/orientation/examples/two_markers.py b/orientation/examples/two_markers.py index dac6aa731c0b6e2776a4840fac4e20c5ba2e1ae1..05ccdef3bfb4ecae2e30e4f49a86dd4e261bb4cf 100644 --- a/orientation/examples/two_markers.py +++ b/orientation/examples/two_markers.py @@ -10,7 +10,7 @@ yaw_t = +3*np.pi/4 pitch_t = -1*np.pi/6 roll_t = -1*np.pi/12 angles = [yaw_t, pitch_t, roll_t] -euler_axes = 'rzyx' +euler_axes = 'zyx' # Create a triangle in a given orientation # and get the x,y,z axis used as our two markers triangle_mode = 'x-axis=median-from-0' diff --git a/orientation/examples/yawpitchroll.py b/orientation/examples/yawpitchroll.py index 413dc9d126742bd060d737f63a7aba58e9337c9c..c6ed084fd112bafd41320413acbc78d6ccf4bace 100644 --- a/orientation/examples/yawpitchroll.py +++ b/orientation/examples/yawpitchroll.py @@ -24,7 +24,7 @@ pos = np.array([1.0, 1.0, 1.0]) yaw = +1*np.pi/3 pitch = +1*np.pi/6 roll = -1*np.pi/6 -axes = 'rzyx' +axes = 'zyx' transform = compose_matrix(translate=pos, angles=[yaw, pitch, roll],