Ejemplo n.º 1
0
    def get_vobs(self, mjdtmp, xtmp, ytmp, mode, offx, offy, dcos, offmode):
        if offmode == self.coord_dict["SAME"] | offmode == mode :
            ytmp += offy
            if dcos == 0 :
                xtmp += offx
            else :
                xtmp += offx/math.cos(ytmp)
        else :
            print("error coord != off_coord")
            pass
        if mode == self.coord_dict["J2000"] :
            xxtmp = xtmp
            yytmp = ytmp
        elif mode == self.coord_dict["B1950"] :
            ret = slalib.sla_fk45z(xtmp, ytmp, 1950)
            xxtmp = ret[0]
            yytmp = ret[1]
        elif mode == self.coord_dict["LB"] :
            ret = slalib.sla_galeq(xtmp, ytmp)
            xxtmp = ret[0]
            yytmp = ret[1]
        else :
            xxtmp = xtmp
            yytmp = ytmp

        vobs = self.calc_vobs(mjdtmp+2400000.5, xxtmp, yytmp)
        return vobs
Ejemplo n.º 2
0
 def get_vobs(self, mjdtmp, xtmp, ytmp, mode, offx, offy, dcos, offmode):
     #modeを見て、j2000へ座標変換してる
     mode = mode.lower()
     offmode = offmode.lower()
     mode = self.coord_dict[mode]
     offmode = self.coord_dict[offmode]
     if offmode == self.coord_dict["same"]:
         ytmp += offy
         if dcos == 0:
             xtmp += offx
         else:
             xtmp += offx / math.cos(ytmp)
     elif offmode == mode:
         ytmp += offy
         if dcos == 0:
             xtmp += offx
         else:
             xtmp += offx / math.cos(ytmp)
     else:
         print("error coord != off_coord")
         pass
     if mode == self.coord_dict["j2000"]:
         xxtmp = xtmp
         yytmp = ytmp
     elif mode == self.coord_dict["b1950"]:
         ret = slalib.sla_fk45z(xtmp, ytmp, 1950)
         xxtmp = ret[0]
         yytmp = ret[1]
     elif mode == self.coord_dict["lb"] or mode == self.coord_dict[
             "galactic"] or mode == self.coord_dict["gal"]:
         ret = slalib.sla_galeq(xtmp, ytmp)
         xxtmp = ret[0]
         yytmp = ret[1]
     else:
         xxtmp = xtmp
         yytmp = ytmp
     print(xxtmp, yytmp)
     print(xxtmp / 3600.)
     print(xxtmp * 360. / 2 * 3.14)
     vobs = self.calc_vobs(mjdtmp + 2400000.5, xxtmp, yytmp)
     print('vobs', vobs, type(vobs))
     return vobs
Ejemplo n.º 3
0
def transform_celestial(coords, systems):
    lons, lats = np.radians(coords['lon']), np.radians(coords['lat'])

    out = Table()
    out['lon'] = np.zeros(len(coords), dtype='float64')
    out['lat'] = np.zeros(len(coords), dtype='float64')

    for ii, (lon, lat) in enumerate(zip(lons, lats)):

        # First convert to FK5 J2000 in all cases
        if systems['in'] == 'fk4':
            lon, lat = slalib.sla_fk45z(lon, lat, 2000.0012775136652)
        elif systems['in'] == 'icrs':
            lon, lat = slalib.sla_hfk5z(lon, lat, 2000)[:2]
        elif systems['in'] == 'galactic':
            lon, lat = slalib.sla_galeq(lon, lat)
        elif systems['in'] == 'ecliptic':
            lon, lat = slalib.sla_ecleq(lon, lat, 51544)

        # Now convert from FK5 J2000 to out system    
        if systems['out'] == 'fk4':
            # FK5 -> FK4 at BEPOCH 2000 assuming no proper motion or parallax
            lon, lat = slalib.sla_fk54z(lon, lat, 2000.0012775136652)[:2]
        elif systems['out'] == 'icrs':
            # FK5 -> Hipparcos (i.e. ICRF, which is as close as SLALIB
            # gets to ICRS) at epoch 2000 and with no proper motion
            lon, lat = slalib.sla_fk5hz(lon, lat, 2000)
        elif systems['out'] == 'galactic':
            # FK5 -> Galactic
            lon, lat = slalib.sla_eqgal(lon, lat)
        elif systems['out'] == 'ecliptic':
            # FK5 -> Ecliptic at TDB (MJD) 51544 (i.e. J2000)
            lon, lat = slalib.sla_eqecl(lon, lat, 51544)

        out[ii]['lon'] = np.degrees(lon)
        out[ii]['lat'] = np.degrees(lat)

    return out
Ejemplo n.º 4
0
def transform_celestial(coords, systems):
    lons, lats = np.radians(coords['lon']), np.radians(coords['lat'])

    out = Table()
    out['lon'] = np.zeros(len(coords), dtype='float64')
    out['lat'] = np.zeros(len(coords), dtype='float64')

    for ii, (lon, lat) in enumerate(zip(lons, lats)):

        # First convert to FK5 J2000 in all cases
        if systems['in'] == 'fk4':
            lon, lat = slalib.sla_fk45z(lon, lat, 2000.0012775136652)
        elif systems['in'] == 'icrs':
            lon, lat = slalib.sla_hfk5z(lon, lat, 2000)[:2]
        elif systems['in'] == 'galactic':
            lon, lat = slalib.sla_galeq(lon, lat)
        elif systems['in'] == 'ecliptic':
            lon, lat = slalib.sla_ecleq(lon, lat, 51544)

        # Now convert from FK5 J2000 to out system
        if systems['out'] == 'fk4':
            # FK5 -> FK4 at BEPOCH 2000 assuming no proper motion or parallax
            lon, lat = slalib.sla_fk54z(lon, lat, 2000.0012775136652)[:2]
        elif systems['out'] == 'icrs':
            # FK5 -> Hipparcos (i.e. ICRF, which is as close as SLALIB
            # gets to ICRS) at epoch 2000 and with no proper motion
            lon, lat = slalib.sla_fk5hz(lon, lat, 2000)
        elif systems['out'] == 'galactic':
            # FK5 -> Galactic
            lon, lat = slalib.sla_eqgal(lon, lat)
        elif systems['out'] == 'ecliptic':
            # FK5 -> Ecliptic at TDB (MJD) 51544 (i.e. J2000)
            lon, lat = slalib.sla_eqecl(lon, lat, 51544)

        out[ii]['lon'] = np.degrees(lon)
        out[ii]['lat'] = np.degrees(lat)

    return out
Ejemplo n.º 5
0
def convert(coords, systems):
    
    if not set(systems.values()).issubset(SUPPORTED_SYSTEMS):
        return None

    lons, lats = np.radians(coords['lon']), np.radians(coords['lat'])

    for ii, (lon, lat) in enumerate(zip(lons, lats)):

        # First convert to FK5 J2000 in all cases
        if systems['in'] == 'fk4':
            lon, lat = slalib.sla_fk45z(lon, lat, 2000.0012775136652)
        elif systems['in'] == 'icrs':
            lon, lat = slalib.sla_hfk5z(lon, lat, 2000)[:2]
        elif systems['in'] == 'galactic':
            lon, lat = slalib.sla_galeq(lon, lat)
        elif systems['in'] == 'ecliptic':
            lon, lat = slalib.sla_ecleq(lon, lat, 51544)
        
        # Now convert from FK5 J2000 to out system    
        if systems['out'] == 'fk4':
            # FK5 -> FK4 at BEPOCH 2000 assuming no proper motion or parallax
            lon, lat = slalib.sla_fk54z (lon, lat, 2000.0012775136652)[:2]
        elif systems['out'] == 'icrs':
            # FK5 -> Hipparcos (i.e. ICRF, which is as close as SLALIB
            # gets to ICRS) at epoch 2000 and with no proper motion
            lon, lat = slalib.sla_fk5hz(lon, lat, 2000)
        elif systems['out'] == 'galactic':
            # FK5 -> Galactic
            lon, lat = slalib.sla_eqgal(lon, lat)
        elif systems['out'] == 'ecliptic':
            # FK5 -> Ecliptic at TDB (MJD) 51544 (i.e. J2000)
            lon, lat = slalib.sla_eqecl(lon, lat, 51544)

        lons[ii], lats[ii] = lon, lat

    return dict(lon=np.degrees(lons), lat=np.degrees(lats))
Ejemplo n.º 6
0
    def get_vobs(self, mjdtmp, xtmp, ytmp, mode, offx, offy, dcos, offmode):

        mode = mode.lower()
        offmode = offmode.lower()
        ### for 'coord == horizontal' skip
        try:
            mode = self.coord_dict[mode]
        except:
            xxtmp = xtmp
            yytmp = ytmp
        try:
            offmode = self.coord_dict[offmode]
        except:
            xxtmp = xtmp
            yytmp = ytmp

        if mode == 1:  #j2000
            if offmode == 0 or offmode == 1:  #same or j2000
                yytmp = ytmp + offy
                if dcos == 0:
                    xxtmp = xtmp + offx
                else:
                    xxtmp = xtmp + offx / math.cos(yytmp)

            elif offmode == 2:  #b1950
                ret = slalib.sla_fk54z(xtmp, ytmp, 2000)
                xtmp_b = ret[0]
                ytmp_b = ret[1]
                ytmp_b += offy
                if dcos == 0:
                    xtmp_b += offx
                else:
                    xtmp_b += offx / math.cos(ytmp_b)
                ret_1 = slalib.sla_fk45z(xtmp_b, ytmp_b, 1950)
                xxtmp = ret_1[0]
                yytmp = ret_1[1]

            elif offmode == 3:  #lb,galactic,gal
                ret = slalib.sla_eqgal(xtmp, ytmp)
                xtmp_g = ret[0]
                ytmp_g = ret[1]
                ytmp_g += offy
                if dcos == 0:
                    xtmp_g += offx
                else:
                    xtmp_g += offx / math.cos(ytmp_g)
                ret_1 = slalib.sla_galeq(xtmp_g, ytmp_g)
                xxtmp = ret_1[0]
                yytmp = ret_1[1]

        if mode == 2:  #b1950
            if offmode == 1:  #j2000
                ret = slalib.sla_fk45z(xtmp, ytmp, 1950)
                xtmp_j = ret[0]
                ytmp_j = ret[1]
                yytmp = ytmp_j + offy
                if dcos == 0:
                    xxtmp = xtmp_j + offx
                else:
                    xxtmp = xtmp_j + offx / math.cos(ytmp_j)

            elif offmode == 2 or offmode == 0:  #b1950
                ytmp += offy
                if dcos == 0:
                    xtmp += offx
                else:
                    xtmp += offx / math.cos(ytmp)
                ret = slalib.sla_fk45z(xtmp, ytmp, 1950)
                xxtmp = ret[0]
                yytmp = ret[1]

            elif offmode == 3:  #lb,galactic,gal
                ret = slalib.sla_eg50(xtmp, ytmp)
                xtmp_g = ret[0]
                ytmp_g = ret[1]
                ytmp_g += offy
                if dcos == 0:
                    xtmp_g += offx
                else:
                    xtmp_g += offx / math.cos(ytmp_g)
                ret = slalib.sla_galeq(xtmp_g, ytmp_g)
                xxtmp = ret[0]
                yytmp = ret[1]

        if mode == 3:  #lb,galactic,gal
            if offmode == 1:  #j2000
                ret_2 = slalib.sla_galeq(xtmp, ytmp)
                xtmp_j = ret_2[0]
                ytmp_j = ret_2[1]
                yytmp = ytmp_j + offy
                if dcos == 0:
                    xxtmp = xtmp_j + offx
                else:
                    xxtmp = xtmp_j + offx / math.cos(ytmp_j)

            elif offmode == 2:  #b1950
                ret = slalib.sla_ge50(xtmp, ytmp)
                xtmp_b = ret[0]
                ytmp_b = ret[1]
                ytmp_b += offy
                if dcos == 0:
                    xtmp_b += offx
                else:
                    xtmp_b += offx / math.cos(ytmp_b)
                ret = slalib.sla_fk45z(xtmp_b, ytmp_b, 1950)
                xxtmp = ret[0]
                yytmp = ret[1]

            elif offmode == 0 or offmode == 3:  #gal,lb,galactic
                ytmp += offy
                if dcos == 0:
                    xtmp += offx
                else:
                    xtmp += offx / math.cos(ytmp)
                ret = slalib.sla_galeq(xtmp, ytmp)
                xxtmp = ret[0]
                yytmp = ret[1]

        vobs = self.calc_vobs(mjdtmp + 2400000.5, xxtmp, yytmp)
        #print('vobs',vobs,type(vobs))
        return vobs
Ejemplo n.º 7
0
    def get_vobs(self, mjdtmp, xtmp, ytmp, mode, offx, offy, dcos, offmode):

        mode = mode.lower()
        offmode = offmode.lower()
        mode = self.coord_dict[mode]
        offmode = self.coord_dict[offmode]
        #if offmode == self.coord_dict["same"]:
        #ytmp += offy
        #if dcos == 0 :
        #xtmp += offx
        #else :
        #xtmp += offx/math.cos(ytmp)
        #elif offmode == mode :
        #ytmp += offy
        #if dcos == 0 :
        #xtmp += offx
        #else :
        #xtmp += offx/math.cos(ytmp)
        #else :
        #print("error coord != off_coord")
        #pass
        if mode == self.coord_dict["j2000"]:
            xtmp = xtmp
            ytmp = ytmp
        elif mode == self.coord_dict["b1950"]:
            ret = slalib.sla_fk45z(xtmp, ytmp, 1950)
            xtmp = ret[0]
            ytmp = ret[1]
        elif mode == self.coord_dict["lb"]:
            ret = slalib.sla_galeq(xtmp, ytmp)
            xtmp = ret[0]
            ytmp = ret[1]
        elif mode == self.coord_dict["galactic"]:
            ret = slalib.sla_galeq(xtmp, ytmp)
            xtmp = ret[0]
            ytmp = ret[1]
        elif mode == self.coord_dict["gal"]:
            ret = slalib.sla_galeq(xtmp, ytmp)
            xtmp = ret[0]
            ytmp = ret[1]
        else:
            print("error coord !")  #
            #xxtmp = xtmp
            #yytmp = ytmp
        if offmode == self.coord_dict["j2000"]:
            offx = offx
            offy = offy
        elif offmode == self.coord_dict["b1950"]:
            ret = slalib.sla_fk45z(offx, offy, 1950)
            offx = ret[0]
            offy = ret[1]
        elif offmode == self.coord_dict["lb"]:
            ret = slalib.sla_galeq(offx, offy)
            offx = ret[0]
            offy = ret[1]
        elif offmode == self.coord_dict["galactic"]:
            ret = slalib.sla_galeq(offx, offy)
            offx = ret[0]
            offy = ret[1]
        elif offmode == self.coord_dict["gal"]:
            ret = slalib.sla_galeq(offx, offy)
            offx = ret[0]
            offy = ret[1]
        else:  #horizontal
            offx = 0
            offy = 0
        ytmp += offy
        if dcos == 0:
            xtmp += offx
        elif dcos == 1:
            xtmp += offx / math.cos(ytmp)

        vobs = self.calc_vobs(mjdtmp + 2400000.5, xtmp, ytmp)
        print('vobs', vobs, type(vobs))
        return vobs
Ejemplo n.º 8
0
    def get_vobs(self, mjdtmp, xtmp, ytmp, mode, offx, offy, dcos, offmode):

        mode = mode.lower()
        offmode = offmode.lower()
        ### for 'coord == horizontal' skip
        try :
            mode = self.coord_dict[mode]
        except:
            xxtmp = xtmp
            yytmp = ytmp
        try:
            offmode = self.coord_dict[offmode]
        except:
            xxtmp = xtmp
            yytmp = ytmp

        if mode == 1:#j2000
            if offmode == 0 or offmode == 1:#same or j2000
                yytmp = ytmp+offy
                if dcos == 0 :
                    xxtmp = xtmp+offx
                else :  
                    xxtmp = xtmp+offx/math.cos(yytmp)
                    
            elif offmode == 2:#b1950
                ret = slalib.sla_fk54z(xtmp, ytmp, 2000)
                xtmp_b = ret[0]
                ytmp_b = ret[1]
                ytmp_b += offy
                if dcos == 0 :
                    xtmp_b += offx
                else :
                    xtmp_b += offx/math.cos(ytmp_b)
                ret_1 = slalib.sla_fk45z(xtmp_b, ytmp_b,1950)
                xxtmp = ret_1[0]
                yytmp = ret_1[1]
                
            elif offmode == 3:#lb,galactic,gal
                ret = slalib.sla_eqgal(xtmp,ytmp)
                xtmp_g = ret[0]
                ytmp_g = ret[1]
                ytmp_g += offy
                if dcos == 0 :
                    xtmp_g += offx
                else :
                    xtmp_g += offx/math.cos(ytmp_g)
                ret_1 = slalib.sla_galeq(xtmp_g, ytmp_g)
                xxtmp = ret_1[0]
                yytmp = ret_1[1]
                
        if mode == 2:#b1950
            if offmode == 1:#j2000
                ret = slalib.sla_fk45z(xtmp, ytmp, 1950)
                xtmp_j = ret[0]
                ytmp_j = ret[1]
                yytmp = ytmp_j+offy
                if dcos == 0 :
                    xxtmp = xtmp_j+offx
                else :  
                    xxtmp = xtmp_j+offx/math.cos(ytmp_j)
                    
            elif offmode == 2 or offmode ==0:#b1950
                ytmp += offy
                if dcos == 0 :
                    xtmp += offx
                else:   
                    xtmp += offx/math.cos(ytmp)
                ret = slalib.sla_fk45z(xtmp, ytmp, 1950)
                xxtmp = ret[0]
                yytmp = ret[1]
                
            elif offmode == 3:#lb,galactic,gal
                ret = slalib.sla_eg50(xtmp,ytmp)
                xtmp_g = ret[0]
                ytmp_g = ret[1]
                ytmp_g += offy
                if dcos == 0 :
                    xtmp_g += offx
                else :  
                    xtmp_g += offx/math.cos(ytmp_g)
                ret = slalib.sla_galeq(xtmp_g, ytmp_g)
                xxtmp = ret[0]
                yytmp = ret[1]
                
        if mode == 3:#lb,galactic,gal
            if offmode == 1:#j2000
                ret_2 = slalib.sla_galeq(xtmp, ytmp)
                xtmp_j = ret_2[0]
                ytmp_j = ret_2[1]
                yytmp = ytmp_j+offy
                if dcos == 0 :
                    xxtmp = xtmp_j+offx
                else :
                    xxtmp = xtmp_j+offx/math.cos(ytmp_j)
                    
            elif offmode == 2:#b1950
                ret = slalib.sla_ge50(xtmp,ytmp)
                xtmp_b = ret[0]
                ytmp_b = ret[1]
                ytmp_b += offy
                if dcos == 0 :
                    xtmp_b += offx
                else :  
                    xtmp_b += offx/math.cos(ytmp_b)
                ret = slalib.sla_fk45z(xtmp_b, ytmp_b, 1950)
                xxtmp = ret[0]
                yytmp = ret[1]
                    
            elif offmode == 0 or offmode == 3:#gal,lb,galactic
                ytmp += offy
                if dcos == 0 :
                    xtmp += offx
                else :  
                    xtmp += offx/math.cos(ytmp)
                ret = slalib.sla_galeq(xtmp, ytmp)
                xxtmp = ret[0]
                yytmp = ret[1]
                
        vobs = self.calc_vobs(mjdtmp+2400000.5, xxtmp, yytmp)
        #print('vobs',vobs,type(vobs))
        return vobs