Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- from datetime import datetime
- import time
- def calculate_arabic_part(degrees, minutes, seconds):
- total_degrees = degrees + (minutes / 60) + (seconds / 3600)
- arabic_part = (total_degrees + 180) % 360
- return arabic_part
- def calculate_sun_arabic_part(day, month, year, hour, minute, second):
- jd = get_julian_day(day, month, year)
- t = get_julian_century(jd)
- l = get_mean_longitude(t, "Sun")
- p = get_mean_anomaly(t, "Sun")
- return calculate_arabic_part(l, 0, 0) + calculate_arabic_part(p, 0, 0) - calculate_arabic_part(l, 0, 0)
- def calculate_moon_arabic_part(day, month, year, hour, minute, second):
- jd = get_julian_day(day, month, year)
- t = get_julian_century(jd)
- l = get_mean_longitude(t, "Moon")
- p = get_mean_anomaly(t, "Moon")
- return calculate_arabic_part(l, 0, 0) + calculate_arabic_part(p, 0, 0) - calculate_arabic_part(l, 0, 0)
- def calculate_venus_arabic_part(day, month, year, hour, minute, second):
- jd = get_julian_day(day, month, year)
- t = get_julian_century(jd)
- l = get_mean_longitude(t, "Venus")
- p = get_mean_anomaly(t, "Venus")
- return calculate_arabic_part(l, 0, 0) + calculate_arabic_part(p, 0, 0) - calculate_arabic_part(l, 0, 0)
- def calculate_mars_arabic_part(day, month, year, hour, minute, second):
- jd = get_julian_day(day, month, year)
- t = get_julian_century(jd)
- l = get_mean_longitude(t, "Mars")
- p = get_mean_anomaly(t, "Mars")
- return calculate_arabic_part(l, 0, 0) + calculate_arabic_part(p, 0, 0) - calculate_arabic_part(l, 0, 0)
- def calculate_mercury_arabic_part(day, month, year, hour, minute, second):
- jd = get_julian_day(day, month, year)
- t = get_julian_century(jd)
- l = get_mean_longitude(t, "Mercury")
- p = get_mean_anomaly(t, "Mercury")
- return calculate_arabic_part(l, 0, 0) + calculate_arabic_part(p, 0, 0) - calculate_arabic_part(l, 0, 0)
- def calculate_saturn_arabic_part(day, month, year, hour, minute, second):
- jd = get_julian_day(day, month, year)
- t = get_julian_century(jd)
- l = get_mean_longitude(t, "Saturn")
- p = get_mean_anomaly(t, "Saturn")
- return calculate_arabic_part(l, 0, 0) + calculate_arabic_part(p, 0, 0) - calculate_arabic_part(l, 0, 0)
- def calculate_uranus_arabic_part(day, month, year, hour, minute, second):
- jd = get_julian_day(day, month, year)
- t = get_julian_century(jd)
- l = get_mean_longitude(t, "Uranus")
- p = get_mean_anomaly(t, "Uranus")
- return calculate_arabic_part(l, 0, 0) + calculate_arabic_part(p, 0, 0) - calculate_arabic_part(l, 0, 0)
- def calculate_jupiter_arabic_part(day, month, year, hour, minute, second):
- jd = get_julian_day(day, month, year)
- t = get_julian_century(jd)
- l = get_mean_longitude(t, "Jupiter")
- p = get_mean_anomaly(t, "Jupiter")
- return calculate_arabic_part(l, 0, 0) + calculate_arabic_part(p, 0, 0) - calculate_arabic_part(l, 0, 0)
- def get_mean_longitude(t, planet):
- if planet == "Sun":
- return (280.4664567 + (360007.6982779 * t) + (0.03032028 * math.pow(t, 2)) + (1/49931 * math.pow(t, 3)) - (1/15299 * math.pow(t, 4)) - (1/1988000 * math.pow(t, 5))) % 360
- elif planet == "Moon":
- return (218.3165 + (481267.8813 * t) - (0.0013268 * math.pow(t, 2)) + (math.pow(t, 3) / 538841) - (math.pow(t, 4) / 65194000)) % 360
- elif planet == "Venus":
- return (280.461 + (58519.813 * t) + (0.0002447095833333 * math.pow(t, 2))) % 360
- elif planet == "Mars":
- return (352.8840 + (35999.0498 * t) - (0.0001536 * math.pow(t, 2))) % 360
- elif planet == "Mercury":
- return (281.22083333 + (149472.67486623 * t) + (0.000005379 * math.pow(t, 2)) - (0.00000000273 * math.pow(t, 3))) % 360
- elif planet == "Uranus":
- return (314.20666 + (54.950137 * t) - (0.0015786 * math.pow(t, 2))) % 360
- elif planet == "Jupiter":
- return (219.991069 + (3034.066573 * t) - (0.0084479 * math.pow(t, 2))) % 360
- elif planet == "Saturn":
- return (38.907060 + (1186.607332 * t) - (0.001592 * math.pow(t ,2 ))) % 360
- def get_mean_anomaly(t, planet):
- if planet == "Sun":
- return (357.5291 + (35999.0503 * t) - (0.0001559 * math.pow(t, 2)) - (0.00000048 * math.pow(t, 3))) % 360
- elif planet == "Moon":
- return (134.9634 + (477198.8675 * t) + (0.0088553 * math.pow(t, 2)) + (math.pow(t, 3) / 69699) - (math.pow(t, 4) / 14712000)) % 360
- elif planet == "Venus":
- return (50.341 + (58519.813 * t) + (0.0005451041666667 * math.pow(t, 2)) % 360)
- elif planet == "Mars":
- return (319.5294 + (19139.8585 * t) + (0.0001815 * math.pow(t, 2))) % 360
- elif planet == "Mercury":
- return (174.215556 + (149472.67486623 * t) + (0.000005378 * math.pow(t, 2)) + (0.00000000274 * math.pow(t, 3))) % 360
- elif planet == "Uranus":
- return (210.3313 + (54.950137 * t)) % 360
- elif planet == "Jupiter":
- return (239.9242 + (3034.0660 * t) - (0.0080197 * math.pow(t, 2))) % 360
- elif planet == "Saturn":
- return (206.1082 + (1186.607 * t) - (0.0014680 * math.pow(t, 2)) + (22.7449 * math.sin(682.600 * t -0.557))) % 360
- def get_julian_day(day, month, year):
- if month <= 2:
- year -= 1
- month += 12
- a = math.floor(year / 100)
- b = 2 - a + math.floor(a / 4)
- return math.floor(365.25 * (year + 4716)) + math.floor(30.6001 * (month + 1)) + day + b - 1524.5
- def get_julian_century(jd):
- return (jd - 2451545) / 36525
- # Example usage:
- while True:
- now = datetime.now()
- day = now.day
- month = now.month
- year = now.year
- hour = now.hour
- minute = now.minute
- second = now.second
- sun_arabic_part = calculate_sun_arabic_part(day, month, year, hour, minute, second)
- moon_arabic_part = calculate_moon_arabic_part(day, month, year, hour, minute, second)
- venus_arabic_part = calculate_venus_arabic_part(day, month, year, hour, minute, second)
- mars_arabic_part = calculate_mars_arabic_part(day, month, year, hour, minute, second)
- mercury_arabic_part = calculate_mercury_arabic_part(day, month, year, hour, minute, second)
- saturn_arabic_part = calculate_saturn_arabic_part(day, month, year, hour, minute, second)
- uranus_arabic_part = calculate_uranus_arabic_part(day, month, year, hour, minute, second)
- jupiter_arabic_part = calculate_jupiter_arabic_part(day, month, year, hour, minute, second)
- print(f"Sun Arabic Part: {sun_arabic_part}")
- print(f"Moon Arabic Part: {moon_arabic_part}")
- print(f"Venus Arabic Part:{venus_arabic_part}")
- print(f"Mars Arabic Part: {mars_arabic_part}")
- print(f"Mercury Arabic Part: {mercury_arabic_part}")
- print(f"Saturn Arabic Part:{saturn_arabic_part}")
- print(f"Uranus Arabic Part:{uranus_arabic_part}")
- print(f"Jupiter Arabic Part:{jupiter_arabic_part}")
- # Wait 5 seconds and recalculate
- time.sleep(5)
- print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement