예제 #1
0
    def calc_star_azel(self, ra, dec, mjd):
        ra = ra * math.pi / 180.
        dec = dec * math.pi / 180.

        ret = slalib.sla_map(ra, dec, 0, 0, 0, 0, 2000,
                             mjd + (self.tai_utc + 32.184) / (24. * 3600.))
        ret = list(ret)
        ret = slalib.sla_aop(ret[0],
                             ret[1],
                             mjd,
                             self.dut1,
                             -67.70308139 * math.pi / 180,
                             -22.96995611 * math.pi / 180,
                             4863.85,
                             0,
                             0,
                             283,
                             500,
                             0.1,
                             0.5,
                             tlr=0.0065)
        real_az = ret[0]
        real_el = math.pi / 2. - ret[1]

        real_az = real_az * 180. / math.pi
        real_el = real_el * 180. / math.pi
        return [real_az, real_el]
예제 #2
0
 def calc_star_azel(self, ra, dec, mjd):
     ra = ra*math.pi/180.
     dec = dec*math.pi/180.
     
     ret = slalib.sla_map(ra, dec, 0, 0, 0, 0, 2000, mjd + (self.tai_utc + 32.184)/(24.*3600.))
     ret = list(ret)
     ret = slalib.sla_aop(ret[0], ret[1], mjd, self.dut1, -67.70308139*math.pi/180, -22.96995611*math.pi/180, 4863.85, 0, 0, 283, 500, 0.1, 0.5, tlr=0.0065)
     real_az = ret[0]
     real_el = math.pi/2. - ret[1]
        
     real_az = real_az*180./math.pi
     real_el = real_el*180./math.pi
     return [real_az, real_el]
예제 #3
0
def radec_to_azza(ra, dec, MJD, fctr=350.0, atm=1010.0, temp=283.0, humid=0.5, scope='GBT'):
    """
    redec_to_azza(ra, dec, MJD):
        Return AZ and ZA (in deg) from RA and DEC (J2000 in deg) at MJD.  Keyword params
           are fctr=350.0, atm=1010.0, temp=283.0, humid=0.5, scope='GBT'.
    """
    scope, x, lon, lat, hgt = s.sla_obs(0, scope)
    microns = 3e8/(fctr*1e6)*1e6
    app_rarad, app_decrad = s.sla_map(ra*DEGTORAD,dec*DEGTORAD,0.0,0.0,0.0,0.0,2000.0,MJD)
    az, za, hob, rob, dob  = s.sla_aop(app_rarad,app_decrad,MJD,
                                       0.0,-lon,lat,hgt,0.0,0.0,temp,atm,humid,microns,0.0065)
    az = s.sla_dranrm(az)
    return az*RADTODEG, za*RADTODEG
예제 #4
0
def calc_star_azel(ra, dec, mjd):
    ra = ra*math.pi/180.
    dec = dec*math.pi/180.
    
    ret = slalib.sla_map(ra, dec, 0, 0, 0, 0, 2000, mjd + (tai_utc + 32.184)/(24.*3600.))
    ret = list(ret)
    ret = slalib.sla_aop(ret[0], ret[1], mjd, dut1, -67.70308139*math.pi/180, -22.96995611*math.pi/180, 4863.85, 0, 0, 283, 500, 0.1, 0.5, tlr=0.0065)
    real_az = ret[0]
    real_el = math.pi/2. - ret[1]
       
    real_az = real_az*180./math.pi
    real_el = real_el*180./math.pi
    ret = coord.apply_kisa(real_az, real_el, "/home/amigos/NECST/soft/server/hosei_opt.txt")
    real_az += ret[0]
    real_el += ret[1]
    return [real_az, real_el]
예제 #5
0
def radec_to_azza(ra,
                  dec,
                  MJD,
                  fctr=350.0,
                  atm=1010.0,
                  temp=283.0,
                  humid=0.5,
                  scope='GBT'):
    """
    redec_to_azza(ra, dec, MJD):
        Return AZ and ZA (in deg) from RA and DEC (J2000 in deg) at MJD.  Keyword params
           are fctr=350.0, atm=1010.0, temp=283.0, humid=0.5, scope='GBT'.
    """
    scope, x, lon, lat, hgt = s.sla_obs(0, scope)
    microns = 3e8 / (fctr * 1e6) * 1e6
    app_rarad, app_decrad = s.sla_map(ra * DEGTORAD, dec * DEGTORAD, 0.0, 0.0,
                                      0.0, 0.0, 2000.0, MJD)
    az, za, hob, rob, dob = s.sla_aop(app_rarad, app_decrad, MJD, 0.0, -lon,
                                      lat, hgt, 0.0, 0.0, temp, atm, humid,
                                      microns, 0.0065)
    az = s.sla_dranrm(az)
    return az * RADTODEG, za * RADTODEG
예제 #6
0
    def move_radec(self, gx, gy, gpx, gpy, code_mode, temp, pressure, humid, lamda, dcos, hosei = 'hosei_230.txt', off_coord = "HORIZONTAL", off_x = 0, off_y = 0, az_max_rate=16000, el_max_rate=12000):
        ##debug
        #print('moving!!!, {gx}, {gy}, {code_mode}'.format(**locals()))
        ##debug-end
        #if off_x != 0 or off_y != 0: #for test
        self.set_offset(off_coord, off_x, off_y)
        self.off_eq = gx*180./math.pi#self.off_list["off_az"]
        self.off_ga = gy*180./math.pi#self.off_list["off_l"]
        self.ra_off_ra = self.off_list["off_ra"]#
        self.ra_off_dec = self.off_list["off_dec"]#
        #lamda not equals lambda
        # Calculate current MJD
        tv = time.time()
        mjd = tv/24./3600. + 40587.0 # 40587.0 = MJD0
        #tv = time.time()
        #tv_sec = int(tv)
        #tv_usec = tv - tv_sec
        #mjd = (tv_sec + tv_usec/1000000.)/24./3600. + 40587.0 # 40587.0 = MJD0
        if dcos == 0:
            gy = gy + float(self.off_list["off_dec"])*math.pi/180/3600.
            gx = gx + float(self.off_list["off_ra"])*math.pi/180/3600.
        else:
            gy = gy + float(self.off_list["off_dec"])*math.pi/180/3600.
            gx = gx + float(self.off_list["off_ra"])*math.pi/180/3600./math.cos(gy)

        tai_utc = 36.0 # tai_utc=TAI-UTC  2015 July from ftp://maia.usno.navy.mil/ser7/tai-utc.dat
        
        # lamda is wavelength(not lambda)
        if code_mode == "b1950":
            ret = slalib.sla_fk425(gx, gy, gpx, gpy, 0, 0)
            gaJ2000 = ret[0]
            gdJ2000 = ret[1]
            gpaJ2000 = ret[2]
            gpdJ2000 = ret[3]
        else: # code mode == "J2000"
            gaJ2000 = gx # for check
            gdJ2000 = gy # for check
            gpaJ2000 = gpx # for check
            gpdJ2000 = gpy # for check
        
        ret = slalib.sla_map(gaJ2000, gdJ2000, gpaJ2000, gpdJ2000, 0, 0, 2000, mjd + (tai_utc + 32.184)/(24.*3600.))
        ret = list(ret)
        """
        ret[0] = apparent_ra
        ret[1] = apparent_dec
        """
        self.ra_real_ra = ret[0]*3600.
        self.ra_real_dec = ret[1]*3600.
        #if dcos == 0:
            #print(type(ret), ret[1], self.off_list['off_dec'])
            #ret[1] = ret[1]
            #ret[0] = ret[0]
        #else:
            #ret[1] = ret[1]
            #ret[0] = ret[0]
        ret = slalib.sla_aop(ret[0], ret[1], mjd, self.dut1, self.longitude, self.latitude, self.height, 0, 0, temp, pressure, humid, lamda, tlr=0.0065)
        """
        ret[0] = azimath(radian, N=0, E=90)
        ret[1] = zenith(radian)
        """
        #f = open('radec.txt','a')
        #while self.cc < 1:
        #f.write('gx : ' + 'gy : ' + 'off_ra : ' + 'off_dec : ' + 'real_ra : ' + 'real_dec' + '\n')
        #self.cc += 1
        #self.ra_real_ra = self.ra_real_ra - 83.80613*3600.
        #f.write(str(self.off_eq) +' '+ str(self.off_ga) +' '+ str(self.ra_off_ra) +' '+ str(self.ra_off_dec) +' '+ str(self.ra_real_ra) +' '+ str(self.ra_real_dec) + '\n')
        #f.write('bug_eq : ' + str(self.off_eq) +'\n')
        #f.write('bug_ga : ' + str(self.off_ga) +'\n')
        #f.write('off_ra : ' + str(self.ra_off_ra) +'\n')
        #f.write('off_dec : ' + str(self.ra_off_dec) +'\n')
        #f.write('real_ra : ' + str(self.ra_real_ra) +'\n')
        #f.write('real_dec : ' + str(self.ra_real_dec) +'\n')
        #f.close()
        #From zenith angle to elevation 
        real_az = ret[0]
        real_el = math.pi/2. - ret[1]
        real_az = real_az*180./math.pi*3600.
        real_el = real_el*180./math.pi*3600.
        track = self.move_azel(real_az, real_el, dcos, hosei, off_az=off_x,off_el=off_y,az_max_rate=az_max_rate, el_max_rate=el_max_rate, off_coord=off_coord)
        return track
예제 #7
0
utc = slalib.sla_caldj(2010, 1, 1)[0]
tt = slalib.sla_dtt(utc) / 86400.0 + utc
dut = 1.4823561643834426  # from TPM.

aob = np.zeros((len(tab['raj2']), ), dtype=np.float64)
zob = aob.copy()
hob = aob.copy()
dob = aob.copy()
rob = aob.copy()
lon = np.radians(-111.598333)
lat = np.radians(31.956389)

for j, i in enumerate(tab):
    r1, d1 = slalib.sla_map(i['raj2'], i['decj2'], i['pma'], i['pmd'], i['px'],
                            0.0, 2000.0, tt)
    aob[j], zob[j], hob[j], dob[j], rob[j] = \
        slalib.sla_aop(r1, d1, utc, dut, lon, lat, 2093.093, 0.0, 0.0,
                       273.15, 1013.25, 0.0, 0.550, 0.0065)

aob = np.degrees(aob)
zob = np.degrees(zob)
hob = np.degrees(hob)
dob = np.degrees(dob)
rob = np.degrees(rob)

with open("slalib_hip_aop.txt", "w") as f:
    f.write("# Az, Zd, HA, Dec, RA in degrees.\n")
    s = "%14.9f %14.9f %14.9f %14.9f %14.9f\n"
    for i in range(len(aob)):
        f.write(s % (aob[i], zob[i], hob[i], dob[i], rob[i]))
    def move_radec(self, gx, gy, gpx, gpy, code_mode, temp, pressure, humid, lamda, dcos, hosei = 'hosei_230.txt', off_coord = "HORIZONTAL", off_x = 0, off_y = 0, az_max_rate=16000, el_max_rate=12000):
        ##debug
        #print('moving!!!, {gx}, {gy}, {code_mode}'.format(**locals()))
        ##debug-end
        #if off_x != 0 or off_y != 0: #for test
        self.set_offset(off_coord, off_x, off_y)
        self.off_eq = gx*180./math.pi#self.off_list["off_az"]
        self.off_ga = gy*180./math.pi#self.off_list["off_l"]
        self.ra_off_ra = self.off_list["off_ra"]#
        self.ra_off_dec = self.off_list["off_dec"]#
        #lamda not equals lambda
        # Calculate current MJD
        tv = time.time()
        mjd = tv/24./3600. + 40587.0 # 40587.0 = MJD0
        #tv = time.time()
        #tv_sec = int(tv)
        #tv_usec = tv - tv_sec
        #mjd = (tv_sec + tv_usec/1000000.)/24./3600. + 40587.0 # 40587.0 = MJD0
        if dcos == 0:
            gy = gy + float(self.off_list["off_dec"])*math.pi/180/3600.
            gx = gx + float(self.off_list["off_ra"])*math.pi/180/3600.
        else:
            gy = gy + float(self.off_list["off_dec"])*math.pi/180/3600.
            gx = gx + float(self.off_list["off_ra"])*math.pi/180/3600./math.cos(gy)

        tai_utc = 36.0 # tai_utc=TAI-UTC  2015 July from ftp://maia.usno.navy.mil/ser7/tai-utc.dat
        
        # lamda is wavelength(not lambda)
        if code_mode == "b1950":
            ret = slalib.sla_fk425(gx, gy, gpx, gpy, 0, 0)
            gaJ2000 = ret[0]
            gdJ2000 = ret[1]
            gpaJ2000 = ret[2]
            gpdJ2000 = ret[3]
        else: # code mode == "J2000"
            gaJ2000 = gx # for check
            gdJ2000 = gy # for check
            gpaJ2000 = gpx # for check
            gpdJ2000 = gpy # for check
        
        ret = slalib.sla_map(gaJ2000, gdJ2000, gpaJ2000, gpdJ2000, 0, 0, 2000, mjd + (tai_utc + 32.184)/(24.*3600.))
        ret = list(ret)
        """
        ret[0] = apparent_ra
        ret[1] = apparent_dec
        """
        self.ra_real_ra = ret[0]*3600.
        self.ra_real_dec = ret[1]*3600.
        #if dcos == 0:
            #print(type(ret), ret[1], self.off_list['off_dec'])
            #ret[1] = ret[1]
            #ret[0] = ret[0]
        #else:
            #ret[1] = ret[1]
            #ret[0] = ret[0]
        ret = slalib.sla_aop(ret[0], ret[1], mjd, self.dut1, self.longitude, self.latitude, self.height, 0, 0, temp, pressure, humid, lamda, tlr=0.0065)
        """
        ret[0] = azimath(radian, N=0, E=90)
        ret[1] = zenith(radian)
        """
        #f = open('radec.txt','a')
        #while self.cc < 1:
        #f.write('gx : ' + 'gy : ' + 'off_ra : ' + 'off_dec : ' + 'real_ra : ' + 'real_dec' + '\n')
        #self.cc += 1
        #self.ra_real_ra = self.ra_real_ra - 83.80613*3600.
        #f.write(str(self.off_eq) +' '+ str(self.off_ga) +' '+ str(self.ra_off_ra) +' '+ str(self.ra_off_dec) +' '+ str(self.ra_real_ra) +' '+ str(self.ra_real_dec) + '\n')
        #f.write('bug_eq : ' + str(self.off_eq) +'\n')
        #f.write('bug_ga : ' + str(self.off_ga) +'\n')
        #f.write('off_ra : ' + str(self.ra_off_ra) +'\n')
        #f.write('off_dec : ' + str(self.ra_off_dec) +'\n')
        #f.write('real_ra : ' + str(self.ra_real_ra) +'\n')
        #f.write('real_dec : ' + str(self.ra_real_dec) +'\n')
        #f.close()
        #From zenith angle to elevation 
        real_az = ret[0]
        real_el = math.pi/2. - ret[1]
        real_az = real_az*180./math.pi*3600.
        real_el = real_el*180./math.pi*3600.
        track = self.move_azel(real_az, real_el, dcos, hosei, off_az=off_x,off_el=off_y,az_max_rate=az_max_rate, el_max_rate=el_max_rate, off_coord=off_coord)
        return track