Open bhavishyagoyal12 opened 1 year ago
simplified example, not complete
# set swe flags from main settings (sidereal zodiac, ayanamsa, houses) &
# from miscellaneous settings (nutation, true positions) etc
flags = swe.FLG_SPEED # calculate speed of planets
# sidereal or tropical zodiac
if props.sidereal_zodiac:
flags |= swe.FLG_SIDEREAL # | -> or'ed aka added to flags
if not props.nutation:
flags |= swe.FLG_NONUT
if props.heliocentric:
flags |= swe.FLG_HELCTR # add this flag / constant for heliocentric positions
if props.true_positions:
flags |= swe.FLG_TRUEPOS
if props.topocentric:
flags |= swe.FLG_TOPOCTR
if props.equatorial:
flags |= swe.FLG_EQUATORIAL
if props.radians:
flags |= swe.FLG_RADIANS
if props.cartesian:
flags |= swe.FLG_XYZ
...
# calculate positions for main planets / objects
# you use flags ie inside swe.calc_ut() function, and some other functions
for i in range(0, 12): # constants, ie swe.SUN = 0 ... swe.PLUTO = 9 etc
xx, retflags = swe.calc_ut(jd_ut_1, i, flags)
name = swe.get_planet_name(i)
deg, min, sec, secfr, sign = swe.split_deg(
xx[0], # longitude decimal, we are now converting it into degree-minute-second-sign
swe.SPLIT_DEG_ROUND_SEC
| swe.SPLIT_DEG_ZODIACAL
| swe.SPLIT_DEG_KEEP_SIGN
| swe.SPLIT_DEG_KEEP_DEG,
)
sign += 1
if name == "Sun":
[your code here, ie xx[0] = sun longitude decimal, xx[1] = sun latitude decimal etc; see documentation]
# also some house functions require flags, ie if one needs sidereal (jyotisa) houses
# houses flags : 0 or FLG_SIDEREAL or FLG_RADIANS or FLG_NONUT
# houses_ex returns : cusps (12) & ascmc (8) : 0 asc | 1 mc | 2 armc |
# 3 vertex | 4 equatorial asc | 5 co-asc (koch) | 6 co-asc (munkasey) |
# 7 polar asc (munkasey)
houses, ascmc = swe.houses_ex(jd_ut_1, lat_1, lon_1, house_byte, flags)
# print(f"houses : {houses}")
# print(f"ascmc : {ascmc}")
# we just need 1 longitude per 2 houses, since they are opposite (180°)
house_1 = houses[0] # asc & dsc - as sign-deg-min-sec
house_10 = houses[9] # mc & ic - as sign-deg-min-sec
house_8 = houses[7] # house 2 & 8 - as degree decimal
house_9 = houses[8] # house 3 & 9 - as degree decimal
house_11 = houses[10] # house 5 & 11 - as degree decimal
house_12 = houses[11] # house 6 & 12 - as degree decimal
# ascendant
deg_asc, min_asc, sec_asc, secfr_asc, sign_asc = swe.split_deg(
house_1, # or ascmc[0] = the same, mc aka 10th house aka midheaven = ascmc[1]
swe.SPLIT_DEG_ROUND_SEC
etc
)
...
long live pyswisseph
have fun aum
In case i want to change observer position to helio . How can i do in library ? on following page it's shown you can pass -helio but not sure how to pass that ?
https://www.astro.com/cgi/swetest.cgi?arg=-h&p=0