示例#1
0
 def interp_get(self, rad):
     '''Interpolation after rotation to gal frame'''
     from Quaternion import Quat
     l.info('Rotating to detector %s' % rad)
     siam_quat = Quat(self.siam.get(rad)).q
     totquat = qarray.mult(self.qsatgal_interp, siam_quat)
     totquat_interp = qarray.nlerp(self.obt, self.ahfobt, totquat)
     x = np.array([1, 0, 0])
     vec = qarray.rotate(totquat_interp, x)
     l.info('Rotated to detector %s' % rad)
     return vec
 def test_nlerp(self):
     q = qarray.norm(np.array([[2., 3, 4, 5],
                   [6, 7, 8, 9]]))
     time = [0, 9] 
     targettime = [0, 3, 4.5, 9]
     q_interp = qarray.nlerp(
         targettime, 
         time, 
         q)
     self.assertEquals(len(q_interp), 4)
     np.testing.assert_array_almost_equal(q_interp[0], q[0])
     np.testing.assert_array_almost_equal(q_interp[-1], q[-1])
     np.testing.assert_array_almost_equal(q_interp[1], qarray.norm(q[0] * 2/3 + q[1]/3))
     np.testing.assert_array_almost_equal(q_interp[2], qarray.norm((q[0] + q[1])/2))
            # In[18]:

            jd = pointing.index.to_julian_date()


            # In[19]:

            ut_h = (jd - jd[0])*24


            # In[20]:

            target_ut_h = np.arange(0, ut_h[-1], 1/30/3600)


            qfull = qa.nlerp(target_ut_h, ut_h, q)


            # In[ ]:

            #qfull = q


            # In[ ]:

            #target_ut_h = ut_h.values


            # ### Elevation and spinning

            # Elevation is a rotation with respect to the `y` axis of the opening angle