def raDecToAltAz(raDec, latitude, lst):
     decR = CoordUtil.coordToR(raDec.dec)
     latR = CoordUtil.coordToR(latitude)
     ha = CoordUtil.raToHa(raDec.ra, lst)
     haR = CoordUtil.coordToR(ha)
     
     altR,azR = CoordUtil.coordRotate(decR, latR, haR)
     
     return Position.fromAltAz(Coord.fromR(CoordUtil.makeValid180to180(altR)), Coord.fromR(CoordUtil.makeValid0to360(azR)))
 def __init__(self, buffer):
     # discard time
     buffer.recv(8)
     self.ra = struct.unpack("<1I", buffer.recv(4))[0]
     self.ra *= (math.pi / 0x80000000)
     self.ra = Coord.fromR(self.ra).toHMS()
     self.dec = struct.unpack("<1i", buffer.recv(4))[0]
     self.dec *= (math.pi / 0x80000000)
     self.dec = Coord.fromR(self.dec).toDMS()
     self.position = Position.fromRaDec(self.ra, self.dec)
    def precess(self, epoch=Epoch.NOW):
        if str(epoch).lower() == str(Epoch.J2000).lower():
            epoch = ephem.J2000
        elif str(epoch).lower() == str(Epoch.B1950).lower():
            epoch = ephem.B1950
        elif str(epoch).lower() == str(Epoch.NOW).lower():
            epoch = ephem.now()

        j2000 = self.toEphem()
        now = ephem.Equatorial(j2000, epoch=epoch)
        return Position.fromRaDec(Coord.fromR(now.ra), Coord.fromR(now.dec), epoch=Epoch.NOW)
 def LST(self):
     """
     Mean Local Sidereal Time
     """
     #lst = self._getEphem(self.ut()).sidereal_time()
     #required since a Coord cannot be constructed from an Ephem.Angle
     lst_c = Coord.fromR(self.LST_inRads())
     return lst_c.toHMS()
Beispiel #5
0
 def LST (self):
     """
     Mean Local Sidereal Time
     """
     #lst = self._getEphem(self.ut()).sidereal_time()
     #required since a Coord cannot be constructed from an Ephem.Angle
     lst_c = Coord.fromR(self.LST_inRads())
     return lst_c.toHMS()
Beispiel #6
0
    def angsep(self, other):
        """
        Calculate the Great Circle Distance from other.

        @param other: position to calculate distance from.
        @type  other: L{Position}

        @returns: The distance from this point to L{other}.
        @rtype: L{Coord} in degress (convertable, as this is a Coord).
        """
        return Coord.fromR(CoordUtil.gcdist(self.R, other.R)).toD()
Beispiel #7
0
    def angsep(self, other):
        """
        Calculate the Great Circle Distance from other.

        @param other: position to calculate distance from.
        @type  other: L{Position}

        @returns: The distance from this point to L{other}.
        @rtype: L{Coord} in degress (convertable, as this is a Coord).
        """
        return Coord.fromR(CoordUtil.gcdist(self.R, other.R)).toD()
Beispiel #8
0
    def toEpoch(self, epoch=Epoch.J2000):
        '''
        Returns a new Coordinate with the specified Epoch
        '''

        # If coordinate epoch is already the right one, do nothing
        if str(epoch).lower() == str(self.epoch).lower():
            return self

        # Else, do the coordinate conversion...
        if str(epoch).lower() == str(Epoch.J2000).lower():
            eph_epoch = ephem.J2000
        elif str(epoch).lower() == str(Epoch.B1950).lower():
            eph_epoch = ephem.B1950
        elif str(epoch).lower() == str(Epoch.NOW).lower():
            eph_epoch = ephem.now()

        coords = ephem.Equatorial(self.toEphem(), epoch=eph_epoch)

        return Position.fromRaDec(Coord.fromR(coords.ra), Coord.fromR(coords.dec), epoch=epoch)
Beispiel #9
0
    def toEpoch(self, epoch=Epoch.J2000):
        '''
        Returns a new Coordinate with the specified Epoch
        '''

        # If coordinate epoch is already the right one, do nothing
        if str(epoch).lower() == str(self.epoch).lower():
            return self

        # Else, do the coordinate conversion...
        if str(epoch).lower() == str(Epoch.J2000).lower():
            eph_epoch = ephem.J2000
        elif str(epoch).lower() == str(Epoch.B1950).lower():
            eph_epoch = ephem.B1950
        elif str(epoch).lower() == str(Epoch.NOW).lower():
            eph_epoch = ephem.now()

        coords = ephem.Equatorial(self.toEphem(), epoch=eph_epoch)

        return Position.fromRaDec(Coord.fromR(coords.ra),
                                  Coord.fromR(coords.dec),
                                  epoch=epoch)
    def moonpos(self, date=None):
        date = date or self.localtime()
        self._moon.compute(self._getEphem(date))

        return Position.fromAltAz(Coord.fromR(self._moon.alt),
                                  Coord.fromR(self._moon.az))
Beispiel #11
0
    def moonpos(self, date=None):
        date = date or self.localtime()
        self._moon.compute(self._getEphem(date))

        return Position.fromAltAz(
            Coord.fromR(self._moon.alt), Coord.fromR(self._moon.az))
Beispiel #12
0
    def sunpos(self, date=None):
        date = date or self.ut()
        self._sun.compute(self._getEphem(date))

        return Position.fromAltAz(
            Coord.fromR(self._sun.alt), Coord.fromR(self._sun.az))
 def getCurrentTrackingRate(self):
     raTrack = Coord.fromH(self._telescope.dRaTrackingRate)
     decTrack = Coord.fromR(self._telescope.dDecTrackingRate)
     return (raTrack.toHMS(), decTrack.toDMS())
Beispiel #14
0
    def sunpos(self, date=None):
        date = date or self.ut()
        self._sun.compute(self._getEphem(date))

        return Position.fromAltAz(Coord.fromR(self._sun.alt),
                                  Coord.fromR(self._sun.az))
Beispiel #15
0
 def __init__(self):
     self._table = np.loadtxt('%s/data/dome_model.csv' % os.path.dirname(chimera_lna.__file__), delimiter=',')
     self._coordinates = [[Position.fromAltAz(Coord.fromR(v[0]), Coord.fromR(v[1])), v[2]] for v in self._table]