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
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))
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))
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))
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
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
def test_dcos(): assert dcos(10) == 0.984807753012208 assert dcos(20) == 0.9396926207859084 assert dcos(30) == 0.8660254037844387