def _time(self, zenith):
     '''Get Times for "Fajr, Sherook, Asr, Maghreb, ishaa"'''
     delta = self._sun_declination()
     s = ((dcos(zenith)
           - dsin(self._conf.latitude) * dsin(delta))
          / (dcos(self._conf.latitude) * dcos(delta)))
     return (180 / pi * (atan(-s / sqrt(-s * s + 1)) + pi / 2)) / 15
Beispiel #2
0
 def __asrZenith(self):
     '''Get the zenith angle for asr (according to choosed asr fiqh)'''
     delta = self.__sunDeclination()
     x = (dsin(self.__conf.latitude) * dsin(delta) +
          dcos(self.__conf.latitude) * dcos(delta))
     a = atan(x / sqrt(-x * x + 1))
     x = self.__conf.asrMadhab + (1 / tan(a))
     return 90 - (180 / pi) * (atan(x) + 2 * atan(1))
Beispiel #3
0
 def _asr_zenith(self):
     '''Get the zenith angle for asr (according to choosed asr fiqh)'''
     delta = self._sun_declination()
     x = (dsin(self._conf.latitude) * dsin(delta)
          + dcos(self._conf.latitude) * dcos(delta))
     a = atan(x / sqrt(-x * x + 1))
     x = self._conf.asr_madhab + (1 / tan(a))
     return 90 - (180 / pi) * (atan(x) + 2 * atan(1))
Beispiel #4
0
 def _get_asr_angle(self):
     '''Get the angle angle for asr (according to choosed asr fiqh)'''
     delta = self._sun_declination()
     x = (dsin(self._conf.latitude) * dsin(delta) +
          dcos(self._conf.latitude) * dcos(delta))
     a = atan(x / sqrt(-x * x + 1))
     x = self._conf.asr_madhab + (1 / tan(a))
     return 90 - (180 / pi) * (atan(x) + 2 * atan(1))
Beispiel #5
0
 def __sunDeclination(self):
     '''Get sun declination'''
     n = gregorianToJulianDay(self.__date) - 2451544.5
     epsilon = 23.44 - 0.0000004 * n
     l = 280.466 + 0.9856474 * n
     g = 357.528 + 0.9856003 * n
     lamda = l + 1.915 * dsin(g) + 0.02 * dsin(2 * g)
     x = dsin(epsilon) * dsin(lamda)
     return (180 / (4 * atan(1))) * atan(x / sqrt(-x * x + 1))
Beispiel #6
0
 def _sun_declination(self):
     '''Get sun declination'''
     n = gregorian_to_julian(self._date) - 2451544.5
     epsilon = 23.44 - 0.0000004 * n
     l = 280.466 + 0.9856474 * n
     g = 357.528 + 0.9856003 * n
     lamda = l + 1.915 * dsin(g) + 0.02 * dsin(2 * g)
     x = dsin(epsilon) * dsin(lamda)
     return (180 / (4 * atan(1))) * atan(x / sqrt(-x * x + 1))
Beispiel #7
0
 def __init__(self, conf):
     self._conf = conf
     MAKKAH_LATI = 21.42249  # latitude taken from maps.google.com
     MAKKAH_LONG = 39.826174  # longitude taken from maps.google.com
     lamda = MAKKAH_LONG - self._conf.longitude
     num = dcos(MAKKAH_LATI) * dsin(lamda)
     denom = (dsin(MAKKAH_LATI) * dcos(self._conf.latitude) -
              dcos(MAKKAH_LATI) * dsin(self._conf.latitude) * dcos(lamda))
     self._qiblah_dir = (180 / pi) * atan(num / denom)
     if num > 0 and denom < 0:
         self._qiblah_dir = 180 + self._qiblah_dir
     if num < 0 and denom < 0:
         self._qiblah_dir = 180 + self._qiblah_dir
     if num < 0 and denom > 0:
         self._qiblah_dir = 360 + self._qiblah_dir
Beispiel #8
0
 def __init__(self, conf):
     self.__conf = conf
     MAKKAH_LATI = 21.42249   # latitude taken from maps.google.com
     MAKKAH_LONG = 39.826174  # longitude taken from maps.google.com
     lamda = MAKKAH_LONG - self.__conf.longitude
     num = dcos(MAKKAH_LATI) * dsin(lamda)
     denom = (dsin(MAKKAH_LATI) * dcos(self.__conf.latitude)
              - dcos(MAKKAH_LATI) * dsin(self.__conf.latitude)
              * dcos(lamda))
     self.__qiblah_dir = (180 / pi) * atan(num / denom)
     if num > 0 and denom < 0:
         self.__qiblah_dir = 180 + self.__qiblah_dir
     if num < 0 and denom < 0:
         self.__qiblah_dir = 180 + self.__qiblah_dir
     if num < 0 and denom > 0:
         self.__qiblah_dir = 360 + self.__qiblah_dir
Beispiel #9
0
 def __equationOfTime(self):
     '''Get equation of time'''
     n = gregorianToJulianDay(self.__date) - 2451544.5
     g = 357.528 + 0.9856003 * n
     c = 1.9148 * dsin(g) + 0.02 * dsin(2 * g) + 0.0003 * dsin(3 * g)
     lamda = 280.47 + 0.9856003 * n + c
     r = (-2.468 * dsin(2 * lamda) + 0.053 * dsin(4 * lamda) +
          0.0014 * dsin(6 * lamda))
     return (c + r) * 4
Beispiel #10
0
 def _equation_of_time(self):
     '''Get equation of time'''
     n = gregorian_to_julian(self._date) - 2451544.5
     g = 357.528 + 0.9856003 * n
     c = 1.9148 * dsin(g) + 0.02 * dsin(2 * g) + 0.0003 * dsin(3 * g)
     lamda = 280.47 + 0.9856003 * n + c
     r = (-2.468 * dsin(2 * lamda)
          + 0.053 * dsin(4 * lamda)
          + 0.0014 * dsin(6 * lamda))
     return (c + r) * 4
Beispiel #11
0
def test_dsin():
    assert dsin(10) == 0.17364817766693033
    assert dsin(20) == 0.3420201433256687
    assert dsin(30) == 0.49999999999999994