def test_fromrotmat(self):
     np.testing.assert_array_almost_equal(
         self.qeasy[0], qarray.from_rotmat(qarray.to_rotmat(self.qeasy[0]))
     )
示例#2
0
文件: __init__.py 项目: zonca/dipole
#T_CMB = 2.725
T_CMB = 2.72548

#from hidra
#QECL2GAL = np.array((-0.37382079227204573, 0.33419217216073838, 0.64478939348298625, 0.57690575088960561))
#from healpix
l.debug('Using healpix ecl2gal')
ecl2gal = np.array([[ -5.48824860e-02,  -9.93821033e-01,  -9.64762490e-02],
                    [  4.94116468e-01,  -1.10993846e-01,   8.62281440e-01],
                    [ -8.67661702e-01,  -3.46354000e-04,   4.97154957e-01]])
eps = np.radians(23.452294 - 0.0130125 - 1.63889E-6 + 5.02778E-7)
e2q =      [[1.,     0.    ,      0.         ],
            [0., np.cos( eps ), -1. * np.sin( eps )], 
            [0., np.sin( eps ),    np.cos( eps )   ]]

QECL2GAL = qarray.from_rotmat(ecl2gal)
QECL2EQ = qarray.from_rotmat(e2q)
#              array([-0.37381694,  0.3341907 ,  0.64479285,  0.57690524])

#ephem.Date('1958/1/1 00:00')-ephem.Date('-4713/1/1 12:00:0')
JD_OBT_DAYDIFF = 2436204.5

def compute_dipole_from_vel(vel):
    beta = vel / physcon.c
    gamma=1/np.sqrt(1-beta**2)
    cosdir = 1
    T_dipole_CMB = T_CMB / (gamma * ( 1 - beta * cosdir ))
    return T_dipole_CMB - T_CMB

def ecl2gal(vec):
    return qarray.rotate(QECL2GAL , vec)

            # In[13]:

            q = np.empty([len(vec), 4], dtype=np.float)


            # In[14]:

            n = len(vec)
            for i in range(n):
                rotmat = np.hstack([ vec_north[i,:][:,np.newaxis],
                                     np.cross(vec[i,:], vec_north[i,:])[:,np.newaxis],
                                     vec[i,:][:,np.newaxis]
                                ])
                q[i] = qa.norm(qa.from_rotmat(rotmat))
                if (i > 0):
                    if np.dot(q[i], q[i-1]) < 0:
                        q[i] *= -1


            # `rotmat` / `q` are the rotation matrix / quaternion between the local system and Equatorial coordinates

            # ### Interpolation

            # In[18]:

            jd = pointing.index.to_julian_date()


            # In[19]: