Пример #1
0
def tel_move(RA, DEC, n, COLOR, s):
    #initialize  and update position coordinates
    location = EarthLocation.from_geodetic(lon=-111.5947 * u.deg,
                                           lat=31.95844 * u.deg,
                                           height=2097.024 * u.m)
    kittpeak = Observer(location=location, name='kitt peak')
    coord = SkyCoord(ra=RA * u.deg, dec=DEC * u.deg, unit='deg', frame='icrs')
    time = thetime('2018-4-6 00:00:00')
    times = time + (n * u.second)
    lst = kittpeak.local_sidereal_time(times)
    ha = (lst.hour - (RA / 15.0)
          )  # given in hours, converted to degrees later for PA calc
    frame = AltAz(obstime=times, location=location)
    new_coord = coord.transform_to(frame)
    alt = new_coord.alt.degree
    az = new_coord.az.degree

    # parallactic angle calculation -----------------------------------------------------------------------------------
    sina = np.sin(np.radians(ha * 15.0))
    cosa = (np.tan(np.radians(31.95844)) * np.cos(np.radians(DEC))) - (
        np.sin(np.radians(DEC)) * np.cos(np.radians(ha * 15.0)))
    pa = np.degrees(np.arctan2(sina, cosa))

    #s.send(message.encode('utf-8'))
    packer = struct.Struct('d d d d d d d')
    data = packer.pack(pa, slew_flag, alt, az, ra, dec, othertime.time())
    s.send(data)
    return s
Пример #2
0
def pa_calc(ctime, RA, DEC):
    #initialize  and update position coordinates
    location = EarthLocation.from_geodetic(lon=-111.5947 * u.deg,
                                           lat=31.95844 * u.deg,
                                           height=2097.024 * u.m)
    kittpeak = Observer(location=location, name='kitt peak')
    lst = kittpeak.local_sidereal_time(ctime)

    coord = SkyCoord(ra=RA * u.deg, dec=DEC * u.deg, unit='deg', frame='icrs')
    frame = AltAz(obstime=ctime, location=location)
    new_coord = coord.transform_to(frame)
    ha = (lst.hour - (RA / 15.0)
          )  # given in hours, converted to degrees later for PA calc

    # parallactic angle calculation -----------------------------------------------------------------------------------
    sina = np.sin(np.radians(ha * 15.0))
    cosa = (np.tan(np.radians(31.95844)) * np.cos(np.radians(DEC))) - (
        np.sin(np.radians(DEC)) * np.cos(np.radians(ha * 15.0)))
    pa = np.degrees(np.arctan2(sina, cosa))

    return pa
Пример #3
0
    def tel_move(self, coord_space, x, y, n):
        #initialize  and update position coordinates
        location = EarthLocation.from_geodetic(lon=-111.5947 * u.deg,
                                               lat=31.95844 * u.deg,
                                               height=2097.024 * u.m)
        kittpeak = Observer(location=location, name='kitt peak')
        self.thedate = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        time = thetime(self.thedate)
        times = time + (n * u.second)
        lst = kittpeak.local_sidereal_time(times)

        if coord_space == 'RA' or coord_space == 'DEC':
            coord = SkyCoord(ra=x * u.deg,
                             dec=y * u.deg,
                             unit='deg',
                             frame='icrs')
            frame = AltAz(obstime=times, location=location)
            new_coord = coord.transform_to(frame)
            other_y = new_coord.alt.degree
            other_x = new_coord.az.degree
            ha = (lst.hour - (x / 15.0)
                  )  # given in hours, converted to degrees later for PA calc

        else:
            coord = AltAz(x * u.deg, y * u.deg)
            frame = SkyCoord(obstime=times, location=location)
            new_coord = coord.transform_to(frame)
            other_x = new_coord.ra.degree
            other_y = new_coord.dec.degree
            ha = (lst.hour - (other_x / 15.0)
                  )  # given in hours, converted to degrees later for PA calc

        # parallactic angle calculation -----------------------------------------------------------------------------------
        sina = np.sin(np.radians(ha * 15.0))
        cosa = (np.tan(np.radians(31.95844)) * np.cos(np.radians(y))) - (
            np.sin(np.radians(y)) * np.cos(np.radians(ha * 15.0)))
        pa = np.degrees(np.arctan2(sina, cosa))

        return pa, other_x, other_y
Пример #4
0
    def sun_moon(self):
        lat, longit, elev = '34.7443', '-111.4223', 2361
        loc = EarthLocation.from_geodetic(longit, lat, elev)
        dct = Observer(loc, timezone='US/Mountain')
        now = Time.now()
        altaz = AltAz(location=loc, obstime=now)
        sun = get_sun(now)
        moon = get_moon(now, loc)
        lst = dct.local_sidereal_time(now)
        lst = lst.hms
        lsth, lstm, lsts = str(lst[0]).split('.')[0], str(
            lst[1]).split('.')[0], str(lst[2]).split('.')[0]
        lstss = str(lst[2]).split('.')[1]
        self.lststr = '%02d' % int(lsth) + ':' + '%02d' % int(
            lstm) + ':' + '%02d' % int(lsts) + '.' + lstss[0:2]

        moonfz = dct.moon_illumination(now)
        self.moonillum = f'{moonfz * 100:04.1f}'
        moonget = moon.transform_to(altaz).alt.deg
        self.moonalt = '{:2.4f}'.format(moonget)
        sunget = sun.transform_to(altaz).alt.deg
        self.sunalt = '{:2.4f}'.format(sunget)
        return self.lststr, self.sunalt, self.moonalt, self.moonillum
Пример #5
0
# initialize coordinates of source on sky and time stepper ----------------------------------------------------------------------------------
n = 0
dec = 20  # degrees
ra = 20  # degrees

# this sections simulates tracking at the sidereal rate with data transmitted at 20 reports/sec -----------------------------------------------------------
for x in range(10000):
    location = EarthLocation.from_geodetic(lon=-111.5947 * u.deg,
                                           lat=31.95844 * u.deg,
                                           height=2097.024 * u.m)
    kittpeak = Observer(location=location, name='kitt peak')
    coord = SkyCoord(ra=ra * u.deg, dec=dec * u.deg, unit='deg', frame='icrs')
    time = thetime('2018-1-16 00:00:00')
    times = time + (n * u.second)
    lst = kittpeak.local_sidereal_time(times)
    ha = (lst.hour - (newra[1] / 15.0)
          )  # given in hours, converted to degrees later for PA calc
    frame = AltAz(obstime=times, location=location)
    new_coord = coord.transform_to(frame)
    alt = new_coord.alt.radian
    az = new_coord.az.radian

    # parallactic angle calculation -----------------------------------------------------------------------------------
    sina = np.sin(np.radians(ha * 15.0))
    cosa = (np.tan(np.radians(31.95844)) * np.cos(np.radians(dec))) - (
        np.sin(np.radians(dec)) * np.cos(np.radians(ha * 15.0)))
    pa = np.degrees(np.arctan2(sina, cosa))

    #------------------------------------------------------------------------------------------------------------------
    print(pa)  # show new parallactic angle in degrees