Last active
September 20, 2015 00:09
-
-
Save ShadowKyogre/b15b313ba51aa452b79f to your computer and use it in GitHub Desktop.
Swisseph routine to calculate VoC. Pardon me for being lazy for not copypastaing the functions from chronoslnx that it's using in here
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from chronoslnxlib.core import * | |
def predict_voc(cur_date): | |
cycles = date_to_moon_cycles(cur_date) | |
moon_pos = swisseph.calc_ut(datetime_to_julian(cur_date), swisseph.MOON)[0] | |
closest_sign = (( moon_pos // 30 ) + 1) * 30 | |
lower_sign = ( moon_pos // 30 ) * 30 | |
#print(moon_pos, closest_sign) | |
lower_cycles = cycles+(angle_sub(lower_sign, moon_pos)/360) | |
cycles += (closest_sign - moon_pos) / 360 | |
diff = float('inf') | |
#print(cycles) | |
while abs(diff) >= 1E-8: | |
closest_sign_estimate = swisseph.calc_ut(moon_cycles_to_jul(cycles), swisseph.MOON)[0] | |
#print(moon_pos, closest_sign_estimate, cycles) | |
diff = angle_sub(closest_sign, closest_sign_estimate) | |
cycles += (diff / 360) | |
# | |
diff = float('inf') | |
while abs(diff) >= 1E-8: | |
closest_sign_estimate2 = swisseph.calc_ut(moon_cycles_to_jul(lower_cycles), swisseph.MOON)[0] | |
diff = angle_sub(lower_sign, closest_sign_estimate2) | |
lower_cycles += (diff / 360) | |
voc_cycles = cycles | |
#voc_cycles -= (1 / 36000) | |
has_aspects = False | |
# | |
other_planets = [swisseph.SUN, swisseph.MERCURY, swisseph.VENUS, | |
swisseph.MARS, swisseph.JUPITER, swisseph.SATURN, | |
swisseph.NEPTUNE, swisseph.PLUTO] | |
# | |
while (not has_aspects) and (voc_cycles > lower_cycles): | |
voc_cycles -= (1 / 36000) | |
julified = moon_cycles_to_jul(voc_cycles) | |
#print(revjul_to_datetime(swisseph.revjul(julified))) | |
moon_pos = swisseph.calc_ut(julified, swisseph.MOON)[0] | |
# | |
for i,planet in enumerate(other_planets): | |
other_angle = swisseph.calc_ut(julified, planet)[0] | |
for angle in (0, 60, 90, 120, 180): | |
#print(moon_pos, angle, swisseph.get_planet_name(planet), other_angle) | |
angle_gap = abs(angle_sub(moon_pos, other_angle)) | |
#print("angle gap:", angle_gap) | |
#print("how far:", angle_sub(angle, angle_gap)) | |
if abs(angle_sub(angle, angle_gap)) <= 5E-3: | |
print("Found start of VOC with", i, "@", angle, angle_gap) | |
has_aspects = True | |
break | |
#print("---") | |
# | |
#print(lower_sign, moon_pos, closest_sign) | |
#print( (not has_aspects), (voc_cycles > lower_cycles) ) | |
else: | |
if not has_aspects: | |
print("Couldn't find VOC") | |
return revjul_to_datetime(swisseph.revjul(moon_cycles_to_jul(voc_cycles))), moon_pos, \ | |
revjul_to_datetime(swisseph.revjul(moon_cycles_to_jul(cycles))), closest_sign_estimate, closest_sign_estimate2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment