예제 #1
0
    def skyToPix(self, ra_deg, dec_deg):
        sin = np.sin
        cos = np.cos

        #Parse inputs and allocate space for outputs
        ra_deg, dec_deg = self.parseInputs(ra_deg, dec_deg)
        long_deg = ra_deg * 0
        lat_deg = long_deg * 0

        #Get longitude and latitude relative to defined origin.
        for i in range(len(ra_deg)):
            vec = rotate.vecFromRaDec(ra_deg[i], dec_deg[i])
            aVec = np.dot( self.Rmatrix, vec)
            long_deg[i], lat_deg[i] = rotate.raDecFromVec(aVec)

        long_deg = np.fmod(long_deg + 180, 360.)
        long_rad = np.radians(long_deg) - np.pi #[-pi,pi]
        lat_rad = np.radians(lat_deg)

        #long_rad = np.fmod(long_rad+ np.pi, 2*np.pi)

        gamma = 1 + cos(lat_rad)* cos(long_rad/2.)
        gamma = np.sqrt(2/gamma)
        x = -2*gamma*cos(lat_rad)*sin(long_rad/2)
        y = gamma*sin(lat_rad)

        return x, y
예제 #2
0
    def skyToPix(self, ra_deg, dec_deg):
        sin = np.sin
        cos = np.cos

        #Parse inputs and allocate space for outputs
        ra_deg, dec_deg = self.parseInputs(ra_deg, dec_deg)
        long_deg = ra_deg * 0
        lat_deg = long_deg * 0

        #Get longitude and latitude relative to defined origin.
        for i in range(len(ra_deg)):
            vec = rotate.vecFromRaDec(ra_deg[i], dec_deg[i])
            aVec = np.dot(self.Rmatrix, vec)
            long_deg[i], lat_deg[i] = rotate.raDecFromVec(aVec)

        long_deg = np.fmod(long_deg + 180, 360.)
        long_rad = np.radians(long_deg) - np.pi  #[-pi,pi]
        lat_rad = np.radians(lat_deg)

        #long_rad = np.fmod(long_rad+ np.pi, 2*np.pi)

        gamma = 1 + cos(lat_rad) * cos(long_rad / 2.)
        gamma = np.sqrt(2 / gamma)
        x = -2 * gamma * cos(lat_rad) * sin(long_rad / 2)
        y = gamma * sin(lat_rad)

        return x, y
예제 #3
0
파일: fov.py 프로젝트: kamhawy4/k2epic
    def getRaDecs(self, mods):
        """Internal function converting cartesian coords to
        ra dec"""
        raDecOut = np.empty( (len(mods), 5))
        raDecOut[:,0:3] = mods[:,0:3]

        for i, row in enumerate(mods):
            raDecOut[i, 3:5] = r.raDecFromVec(row[3:6])
        return raDecOut
예제 #4
0
    def pixToSky(self, x, y):
        x, y = self.parseInputs(x, y)

        R = self.Rmatrix
        invR = np.matrix(R.transpose())
        ra_deg = np.empty((len(x), ))
        dec_deg = np.empty((len(x), ))

        for i in range(len(x)):
            phi_rad = np.arctan2(y, x)
            r = np.hypot(x, y)
            theta_rad = np.arctan(r)

            aVec = np.zeros((3, ))
            aVec[0] = np.cos(theta_rad)
            aVec[1] = np.sin(theta_rad) * np.cos(phi_rad)
            aVec[2] = np.sin(theta_rad) * np.sin(phi_rad)

            vec = np.dot(invR, aVec)
            vec = np.array(vec)[0]  #Convert to 1d array
            ra_deg[i], dec_deg[i] = rotate.raDecFromVec(vec)
        return ra_deg, dec_deg
예제 #5
0
    def pixToSky(self, x, y):
        x, y = self.parseInputs(x, y)

        R = self.Rmatrix
        invR = np.matrix(R.transpose())
        ra_deg = np.empty( (len(x),))
        dec_deg = np.empty( (len(x),))

        for i in range(len(x)):
            phi_rad = np.arctan2(y,x)
            r = np.hypot(x,y)
            theta_rad = np.arctan(r)

            aVec = np.zeros((3,))
            aVec[0] = np.cos(theta_rad)
            aVec[1] = np.sin(theta_rad)*np.cos(phi_rad)
            aVec[2] = np.sin(theta_rad)*np.sin(phi_rad)


            vec = np.dot(invR, aVec)
            vec = np.array(vec)[0]    #Convert to 1d array
            ra_deg[i], dec_deg[i] = rotate.raDecFromVec(vec)
        return ra_deg, dec_deg