Commit 62455a7f authored by Jesse Mapel's avatar Jesse Mapel Committed by GitHub
Browse files

Changed old scipy rotation calls to new ones (#399)

* Changed old scipy rotation calls to new ones

* Updated scipy pinning
parent 653b67be
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -271,7 +271,7 @@ class LroLrocPds3LabelNaifSpiceDriver(LineScanner, NaifSpice, Pds3Label, Driver)
        position = state[:3]
        position = state[:3]
        velocity = state[3:]
        velocity = state[3:]
        rotation = frame_chain.compute_rotation(1, lro_bus_id)
        rotation = frame_chain.compute_rotation(1, lro_bus_id)
        rotated_velocity = spice.mxv(rotation._rots.as_dcm()[0], velocity)
        rotated_velocity = spice.mxv(rotation._rots.as_matrix()[0], velocity)
        return rotated_velocity[0]
        return rotated_velocity[0]




@@ -507,7 +507,7 @@ class LroLrocIsisLabelNaifSpiceDriver(LineScanner, NaifSpice, IsisLabel, Driver)
        position = state[:3]
        position = state[:3]
        velocity = state[3:]
        velocity = state[3:]
        rotation = frame_chain.compute_rotation(1, lro_bus_id)
        rotation = frame_chain.compute_rotation(1, lro_bus_id)
        rotated_velocity = spice.mxv(rotation._rots.as_dcm()[0], velocity)
        rotated_velocity = spice.mxv(rotation._rots.as_matrix()[0], velocity)
        return rotated_velocity[0]
        return rotated_velocity[0]




+3 −3
Original line number Original line Diff line number Diff line
@@ -32,7 +32,7 @@ class ConstantRotation:
        --------
        --------
        scipy.spatial.transform.Rotation.from_dcm
        scipy.spatial.transform.Rotation.from_dcm
        """
        """
        rot = Rotation.from_dcm(mat)
        rot = Rotation.from_matrix(mat)
        return ConstantRotation(rot.as_quat(), source, dest)
        return ConstantRotation(rot.as_quat(), source, dest)


    def __init__(self, quat, source, dest):
    def __init__(self, quat, source, dest):
@@ -82,7 +82,7 @@ class ConstantRotation:
        """
        """
        The rotation matrix representation of the constant rotation
        The rotation matrix representation of the constant rotation
        """
        """
        return self._rot.as_dcm()
        return self._rot.as_matrix()


    def inverse(self):
    def inverse(self):
        """
        """
@@ -370,7 +370,7 @@ class TimeDependentRotation:
            skew = np.array([[0, -avs[indx, 2], avs[indx, 1]],
            skew = np.array([[0, -avs[indx, 2], avs[indx, 1]],
                             [avs[indx, 2], 0, -avs[indx, 0]],
                             [avs[indx, 2], 0, -avs[indx, 0]],
                             [-avs[indx, 1], avs[indx, 0], 0]])
                             [-avs[indx, 1], avs[indx, 0], 0]])
            rot_deriv = np.dot(skew, rots[indx].as_dcm().T).T
            rot_deriv = np.dot(skew, rots[indx].as_matrix().T).T
            rotated_vel[indx] = rots[indx].apply(vec_vel[indx])
            rotated_vel[indx] = rots[indx].apply(vec_vel[indx])
            rotated_vel[indx] += np.dot(rot_deriv, vec_pos[indx])
            rotated_vel[indx] += np.dot(rot_deriv, vec_pos[indx])


+1 −1
Original line number Original line Diff line number Diff line
@@ -14,7 +14,7 @@ dependencies:
  - pytz
  - pytz
  - python
  - python
  - python-dateutil
  - python-dateutil
  - scipy
  - scipy>=1.4.0
  - spiceypy>=2.3.0
  - spiceypy>=2.3.0
  - pyyaml
  - pyyaml
  - networkx
  - networkx
+1 −1
Original line number Original line Diff line number Diff line
@@ -28,7 +28,7 @@ requirements:
    - python
    - python
    - python-dateutil
    - python-dateutil
    - pytz
    - pytz
    - scipy >=1.2.0
    - scipy >=1.4.0
    - spiceypy >=2.3.0
    - spiceypy >=2.3.0
    - pyyaml
    - pyyaml


+1 −1
Original line number Original line Diff line number Diff line
@@ -512,7 +512,7 @@
#     test_cube._body_orientation_table['Rotations'] = [[1.0/np.sqrt(2), 1.0/np.sqrt(2), 0, 0]]
#     test_cube._body_orientation_table['Rotations'] = [[1.0/np.sqrt(2), 1.0/np.sqrt(2), 0, 0]]
#     #Overwrite the instrument pointing, which is (0, 1, 2, 3) at this point
#     #Overwrite the instrument pointing, which is (0, 1, 2, 3) at this point
#     test_cube._inst_pointing_table["Rotations"] = [[1.0/np.sqrt(2), 0, 1.0/np.sqrt(2), 0]]
#     test_cube._inst_pointing_table["Rotations"] = [[1.0/np.sqrt(2), 0, 1.0/np.sqrt(2), 0]]
#     print('inverse body rotation', test_cube._body_j2k2bf_rotation.inv().as_dcm())
#     print('inverse body rotation', test_cube._body_j2k2bf_rotation.inv().as_matrix())
#     np.testing.assert_almost_equal(test_cube._sensor_orientation, np.asarray([1/2, -1/2, -1/2, -1/2]))
#     np.testing.assert_almost_equal(test_cube._sensor_orientation, np.asarray([1/2, -1/2, -1/2, -1/2]))
#
#
# def test_body_orientation(test_cube):
# def test_body_orientation(test_cube):