示例#1
0
    def compute_lsrk(self):
        """ Computes the LSR in km/s

        uses the MJD, RA and DEC of observation to compute
        along with the telescope location. Requires pyslalib
        """
        ra = Angle(self.header[b'src_raj'], unit='hourangle')
        dec = Angle(self.header[b'src_dej'], unit='degree')
        mjdd = self.header[b'tstart']
        rarad = ra.to('radian').value
        dcrad = dec.to('radian').value
        last = self.compute_lst()
        tellat = np.deg2rad(self.coords[0])
        tellong = np.deg2rad(self.coords[1])

        # convert star position to vector
        starvect = s.sla_dcs2c(rarad, dcrad)

        # velocity component in ra,dec due to Earth rotation
        Rgeo = s.sla_rverot(tellat, rarad, dcrad, last)

        # get Barycentric and heliocentric velocity and position of the Earth.
        evp = s.sla_evp(mjdd, 2000.0)
        dvb = evp[0]  # barycentric velocity vector, in AU/sec
        dpb = evp[1]  # barycentric position vector, in AU
        dvh = evp[2]  # heliocentric velocity vector, in AU/sec
        dph = evp[3]  # heliocentric position vector, in AU

        # dot product of vector to object and heliocentric velocity
        # convert AU/sec to km/sec
        vcorhelio = -s.sla_dvdv(starvect, dvh) * 149.597870e6
        vcorbary = -s.sla_dvdv(starvect, dvb) * 149.597870e6

        # rvlsrd is velocity component in ra,dec direction due to the Sun's
        # motion with respect to the "dynamical" local standard of rest
        rvlsrd = s.sla_rvlsrd(rarad, dcrad)

        # rvlsrk is velocity component in ra,dec direction due to i
        # the Sun's motion w.r.t the "kinematic" local standard of rest
        rvlsrk = s.sla_rvlsrk(rarad, dcrad)

        # rvgalc is velocity component in ra,dec direction due to
        #the rotation of the Galaxy.
        rvgalc = s.sla_rvgalc(rarad, dcrad)
        totalhelio = Rgeo + vcorhelio
        totalbary = Rgeo + vcorbary
        totallsrk = totalhelio + rvlsrk
        totalgal = totalbary + rvlsrd + rvgalc

        return totallsrk
示例#2
0
    def rvel(self, mjdd, radeg, decdeg):
        global tellat, tellong, telelev

        last = self.hlst(mjdd)  # apparent LST in radians

        # convert ra,dec to radians
        rarad = radeg * math.pi / 180.0
        dcrad = decdeg * math.pi / 180.0

        # convert star position to vector
        starvect = s.sla_dcs2c(rarad, dcrad)

        # velocity component in ra,dec due to Earth rotation
        Rgeo = s.sla_rverot(tellat, rarad, dcrad, last)

        # get Barycentric and heliocentric velocity and position of the Earth.
        evp = s.sla_evp(mjdd, 2000.0)
        dvb = evp[0]  # barycentric velocity vector, in AU/sec
        dpb = evp[1]  # barycentric position vector, in AU
        dvh = evp[2]  # heliocentric velocity vector, in AU/sec
        dph = evp[3]  # heliocentric position vector, in AU

        # dot product of vector to object and heliocentric velocity
        # convert AU/sec to km/sec
        vcorhelio = -s.sla_dvdv(starvect, dvh) * 149.597870e6
        vcorbary = -s.sla_dvdv(starvect, dvb) * 149.597870e6

        # rvlsrd is velocity component in ra,dec direction due to the Sun's motion with
        # respect to the "dynamical" local standard of rest
        rvlsrd = s.sla_rvlsrd(rarad, dcrad)

        # rvlsrk is velocity component in ra,dec direction due to the Sun's motion with
        # respect to the "kinematic" local standard of rest
        rvlsrk = s.sla_rvlsrk(rarad, dcrad)

        # rvgalc is velocity component in ra,dec direction due to the rotation of the Galaxy.
        rvgalc = s.sla_rvgalc(rarad, dcrad)

        totalhelio = Rgeo + vcorhelio
        totalbary = Rgeo + vcorbary

        totallsrk = totalhelio + rvlsrk
        totalgal = totalbary + rvlsrd + rvgalc

        # ('UTHr', 'LST', 'Geo', 'Helio', 'Total Helio', 'LSRK', 'Galacto')
        #(hour,last*12.0/math.pi,Rgeo,vcorb,totalhelio,totallsrk,totalgal)

        # resulting velocities in km/sec
        return ((mjdd, last * 12.0 / math.pi, Rgeo, totalhelio, totalbary,
                 totallsrk, totalgal))
示例#3
0
def jd_to_hjd(t, target_position, debug=False):
    """Calculate the HJD timestamp corresponding to the JD given for the
    current event. 
    Inputs:
        t is an astropy Time object
        target_position is a tuple of (RA, Dec) in decimal degrees
    Outputs:
        hjd  float
    """
    
    if debug == True:
        print 'TIME JD: ',t, t.jd
        
    # Calculate the MJD (UTC) timestamp:
    mjd_utc = t.jd - 2400000.5
    if debug == True:
        print 'TIME MJD_UTC: ',mjd_utc
    
    # Correct the MJD to TT:
    mjd_tt = mjd_utc2mjd_tt(mjd_utc)
    if debug == True:
        print 'TIME MJD_TT: ',mjd_tt, t.tt.jd
    
    # Calculate Earth's position and velocity, both heliocentric
    # and barycentric for this date
    (earth_helio_position, vh, pb, vb) = S.sla_epv( mjd_tt )
    if debug == True:
        print 'Earth Cartesian position: ',earth_helio_position
        print 'Target cartesian position: ', target_position
    
    # Calculate the light travel time delay from the target to 
    # the Sun:
    dv = S.sla_dvdv( earth_helio_position, target_position )            
    tcorr = dv * ( constants.au.value / constants.c.value )
    
    if debug == True:
        print 'TIME tcorr: ', tcorr, 's', (tcorr/60.0),'mins'
    
    # Calculating the HJD:
    hjd = mjd_tt + tcorr/86400.0 + 2400000.5
    if debug == True:
        print 'TIME HJD: ',hjd,'\n'

    return hjd
示例#4
0
def jd_to_hjd(t, target_position, debug=False):
    """Calculate the HJD timestamp corresponding to the JD given for the
    current event.
    Inputs:
        t is an astropy Time object
        target_position is a tuple of (RA, Dec) in decimal degrees
    Outputs:
        hjd  float
    """

    if debug == True:
        print('TIME JD: ', t, t.jd)

    # Calculate the MJD (UTC) timestamp:
    mjd_utc = t.jd - 2400000.5
    if debug == True:
        print('TIME MJD_UTC: ', mjd_utc)

    # Correct the MJD to TT:
    mjd_tt = mjd_utc2mjd_tt(mjd_utc)
    if debug == True:
        print('TIME MJD_TT: ', mjd_tt, t.tt.jd)

    # Calculate Earth's position and velocity, both heliocentric
    # and barycentric for this date
    (earth_helio_position, vh, pb, vb) = S.sla_epv(mjd_tt)
    if debug == True:
        print('Earth Cartesian position: ', earth_helio_position)
        print('Target cartesian position: ', target_position)

    # Calculate the light travel time delay from the target to
    # the Sun:
    dv = S.sla_dvdv(earth_helio_position, target_position)
    tcorr = dv * (constants.au.value / constants.c.value)

    if debug == True:
        print('TIME tcorr: ', tcorr, 's', (tcorr / 60.0), 'mins')

    # Calculating the HJD:
    hjd = mjd_tt + tcorr / 86400.0 + 2400000.5
    if debug == True:
        print('TIME HJD: ', hjd, '\n')

    return hjd