Last active
September 15, 2023 09:05
-
-
Save EH30/6133342b67827e14add07a37b5cfb941 to your computer and use it in GitHub Desktop.
python pyswisseph calculate planets rashi or zodiac signs
This file contains 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
import swisseph as swe | |
# pyswisseph version used 2.10.3.2 | |
def planets_rashi(year, month, day, hour, minute, second, latitude, longitude, tzoffset): | |
""" | |
This is a simple python script to calculate planets and rashi | |
""" | |
swe.set_sid_mode(swe.SIDM_LAHIRI, 0, 0) # Set the Ayanamsa | |
flags = swe.FLG_SWIEPH + swe.FLG_SPEED + swe.FLG_SIDEREAL | |
utcc = swe.utc_time_zone(year, month, day, hour, minute, second, tzoffset) | |
jdet, jdut = swe.utc_to_jd(utcc[0], utcc[1], utcc[2], utcc[3],utcc[4], utcc[5]) | |
planets = { | |
"SUN": swe.SUN, "MOON": swe.MOON, "MERCURY": swe.MERCURY, "VENUS": swe.VENUS, | |
"MARS": swe.MARS, "JUPITER":swe.JUPITER, "SATURN": swe.SATURN, "RAHU": 10 | |
} | |
cusps, ascmc = swe.houses_ex(jdut, latitude, longitude, b'B', flags) | |
ascendant = ascmc[0] | |
output = {} | |
output["ASC"] = [int(ascendant/30)+1, ascendant] | |
for planet in planets: | |
xx, ret = swe.calc_ut(jdut, planets[planet], flags) | |
rashi_number = xx[0] / 30 | |
output[planet] = [int(rashi_number)+1] | |
output["KETU"] = [output["RAHU"][0]+6 if output["RAHU"][0]+6 <= 12 else output["RAHU"][0]+6-12] | |
swe.close() | |
return output | |
if __name__ == "__main__": | |
# Year: 2009 Month: 3 Day: 3 Hour: 6 Minute 30 Second: 0 Latitude 19.0760 Longitude: 72.8777 tzoffset=5.5 (5.5 for Indian Standard Time) | |
output = planets_rashi(2009, 3, 3, 6, 30, 0, 19.0760, 72.8777, tzoffset=5.5) | |
for planet in output: | |
print("{0}:{1}".format(planet, output[planet][0])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment