コード例 #1
0
ファイル: test_coord.py プロジェクト: fjlatora/test_repo
 def setUp(self):
     self.now = Time(time.time(), format='unix')
     self.c = SkyCoord('05h34m31.95s +22d00m52.1s')
     self.alt, self.az = coord.get_altaz(self.c.ra,
                                         self.c.dec,
                                         jd=self.now.jd,
                                         equinox='J2000')
コード例 #2
0
ファイル: track_source.py プロジェクト: Maxelee/Radio_lab
def main():
    ################ ORGANIZING FILES AND DIRECTORIES #############
    # Check if the JD exists
    JD = timing.julian_date()
    path = args.path + '/' + str(round(int(JD)))
    path_exists = os.path.exists(path)
    if path_exists:
        pass
    else:
        os.mkdir(path)
    # Make some empty lists to add to
    alts = []
    azs = []
    lsts = []
    # bring in source information
    source_dict = {source.name: source for source in sources.sources}
    lat, lon, alt = nch.lat, nch.lon, nch.alt
    ifm = interf.Interferometer()
    pointing_good = True
    try:
        while pointing_good:
            JD = timing.julian_date()
            if args.sun_track:
                ra, dec = coord.sunpos(JD)
            elif args.moon_track:
                ra, dec = coord.moonpos(JD)
            else:
                assert args.source in source_dict, "choose, crab cygnus M17 orion or cas"
                ra, dec = source_dict[args.source].ra, source_dict[
                    args.source].dec
            alt, az = coord.get_altaz(ra, dec, JD, lat, lon, alt)
            if az <= 90:
                az += 180
                alt = (180 - alt)
            if az >= 300:
                az -= 180
                alt = (180 - alt)

            #store time and location
            lsts.append(timing.lst())
            alts.append(alt)
            azs.append(az)
            #point at source
            print(alt, az)
            ifm.point(alt, az)
            print('pointing to {} at alt:{}, az:{}'.format(
                args.source, alt, az))
            #wait 1 minute
            sleep(args.sleep_time)
    except KeyboardInterrupt:
        #Save alts and azs
        np.savez(path + '/time_and_coords', alts=alts, azs=azs, lsts=lsts)

        ifm.stow()

    finally:  #Save alts and azs
        print('ERROR')
        np.savez(path + '/time_and_coords', alts=alts, azs=azs, lsts=lsts)

        ifm.stow()
コード例 #3
0
ファイル: test_coord.py プロジェクト: AaronParsons/ugradio
 def test_getaltaz_time(self):
     alt2,az2 = coord.get_altaz(self.c.ra,self.c.dec,
                jd=self.now.jd+1,equinox='J2000') 
     self.assertNotEqual(self.alt,alt2,
     msg='getaltaz: alt not changing with time.') 
     self.assertNotEqual(self.az,az2, 
     msg='getaltaz: az not changing with time.')
コード例 #4
0
ファイル: test_coord.py プロジェクト: fjlatora/test_repo
 def test_getaltaz_time(self):
     alt2, az2 = coord.get_altaz(self.c.ra,
                                 self.c.dec,
                                 jd=self.now.jd + 1,
                                 equinox='J2000')
     self.assertNotEqual(self.alt,
                         alt2,
                         msg='getaltaz: alt not changing with time.')
     self.assertNotEqual(self.az,
                         az2,
                         msg='getaltaz: az not changing with time.')
コード例 #5
0
ファイル: test_coord.py プロジェクト: AaronParsons/ugradio
 def setUp(self):
     self.now = Time(time.time(),format='unix')
     self.c = SkyCoord('05h34m31.95s +22d00m52.1s')
     self.alt,self.az = coord.get_altaz(self.c.ra,self.c.dec,
                        jd=self.now.jd,equinox='J2000')
コード例 #6
0
 def get_alt(self, JD):
     alt =coord.get_altaz(self.ra, self.dec, JD)[0]
     return alt