Ejemplo n.º 1
0
Archivo: Sun.py Proyecto: Tapyr/tapyr
 def ra (self) :
     """Apparent right ascension of the sun (in degrees)."""
     ### Eq. (25.6), for apparent position
     o      = self.time.obliquity_corrected
     l      = self.apparent_longitude
     result = Angle_R.normalized (Angle_R.atan2 (o.cos * l.sin, l.cos))
     return result
Ejemplo n.º 2
0
 def ra(self):
     """Apparent right ascension of the sun (in degrees)."""
     ### Eq. (25.6), for apparent position
     o = self.time.obliquity_corrected
     l = self.apparent_longitude
     result = Angle_R.normalized(Angle_R.atan2(o.cos * l.sin, l.cos))
     return result
Ejemplo n.º 3
0
 def _at_time(self, m):
     ### J. Meeus, p. 103
     loc = self.loc
     rts = self.rts
     ### sid: sidereal time at Greenwich, in degrees,
     ###      at time `m` (expressed as fraction of a day)
     self.sid      = sid      = Angle_D.normalized \
         (rts.sid.degrees + 360.985647 * m)
     ### n: `m` corrected by difference in
     ###    Terrestrial Dynamical Time and UT
     self.n = n = m + self.day.delta_T / 86400.0
     self.alpha = alpha = Angle_R(rts.interpolator_a(n))
     self.delta = delta = Angle_R(rts.interpolator_d(n))
     self.ha = ha = hour_angle(sid, loc, alpha)
     self.altitude = alt = altitude(delta, ha, loc)
     return ha, delta, alt
Ejemplo n.º 4
0
def azimuth (decl, ha, lat) :
    """Azimuth of a celestial body with declination `decl` and hour angle `ha`
       for latitude `lat`.

       Azimuth is measured eastward from the North.
    """
    ### J. Meeus, p. 93, Eq. (13.5)
    tan_A    = \
        ( ha.sin
        / (ha.cos * lat.sin - decl.tan * lat.cos)
        )
    result   = Angle_D.normalized (Angle_R.atan (tan_A).degrees)
    corr     = 0
    if   ha < 0 and result > 180 :
        corr = Angle_D (-180) ### ha < 0 --> E of meridian
    elif ha > 0 and result < 180 :
        corr = Angle_D (+180) ### ha > 0 --> W of meridian
    result  += corr
    return Angle_D.normalized (result.degrees)
Ejemplo n.º 5
0
def azimuth (decl, ha, loc) :
    """Azimuth of a celestial body with declination `decl` and hour angle `ha`
       for location `loc`.

       Azimuth is measured eastward from the North.
    """
    ### J. Meeus, p. 93, Eq. (13.5)
    lat      = loc.latitude
    tan_A    = \
        ( ha.sin
        / (ha.cos * lat.sin - decl.tan * lat.cos)
        )
    result   = Angle_D.normalized (Angle_R.atan (tan_A).degrees)
    corr     = 0
    if   ha < 0 and result > 180 :
        corr = Angle_D (-180) ### ha < 0 --> E of meridian
    elif ha > 0 and result < 180 :
        corr = Angle_D (+180) ### ha > 0 --> W of meridian
    result  += corr
    return Angle_D.normalized (result.degrees)
Ejemplo n.º 6
0
 def calc (self, m) :
     self.__super.calc (m)
     self.azimuth  = Angle_D \
         (360. - Angle_R.acos (self.delta.sin / self.lat.cos).degrees)
Ejemplo n.º 7
0
 def calc(self, m):
     self.__super.calc(m)
     self.azimuth  = Angle_D \
         (360. - Angle_R.acos (self.delta.sin / self.lat.cos).degrees)
Ejemplo n.º 8
0
 def phi(self):
     """Angular coordinate of polar coordinate system"""
     return Angle_R.atan2(self._y, self._x)
Ejemplo n.º 9
0
 def phi (self) :
     """Angular coordinate of polar coordinate system"""
     return Angle_R.atan2 (self._y, self._x)