diff --git a/ale/transformation.py b/ale/transformation.py index 2d0f2690f42cca91b216617ddab67da90147105d..07a2de4f2659d5eeb6858cd28e037892814d9917 100644 --- a/ale/transformation.py +++ b/ale/transformation.py @@ -35,10 +35,17 @@ def create_rotations(rotation_table): rotation_table['J2000Q2'], rotation_table['J2000Q3'], rotation_table['J2000Q0']]).T + if 'AV1' in rotation_table: + av = np.array([rotation_table['AV1'], + rotation_table['AV2'], + rotation_table['AV3']]).T + else: + av = None time_dep_rot = TimeDependentRotation(quats, rotation_table['ET'], root_frame, - last_time_dep_frame) + last_time_dep_frame, + av=av) rotations.append(time_dep_rot) # Case 2: It's a table of Euler angle coefficients elif 'J2000Ang1' in rotation_table: diff --git a/tests/pytests/test_transformation.py b/tests/pytests/test_transformation.py index 6f1c5f217b89331dfad03ee040b1eb022e899113..c244b1cd357e2d2167b726fce7c687c1e80243c9 100644 --- a/tests/pytests/test_transformation.py +++ b/tests/pytests/test_transformation.py @@ -16,8 +16,27 @@ def test_create_quaternion_rotations(): assert len(rotations) == 1 assert rotations[0].source == 1 assert rotations[0].dest == -1000 - np.testing.assert_equal(rotations[0].times, np.array([0, 1])) - np.testing.assert_almost_equal(rotations[0].quats, np.array([[0, 0, 0, 1], [0.5, 0.5, 0.5, 0.5]])) + np.testing.assert_equal(rotations[0].times, [0, 1]) + np.testing.assert_almost_equal(rotations[0].quats, [[0, 0, 0, 1], [0.5, 0.5, 0.5, 0.5]]) + +def test_create_quaternion_av_rotations(): + test_table = { + 'J2000Q0' : [1, 0.5], + 'J2000Q1' : [0, 0.5], + 'J2000Q2' : [0, 0.5], + 'J2000Q3' : [0, 0.5], + 'AV1' : [0, 1], + 'AV2' : [2, 3], + 'AV3' :[4, 5], + 'ET' : [0, 1], + 'TimeDependentFrames' : [-1000, -100, 1]} + rotations = create_rotations(test_table) + assert len(rotations) == 1 + assert rotations[0].source == 1 + assert rotations[0].dest == -1000 + np.testing.assert_equal(rotations[0].times, [0, 1]) + np.testing.assert_almost_equal(rotations[0].quats, [[0, 0, 0, 1], [0.5, 0.5, 0.5, 0.5]]) + np.testing.assert_almost_equal(rotations[0].av, [[0, 2, 4], [1, 3, 5]]) def test_create_two_rotations(): test_table = {