badi_jd_tests¶
- class contrib.misc.badi_jd_tests.DateTests[source]
Bases:
BahaiCalendarEquinox and Solstices, Perihelion, and Aphelion https://www.timeanddate.com/sun/@112931?month=3&year=1844
The site below is where I’ve gotten the Vernal Equinox data that uses the 4, 100, and 400 algorithm, so we must also. The 4 and 128 algorithm is more accurate, but I’ve not found Vernal Equinox data that uses it.
Julian Period day into:Sun rise and set info:Tehran: 35.682376, 51.285817 USED- BAHJI_COORDS = (32.94333, 35.09222, 2.0)
- INJECT
- List of dates that can be injected in the vernal equinox table
above. Currently it’s not used.
- Type:
tuple
- MONTHS = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 0, 19)
- TRAN_COFF = 1843
- VE_0001_1582
List of vernal equinox values before 1583-03-20.
- Type:
tuple
- _OFFSETS
Offsets used when determining the week of year.
- Type:
dict
- _calc_kvymd(days, k, v, y, m, data)[source]
- _calculate_b_date(b_date, coords, jd_ut, data, options)[source]
- _date_range(options)[source]
- _day_of_week(year, month, day, doy, options)[source]
- _find_dates(year, inject)[source]
- _get_bahji_day_coeff(year)[source]
- _get_tehran_day_coeff(year)[source]
- _gregorian_date_from_badi_date(b_date: tuple, options, lat: float = 0, lon: float = 0, zone: float = 0) tuple[source]
Get the Gregorian date from the Badí’ date.
- _jd_from_badi_date(b_date, lat=None, lon=None, zone=None, options=None)[source]
- _pre_process_vernal_equinoxs()[source]
- _process_segment(y, a=0, onoff0=(), b=0, onoff1=())[source]
- _process_segments(year, pn, a=0, onoff0=(), b=0, onoff1=())[source]
Full range is -1842 to 1161
General ranges are determined with: ./contrib/misc/badi_jd_tests.py -p -S start_year -E end_year Where -S is the 1st year and -E is the nth year + 1 that needs to be process.
Use the following command to test the results of each segment, this calls the command above. ./contrib/misc/badi_jd_tests.py -qXS start_year -E end_year
- _week_of_year(year, month, day, weekday, week)[source]
- analyze_date_error(options)[source]
Finds the the Julian Period day (yearly epoch) that corresponds to the day of the Vernal Equinox. We display the UT Gregorian date and time and compare the UT JD values.
-a, optional -C, -G, and -X Also if -S and -E are used they must be used together.
- badi_round_trip(options)[source]
Test the full round trip between jd_from_badi_date() and badi_date_from_jd().
-b and -S and -E
- check_long_date_from_short_date(data)[source]
Check that long_date_from_short_date() works correctly.
-c or –ck-dates
- create_date_lists(options)[source]
Generate a list of Badí’ dates both long and short versions.
-l or –list Also -S and -E must both used together.
- day_inremental_change(options)[source]
Check that the incremental times of a day are correct.
-i and -S (Badi years) -M (Start month) -D (Start day) -H (Start hour)
- find_coefficents(options)[source]
Dump data for determining coefficients.
-q or –coeff and -S and -E (Badi years)
If -X is used the more exact mode is used. This should be the normal usage.
- find_coefficents_precursor(options)[source]
Dump data for determining the precursors to the coefficients. This determines which coefficient group should be used for the years provided. The years provided are on the Badí’ Calendar - or + the epoch.
-p or –precursor -S and -E must be Badi dates
Arguments to the process_segment() function.¶
First run badi_jd_tests.py -aX > filename.txt This file will be long so use less filename.txt to look at it. The last column will usually be -1, 0, or 1. The 0 values are already correct, the other two values means there is a difference between the Gregorian and Badí’ Julian Period days. These are the ones than need the coefficients to fix them.
The first argument is the current Badí’ year being processed subtracted from the end year argument.
The second argument is the 1st coefficient corresponding to the (1, 34, 67, 100) numbers in the output from this method.
The third argument is the 2nd coefficient which fixes the 1 values that were not included in the 1st coefficient and the 2 and 3 values.
If an error JD falls on a 0 (zero) value then you need to change the start and end years so that no error JDs fall on a 0 value. The average number of years fixed in a group is 99, but this is not a hard and fast rule. Obvious break points are where a sequence changes. For example where there are two consecutive already good values where the values you need to fix had one.
Note: Zero values never get processes.
- find_gregorian_dates(options)[source]
Convert Badí’ to Gregorian dates.
-g or –g-dates -XL and -S and -E
Converts Badí’ to Gregorian dates for the given range.
- find_leap_years(options)[source]
Dump leap years.
-y with -S and -E
- find_longest_and_shortest_days(options)[source]
Find the longest and shortest days from year -1842 to 1161.
-d and -S and -E
The shortest and longest days are:
First occurrence¶
((-1842, 1, 1), (23, 59, 40.9056), (-344, 19, 1), (24, 0, 2.16)) 2024-10-30 15:53:02.883745 -> 2024-10-30 16:45:24.637078 52 minutes, 21 seconds, 753333 microseconds
Last occurrence¶
((-1744, 19, 1), (23, 59, 40.9056), (-261, 11, 9), (24, 0, 2.16)) 2024-10-30 21:22:48.037574 -> 2024-10-30 22:14:48.889369 52 minutes, 0 seconds, 851795 microseconds
- find_weekdays(options)[source]
Find weekdays between provided years.
-e and -S and -E -C to not use coefficients.
- twenty_four_hours(options)[source]
Dump the hours, minutes, and seconds of the day.
-t and -S and -E
- contrib.misc.badi_jd_tests.fmt_float(value, left=4, right=4, leading_zero=False)[source]
Format one float so that it is visually centered on the decimal point.
- Parameters:
value (float | int | str) – The number to format.
left (int) – Width to reserve on the left of the decimal (including any minus sign).
right (int) – Number of digits to show after the decimal.