Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculation method different? #2

Open
semaf opened this issue May 6, 2019 · 19 comments
Open

Calculation method different? #2

semaf opened this issue May 6, 2019 · 19 comments

Comments

@semaf
Copy link

semaf commented May 6, 2019

Hey,

I am having somehow totally wrong times.

The script gives:
03:13
12:51
16:54
20:15
22:31

Should be:
03:52
05:22 (sun)
12:56
16:57
20:21
21:41

Selected is Karachi

@achaudhry
Copy link
Owner

Hey, sorry for the late response. What location are you using, just so I can debug on my end? Thanks@

@semaf
Copy link
Author

semaf commented Nov 17, 2019

Bro I set the calculation method my own:

        # Calculation Methods
        methods = {
                'Diyanet': {
                        'name': 'Diyanet Isleri Baskanligi',
                        'params': { 'fajr': 18, 'isha': 18 },
                        'offsets': { 'fajr': -200, 'sunrise': -6, 'dhuhr': 7, 'asr': 4, 'maghrib': 7, 'isha': 1 } },

The coordinates for our location is 48.210033, 16.363449

Asr is set to "Hanafi"

The result is showing me
Fajr: 05:15
Sunrise: 08:04
Dhuhr: 11:40
Asr: 11:40
Maghrib: 16:14
Isha: 18:04
Midnight: 00:39

It should be by the correct calculation:
Fajr: 05:13
Sunrise: 06:57
Dhuhr: 11:44
Asr: 13:57
Maghrib: 16:22
Isha: 17:42
Midnight: 00:39
Source: https://www.namaztakvimi.com/avusturya/viyana-ezan-vakti.html

@semaf
Copy link
Author

semaf commented Mar 16, 2020

Sorry but your code is not working correct and is useless for the folk.

@semaf semaf closed this as completed Mar 16, 2020
@achaudhry
Copy link
Owner

@semaf Hey, I'm sorry I haven't been able to look at the issue due to some personal reasons. I'll look at it in the next couple of days and report back.

Since you're using your own calculation method, I'd like to test it with your changes. Could you commit your code and send me the commit hash or create a pull request so that I can look into it? I have not heard any other complaints and I know there are many people out there using this so I assume it's broken for your specific use case. Happy to look into it if you can push your changes.

Thanks!

@achaudhry achaudhry reopened this Mar 16, 2020
@semaf
Copy link
Author

semaf commented Mar 16, 2020

Thank you for your reply. Sorry for that.

I am not able to pull it at the moment but can paste here the files.
The output of times should equal to this here:
https://namazvakitleri.diyanet.gov.tr/en-US/11618/prayer-time-for-viyana

praytimes.py
https://pastebin.com/yNDLY0L1

updateAzaanTimers.py
https://pastebin.com/LhFVAkNk

Here is an example of the praytimes.py with Diyanet calculation method too but result is also not exact or not to change over any settings.
https://github.com/cpfair/pebble-qibla-www/blob/master/praytimes.py

@achaudhry
Copy link
Owner

Spent a few hours on this, can't figure out what's wrong. Will keep looking and let you know if I make any progress

@cmadooly
Copy link

cmadooly commented Apr 8, 2020

Asalaamu'alykum @achaudhry - Coding is not really my area of expertise. I've got everything working except I want to change ASR to Hanafi time. Everything else about your script is working fine

05:55 (fajr) 13:28 (Duhr) 17:04 (Asr) 19:52 (Maghrib) 21:02 (Isha)

I just want Asr to be hanafi time, so it should be 18:04
Do you what I need to adjust?
I'm using the ISNA method
lat = 33.0151
long = -96.6130

@cmadooly
Copy link

cmadooly commented Apr 9, 2020

Asalaamu'alykum @achaudhry - Coding is not really my area of expertise. I've got everything working except I want to change ASR to Hanafi time. Everything else about your script is working fine

05:55 (fajr) 13:28 (Duhr) 17:04 (Asr) 19:52 (Maghrib) 21:02 (Isha)

I just want Asr to be hanafi time, so it should be 18:04
Do you what I need to adjust?
I'm using the ISNA method
lat = 33.0151
long = -96.6130

Nevermind, figured it out
Not sure if this is the right way but in praytimes.py I changed
'ISNA': { 'name': 'Islamic Society of North America (ISNA)', 'params': { 'fajr': 15, 'isha': 15 } },
to

'ISNA': {
                        'name': 'Islamic Society of North America (ISNA)',
                        'params': { 'fajr': 15, 'asr': 2, 'isha': 15 } },

@achaudhry
Copy link
Owner

Wa Allaikum Assalam @cmadooly Sorry for the late response. The proper way to do it would be to add
PT.adjust({'asr': 'Hanafi'}) in updateAzaanTimers.py right after you set the Method to ISNA.

Hope this helps!

@achaudhry
Copy link
Owner

@cmadooly By the way, essentially the end result is exactly the same so you can either go with your solution or mine. Both should work just fine. But it's usually better not to hard code anything in praytimes.py to keep that class generic, and put application specific setup such as calculation method, asr method, lat/lng etc in updateAzaanTimers.py

Stay safe and healthy!

@cmadooly
Copy link

cmadooly commented Apr 9, 2020

Thank you. I reverted my change and used yours.

@semaf
Copy link
Author

semaf commented Apr 12, 2020

So at least I got it running since couple of weeks with Logitech Media Server and AirPlay Speakers. Supporting multiple speakers around house.

Also the Diyanet is working with the calculation.
https://github.com/semaf/adhan/blob/master/praytimes.py

https://github.com/semaf/adhan/

Thank you bro for the code!

@achaudhry
Copy link
Owner

No problem brother. Sorry I couldn't spend more time to help you but I'm so happy to hear that you got it to work.

If the code is generic enough and you think it will help others in the future, do you want to submit a pull request with your change? I'll be happy to merge it.

Thank you!

@semaf
Copy link
Author

semaf commented Apr 13, 2020

No problem brother. Sorry I couldn't spend more time to help you but I'm so happy to hear that you got it to work.

If the code is generic enough and you think it will help others in the future, do you want to submit a pull request with your change? I'll be happy to merge it.

Thank you!

Yes sure, please just that you know I am not a coder.

@semaf
Copy link
Author

semaf commented Apr 19, 2022

Assalamun Alaykum,
Ramadan kareem brothers.

After long time I recognized that the calculation of praytimes.py is not doing his job correct. Did you recognize that too?
I have within one month a difference of 15-20 minutes to other sources.

@achaudhry
Copy link
Owner

Wa'salaam brother, which calculation method are you using. I and a few other family members have been using it for over 5 years without a problem. Curious what's different about your setup. JAK for bringing it up

@cmadooly
Copy link

Wa'alykumasalaam. Mine has been running non-stop for several months with no issues as well.
My adhan.log showed the below today

05:42 13:26 18:07 19:59 21:11

@semaf
Copy link
Author

semaf commented Apr 21, 2022

Set 2 days ago to the correct time for coordinates 48.210033,16.363449 and I am calculating by Diyanet (Turkish) method "Standard" and to their source it should be for today:

04:17 | 05:47 | 12:58 | 16:49 | 20:00 | 21:20

but have it calculated

04:20 | 05:47 | 13:02 | 16:48 | 19:57 | 21:17

after a month it is how said more than 15-20 minutes. The offsets are too high and maybe this is calculating by the time different.

The calculation method I add in praytimes.py is here

'Diyanet': {
        'name': 'Diyanet Isleri Baskanligi',
        'params': { 'fajr': 18, 'isha': 17 },
        'offsets': { 'fajr': 22, 'sunrise': -6, 'dhuhr': 8, 'asr': 4, 'maghrib': 6, 'isha': -25 } },

# Default Parameters in Calculation Methods
defaultParams = {
    'maghrib': '0 min', 'midnight': 'Standard'
}

# do not change anything here; use adjust method instead
settings = {
    "imsak"    : '0 min',
    "dhuhr"    : '0 min',
    "asr"      : 'Standard',
    "highLats" : 'AngleBased'
}

If I set today the offset, than it must be like below

'offsets': { 'fajr': 24, 'sunrise': -6, 'dhuhr': 5, 'asr': 4, 'maghrib': 6, 'isha': -27 } },

Here is another discussion about it, but they have passed it without future problems.
batoulapps/Adhan#23

@amacanada
Copy link

amacanada commented Apr 27, 2022

I was curious about this and searched their website. Diyanet's default method is 18 degrees for both fajr and isha. But at latitudes beyond 45 degrees north of the equator, they use a different method explained here: https://kurul.diyanet.gov.tr/Cevap-Ara/4093/45--enlemin-otesinde-namaz-vakitleri?enc=QisAbR4bAkZg1HImMxXRn2t8ij%2beDtMkJdRGirgyeb8%3d

Here's a translation (slightly tweaked/clarified from Google Translate) of the relevant text:
a) To calculate the time for isha beyond the 45th latitude, it is unanimously decided to continue to determine the time of isha based on one third of the night (the period between sunset and the true dawn), as specified in the decision of the High Board of Religious Affairs dated 31.05.2007 and numbered 48;

b) It is decided by majority vote that beyond the 45th latitude, in regions and periods where one third of the night exceeds 1 hour and 20 minutes, the start of isha is determined so as to not exceed 1 hour and 20 minutes from the time of maghrib,

(I'm not 100% sure about the next bullet point, since the language isn't clear to me and the Google translation is a mess)

c) It is unanimously decided that fajr between March and September is to be determined by adding 10 minutes to the time determined in (a) and (b) (i.e., the time duration between maghrib and isha) and subtracting it from the time of sunrise. The transition to this calculation method is to be done gradually/progressively (it doesn't elaborate on what it means by "gradually").

(Note that I'm pretty sure that this item is still referring specifically to regions beyond 45 degrees north of the equator, and my understanding is that outside of this March-September time frame, they use 18 degrees for fajr.)

d) It is unanimously decided to use the times of the 62nd latitude beyond the 62nd latitude,

e) It is unanimously decided that it will not be seen as wrong or erroneous for individuals and committees with scientific competence to determine different times for these regions by using different calculation methods, and to worship accordingly.

Here are archive.org links (since the original URLs are no longer live) to the 2006 and 2009 decisions referred to in the page above:
https://web.archive.org/web/20100328013804/http://www.diyanet.gov.tr/turkish/dy/KurulDetay.aspx?ID=1160
https://web.archive.org/web/20111217055334/http://www.diyanet.gov.tr/turkish/dy/KurulDetay.aspx?ID=1160

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants