Exemplo n.º 1
0
	def __init__(self, tjd_ut, pId, flag, lat = None, ascmc2 = None, raequasc = None, ecl = None, equ = None, nolat = False, obl = 0.0):
		self.pId = pId

		self.speculums = None

		if (ecl == None):
			self.data = swisseph.calc_ut(tjd_ut, pId, flag)
			self.dataEqu = swisseph.calc_ut(tjd_ut, pId, flag+astrology.SEFLG_EQUATORIAL)

			# data[0] : longitude
			# data[1] : latitude
			# data[2] : distance
			# data[3] : speed in long
			# data[4] : speed in lat
			# data[5] : speed in dist

			# if rflag < 0:
			#	print 'Error: %s' % serr

			self.name = swisseph.get_planet_name(pId)
		else:
			self.data = tuple(ecl)
			self.dataEqu = tuple(equ)
			self.name = 'DescNode'

		if nolat:
			self.data = (self.data[Planet.LONG], 0.0, self.data[Planet.DIST], self.data[Planet.SPLON], self.data[Planet.SPLAT], self.data[Planet.SPDIST])
			ra, decl, dist = swisseph.cotrans(self.data[Planet.LONG], 0.0, 1.0, -obl)
			self.dataEqu = (ra, decl, self.dataEqu[Planet.DISTEQU], self.dataEqu[Planet.SPRAEQU], self.dataEqu[Planet.SPDECLEQU], self.dataEqu[Planet.SPDISTEQU])

		if lat != None:
			#placspec.py and regiospec should be used instead, remove these!
			self.speculums = []
			self.computePlacidianSpeculum(lat, ascmc2)
			self.computeRegiomontanSpeculum(lat, ascmc2, raequasc)
Exemplo n.º 2
0
    def __init__(self, tjd_ut, aId, flag):
        self.aId = aId

        self.data = swisseph.calc_ut(tjd_ut, aId, flag)[0]
        self.dataEqu = swisseph.calc_ut(tjd_ut, aId,
                                        flag + astrology.SEFLG_EQUATORIAL)[0]
        self.name = swisseph.get_planet_name(aId)
Exemplo n.º 3
0
 def __init__(self, index, chart):
     self.index = index
     self.name = swe.get_planet_name(index)
     self.chart = chart
     self.field = self.get_field_name(self.name)
     if hasattr(chart, self.field):
         self.angle = getattr(chart, self.field)
         self.sign = SIGN_NAMES[int(self.angle / 30) % 12]
Exemplo n.º 4
0
    def calc_planets(self):
        planets = AttrDict()
        for i in range(10):
            angle = swisseph.calc_ut(self.birth_julian, i)[0]
            planets[swisseph.get_planet_name(i).lower()] = angle

            if i == 0:  # Add earth
                angle = swisseph.calc_ut(self.birth_julian, AstroChart.SUN)[0]
                angle = self.get_opposite_angle(angle)
                planets[swisseph.get_planet_name(
                    AstroChart.EARTH).lower()] = angle
            elif i == 1:  # Add nodes
                angle = swisseph.calc_ut(self.birth_julian,
                                         AstroChart.TRUE_NODE)[0]
                planets['north node'] = angle
                planets['south node'] = self.get_opposite_angle(angle)

        for name, angle in planets.items():
            setattr(self, name, angle)
        return planets
Exemplo n.º 5
0
def check_bodies_in_any_range(bodies, ranges):
    for id in bodies:
        try:
            long = sweph.calc_ut(jd_now(), id, sweph.FLG_SWIEPH)[0]
        except sweph.Error as e:
            print("id %d doesn't exist: %s" % (id, e))
            next
        for range in ranges:
            if long > range[0] and long < range[1]:
                sign_idx = int(long / 30)
                deg = long - sign_idx*30
                print("%d %s: %d %s" % (id-sweph.AST_OFFSET, sweph.get_planet_name(id), deg, signs[sign_idx]))
Exemplo n.º 6
0
def state_to_string(state_line, planet):
    name = swisseph.get_planet_name(planet)
    if state_line[1] == "New" or state_line[1] == "Full":
        state = "%s %s" % (state_line[1], name)
    elif state_line[1] == "Quarter":
        if state_line[0] == "Waning":
            state = "Last %s %s" % (state_line[1], name)
        else:
            state = "First %s %s" % (state_line[1], name)
    else:
        state = "%s %s %s" % (state_line[0], state_line[1], name)
    swisseph.close()
    return state
Exemplo n.º 7
0
def state_to_string(state_line, planet):
	name = swisseph.get_planet_name(planet)
	if state_line[1] == "New" or state_line[1] == "Full":
		state = "%s %s" %(state_line[1], name)
	elif state_line[1] == "Quarter":
		if state_line[0] == "Waning":
			state = "Last %s %s" %(state_line[1], name)
		else:
			state = "First %s %s" %(state_line[1], name)
	else:
		state = "%s %s %s" %(state_line[0], state_line[1], name)
	swisseph.close()
	return state
Exemplo n.º 8
0
def check_bodies_in_any_range(bodies, ranges):
    for id in bodies:
        try:
            long = sweph.calc_ut(jd_now(), id, sweph.FLG_SWIEPH)[0]
        except sweph.Error as e:
            print("id %d doesn't exist: %s" % (id, e))
            next
        for range in ranges:
            if long > range[0] and long < range[1]:
                sign_idx = int(long / 30)
                deg = long - sign_idx * 30
                print("%d %s: %d %s" %
                      (id - sweph.AST_OFFSET, sweph.get_planet_name(id), deg,
                       signs[sign_idx]))
Exemplo n.º 9
0
def loc_of_planet(planet, start, end, freq='1D', scale=1, fit360=False):
    """Calculate the locations of planet within a time span.

        parameters:

        planet: the planet variable in swisseph
        start, end: the time span
        freq: the calculation freq
        scale: mulitply the planet location

        return a pandas Series with planet location

    """

    results = []
    drange = pd.date_range(start, end, freq=freq, tz='utc')

    for date in drange:
        year   = date.year
        month  = date.month
        day    = date.day
        hour   = date.hour
        minute = date.minute
        second = date.second

        jd = swe.utc_to_jd(year, month, day, hour, minute, second, 1)
        ut = jd[1]

        loc = swe.calc_ut(ut, planet)

        results.append(loc[0]*scale)

    res = pd.Series(results, drange, name=swe.get_planet_name(planet))

    if scale > 1 and fit360:
        return res.apply(_fit360)

    return res
Exemplo n.º 10
0
def loc_of_planet(planet, start, end, freq='1D', scale=1, fit360=False):
    """Calculate the locations of planet within a time span.

        parameters:

        planet: the planet variable in swisseph
        start, end: the time span
        freq: the calculation freq
        scale: mulitply the planet location

        return a pandas Series with planet location

    """

    results = []
    drange = pd.date_range(start, end, freq=freq, tz='utc')

    for date in drange:
        year = date.year
        month = date.month
        day = date.day
        hour = date.hour
        minute = date.minute
        second = date.second

        jd = swe.utc_to_jd(year, month, day, hour, minute, second, 1)
        ut = jd[1]

        loc = swe.calc_ut(ut, planet)

        results.append(loc[0] * scale)

    res = pd.Series(results, drange, name=swe.get_planet_name(planet))

    if scale > 1 and fit360:
        return res.apply(_fit360)

    return res
Exemplo n.º 11
0
Arquivo: qa.py Projeto: musalisa/se


### CARTA Z #################################
#print( "\nCuspidi dei segni")
grado_z = 180 - AOHOR
cx = 350
cy = 350
z1 = 200
z2 = 300
#for i in range(0, 360, 30):
	##print (grado_z+i, math.cos(math.radians(grado_z+i))*80, math.sin(math.radians(grado_z+i))*80,math.cos(math.radians(grado_z+i))*100, math.sin(math.radians(grado_z+i))*100);
	#print ( "{ x1:", (math.cos(math.radians(grado_z+i)) * z1) + cx, ",")
	#print ( "  y1:", (math.sin(math.radians(grado_z+i)) * -z1) + cy, ",")
	#print ( "  x2:", (math.cos(math.radians(grado_z+i)) * z2) + cx, ",")
	#print ( "  y2:", (math.sin(math.radians(grado_z+i)) * -z2) + cy, "\n},")

#print(swe_houses)
print( "\nPIANETI - Eclittiche ed equatoriali")
for p in range( 0,7 ):
	print( "\n" + swe.get_planet_name( p ))
	print("lamda %.4f beta %4f" %  (swe.calc_ut( jut, p, swe.FLG_SPEED )[0],swe.calc_ut( jut, p, swe.FLG_SPEED )[1] ))
	print("alfa %.4f delta %4f" %  (swe.calc_ut( jut, p, swe.FLG_EQUATORIAL )[0],swe.calc_ut( jut, p, swe.FLG_EQUATORIAL )[1] ))


#print(swe.houses_ex(jut, top_lat, top_long, b'P'))
#        Calculate houses cusps (UT).
#       
#        Args: float julday, float lat, float lon, char hsys='P'
#        Return: 2 tuples of 12 and 8 float (cusps, ascmc) (except Gauquelin)
Exemplo n.º 12
0
def body_name(body):
    """Return the body name"""
    if swe.get_planet_name(body) == 'mean Node':
        return 'Rahu'
    return swe.get_planet_name(body)
Exemplo n.º 13
0
    # Preserves the input request if asked for it (with "re").
    # Possibly also debug data, time metrics, etc.
    if "extra" in re and re["extra"]:
        for (add, conf) in re["extra"].iteritems():
            if add == "re":
                e["0"][add] = re
                if "except" in re["extra"][add]:
                    for minus in re["extra"][add]["except"]:
                        del e["0"][add][minus]
    else:
        del e["0"]

    # Print to STDOUT.
    # JSON is the default (not even checked).
    out = re["out"] if "out" in re else "json"
    if out == "print":
        print (e)
    elif out == "pprint":
        for (what, offset) in {"1": 0, "2": 10000}.iteritems():
            replace = {}
            if what in e:
                for (key, val) in e[what].iteritems():
                    replace[str(key) + "-" + swe.get_planet_name(key + offset)] = val
                e[what] = replace
        pprint(e)
    else:
        print json.JSONEncoder().encode(e)

    # Necessary when called from Node / Eden.
    sys.stdout.flush()
Exemplo n.º 14
0
def get_signs(date, observer, nodes, axes, prefix=None):
	entries = []
	houses = fill_houses(date, observer)
	day = datetime_to_julian(date)
	obliquity = swisseph.calc_ut(day, swisseph.ECL_NUT)[0]

	cusps, asmc = swisseph.houses(day, observer.lat, observer.lng)

	for i in range(10):
		calcs = swisseph.calc_ut(day, i)
		hom = swisseph.house_pos(asmc[2], observer.lat, obliquity, calcs[0], objlat=calcs[1])
		zm = ActiveZodiacalMeasurement(calcs[0], calcs[1], houses[int(hom-1)], progress=hom % 1.0)
		if i == swisseph.SUN or i == swisseph.MOON:
			retrograde = 'Not Applicable'
		else:
			retrograde = str(calcs[3] < 0)
		planet = Planet(swisseph.get_planet_name(i), prefix=prefix, m=zm, retrograde=retrograde)
		entries.append(planet)
	if nodes: #add node entries
		calcs = swisseph.calc_ut(day, swisseph.TRUE_NODE)
		hom = swisseph.house_pos(asmc[2], observer.lat, obliquity, calcs[0], objlat=calcs[1])
		zm = ActiveZodiacalMeasurement(calcs[0], calcs[1], houses[int(hom-1)], progress=hom % 1.0)
		retrograde = "Always"
		planet = Planet("North Node", prefix=prefix, m=zm, retrograde=retrograde)
		entries.append(planet)

		#do some trickery to display the South Node
		reverse = swisseph.degnorm(calcs[0]+180.0)
		revhouse = (int(hom)+6) % 12
		#revprogress = 1-hom%1.0
		revprogress = hom % 1.0
		zm = ActiveZodiacalMeasurement(reverse, calcs[1], houses[revhouse-1], progress=revprogress)
		planet = Planet("South Node", prefix=prefix ,m=zm, retrograde=retrograde)
		entries.append(planet)
	if axes:
		ascendant = asmc[0]
		descendant = cusps[6]
		mc = asmc[1]
		ic = cusps[3]
		retrograde = 'Not a Planet'

		zm = ActiveZodiacalMeasurement(ascendant, 0.0, houses[0], progress=0.0)
		planet = Planet("Ascendant", prefix=prefix, m=zm, retrograde=retrograde)
		entries.append(planet)

		zm = ActiveZodiacalMeasurement(descendant, 0.0, houses[6], progress=0.0)
		planet = Planet("Descendant", prefix=prefix, m=zm, retrograde=retrograde)
		entries.append(planet)

		zm = ActiveZodiacalMeasurement(mc, 0.0, houses[9], progress=0.0)
		planet = Planet("MC", prefix=prefix, m=zm, retrograde=retrograde)
		entries.append(planet)

		zm = ActiveZodiacalMeasurement(ic, 0.0, houses[3], progress=0.0)
		planet = Planet("IC", prefix=prefix, m=zm, retrograde=retrograde)
		entries.append(planet)

	#if stars:
		#print "Todo"
	swisseph.close()
	return houses, entries
Exemplo n.º 15
0
def search_special_aspects(aspect_table):
    yods = set()
    gt = set()
    gc = set()
    stel = set()
    tsq = set()

    for i in range(10):
        pn = swisseph.get_planet_name(i)

        trine_entries = [y for y in aspect_table if y.isForPlanet(pn) and y.aspect == "trine"]

        square_entries = [y for y in aspect_table if y.isForPlanet(pn) and y.aspect == "square"]

        sextile_entries = [y for y in aspect_table if y.isForPlanet(pn) and y.aspect == "sextile"]

        conjunction_entries = [y for y in aspect_table if y.isForPlanet(pn) and y.aspect == "conjunction"]

        inconjunct_entries = [y for y in aspect_table if y.isForPlanet(pn) and y.aspect == "inconjunct"]

        opposition_entries = [y for y in aspect_table if y.isForPlanet(pn) and y.aspect == "opposition"]

        intersection_entries = []
        intersection_entries2 = []
        intersection_entries3 = []
        intersection_entries4 = []
        intersection_entries5 = []

        if len(trine_entries) > 2:
            for i in range(len(trine_entries) - 1):
                otherp = trine_entries[i].partnerPlanet(pn)
                otherp2 = trine_entries[i + 1].partnerPlanet(pn)
                minitrines = [
                    y for y in aspect_table if y.isForPlanet(otherp) and y.isForPlanet(otherp2) and y.aspect == "trine"
                ]
                if len(minitrines) > 0:
                    intersection_entries.append(trine_entries[i])
                    intersection_entries.append(trine_entries[i + 1])
                for j in minitrines:
                    intersection_entries.append(j)
                if len(intersection_entries) > 2:
                    gt.add(SpecialAspect(intersection_entries, "grand trine"))
                    break

        if len(opposition_entries) > 0:
            for i in range(len(square_entries) - 1):
                otherp = square_entries[i].partnerPlanet(pn)
                otherp2 = square_entries[i + 1].partnerPlanet(pn)
                miniopposition = [
                    y
                    for y in aspect_table
                    if y.isForPlanet(otherp) and y.isForPlanet(otherp2) and y.aspect == "opposition"
                ]
                minisquare = [
                    y
                    for y in aspect_table
                    if (y.isForPlanet(otherp) or y.isForPlanet(otherp2))
                    and y.aspect == "square"
                    and not y.isForPlanet(pn)
                ]
                if len(miniopposition) > 0 and len(minisquare) > 0:
                    intersection_entries2.append(square_entries[i])
                    intersection_entries2.append(square_entries[i + 1])
                    intersection_entries2.append(miniopposition[0])
                    intersection_entries2.append(minisquare[0])
                    if len(intersection_entries2) > 3:
                        gc.add(SpecialAspect(intersection_entries2, "grand cross"))
                        break

        if len(square_entries) > 2:
            for i in range(len(square_entries) - 1):
                otherp = square_entries[i].partnerPlanet(pn)
                otherp2 = square_entries[i + 1].partnerPlanet(pn)
                miniopposition = [
                    y
                    for y in aspect_table
                    if y.isForPlanet(otherp) and y.isForPlanet(otherp2) and y.aspect == "opposition"
                ]
                if len(miniopposition) > 0:
                    intersection_entries3.append(square_entries[i])
                    intersection_entries3.append(square_entries[i + 1])
                for j in miniopposition:
                    intersection_entries3.append(j)
                if len(intersection_entries3) > 2:
                    tsq.add(SpecialAspect(intersection_entries3, "t-square"))
                    break

        if len(conjunction_entries) > 2:
            for n in conjunction_entries:
                # Check for other conjunctions that do not involve the root planet
                if n.planet1 != pn:
                    b = [
                        y
                        for y in aspect_table
                        if y.isForPlanet(n.planet1) and not y.isForPlanet(pn) and y.aspect == "conjunction"
                    ]
                else:
                    b = [
                        y
                        for y in aspect_table
                        if y.isForPlanet(n.planet2) and not y.isForPlanet(pn) and y.aspect == "conjunction"
                    ]
                if len(b) > 0:
                    intersection_entries4.append(n)
                    for j in b:
                        intersection_entries4.append(j)
                    if len(intersection_entries4) > 2:
                        stel.add(SpecialAspect(intersection_entries4, "stellium"))
                        break

        if len(inconjunct_entries) > 1:
            for i in range(len(inconjunct_entries) - 1):
                otherp = inconjunct_entries[i].partnerPlanet(pn)
                otherp2 = inconjunct_entries[i + 1].partnerPlanet(pn)
                minisextiles = [
                    y
                    for y in aspect_table
                    if y.isForPlanet(otherp) and y.isForPlanet(otherp2) and y.aspect == "sextile"
                ]
                if len(minisextiles) > 0:
                    intersection_entries5.append(inconjunct_entries[i])
                    intersection_entries5.append(inconjunct_entries[i + 1])
                for j in minisextiles:
                    intersection_entries5.append(j)
                if len(intersection_entries5) > 2:
                    yods.add(SpecialAspect(intersection_entries5, "yod"))
                    break

                # remove stelliums contained in stelliums that
                # involve the same planets

    if len(stel) > 1:
        for i in stel.copy():
            for j in stel.copy():
                if j.contains(i):
                    stel.remove(i)
                    break

                # remove redundant entries in tsq that are described in gc
    if len(tsq) > 0:
        for i in tsq.copy():
            for j in gc:
                if j.contains(i):
                    tsq.remove(i)
                    break

    return yods, gt, gc, stel, tsq
Exemplo n.º 16
0
def get_signs(date, observer, nodes, axes, prefix=None):
    entries = []
    houses = fill_houses(date, observer)
    day = datetime_to_julian(date)
    obliquity = swisseph.calc_ut(day, swisseph.ECL_NUT)[0]

    cusps, asmc = swisseph.houses(day, observer.lat, observer.lng)

    for i in range(10):
        calcs = swisseph.calc_ut(day, i)
        hom = swisseph.house_pos(asmc[2], observer.lat, obliquity, calcs[0], objlat=calcs[1])
        zm = ActiveZodiacalMeasurement(calcs[0], calcs[1], houses[int(hom - 1)], progress=hom % 1.0)
        if i == swisseph.SUN or i == swisseph.MOON:
            retrograde = "Not Applicable"
        else:
            retrograde = str(calcs[3] < 0)
        planet = Planet(swisseph.get_planet_name(i), prefix=prefix, m=zm, retrograde=retrograde)
        entries.append(planet)
    if nodes:  # add node entries
        calcs = swisseph.calc_ut(day, swisseph.TRUE_NODE)
        hom = swisseph.house_pos(asmc[2], observer.lat, obliquity, calcs[0], objlat=calcs[1])
        zm = ActiveZodiacalMeasurement(calcs[0], calcs[1], houses[int(hom - 1)], progress=hom % 1.0)
        retrograde = "Always"
        planet = Planet("North Node", prefix=prefix, m=zm, retrograde=retrograde)
        entries.append(planet)

        # do some trickery to display the South Node
        reverse = swisseph.degnorm(calcs[0] + 180.0)
        revhouse = (int(hom) + 6) % 12
        # revprogress = 1-hom%1.0
        revprogress = hom % 1.0
        zm = ActiveZodiacalMeasurement(reverse, calcs[1], houses[revhouse - 1], progress=revprogress)
        planet = Planet("South Node", prefix=prefix, m=zm, retrograde=retrograde)
        entries.append(planet)
    if axes:
        ascendant = asmc[0]
        descendant = cusps[6]
        mc = asmc[1]
        ic = cusps[3]
        retrograde = "Not a Planet"

        zm = ActiveZodiacalMeasurement(ascendant, 0.0, houses[0], progress=0.0)
        planet = Planet("Ascendant", prefix=prefix, m=zm, retrograde=retrograde)
        entries.append(planet)

        zm = ActiveZodiacalMeasurement(descendant, 0.0, houses[6], progress=0.0)
        planet = Planet("Descendant", prefix=prefix, m=zm, retrograde=retrograde)
        entries.append(planet)

        zm = ActiveZodiacalMeasurement(mc, 0.0, houses[9], progress=0.0)
        planet = Planet("MC", prefix=prefix, m=zm, retrograde=retrograde)
        entries.append(planet)

        zm = ActiveZodiacalMeasurement(ic, 0.0, houses[3], progress=0.0)
        planet = Planet("IC", prefix=prefix, m=zm, retrograde=retrograde)
        entries.append(planet)

        # if stars:
        # print "Todo"
    swisseph.close()
    return houses, entries
Exemplo n.º 17
0
def search_special_aspects(aspect_table):
	yods = set()
	gt = set()
	gc = set()
	stel = set()
	tsq = set()

	for i in range(10):
		pn = swisseph.get_planet_name(i)

		trine_entries = [y for y in aspect_table \
		                 if y.isForPlanet(pn) and y.aspect == 'trine']

		square_entries = [y for y in aspect_table 
		                  if y.isForPlanet(pn) and y.aspect  == 'square']

		sextile_entries = [y for y in aspect_table \
		                   if y.isForPlanet(pn) and y.aspect  == 'sextile']

		conjunction_entries = [y for y in aspect_table \
		                       if y.isForPlanet(pn) and y.aspect  == 'conjunction']

		inconjunct_entries = [y for y in aspect_table \
		                      if y.isForPlanet(pn) and y.aspect  == 'inconjunct']

		opposition_entries = [y for y in aspect_table \
		                      if y.isForPlanet(pn) and y.aspect  == 'opposition']

		intersection_entries = []
		intersection_entries2 = []
		intersection_entries3 = []
		intersection_entries4 = []
		intersection_entries5 = []

		if len(trine_entries) > 2:
			for i in range(len(trine_entries)-1):
				otherp = trine_entries[i].partnerPlanet(pn)
				otherp2 = trine_entries[i+1].partnerPlanet(pn)
				minitrines = [y for y in aspect_table \
					if y.isForPlanet(otherp) and y.isForPlanet(otherp2) \
					and y.aspect == 'trine']
				if len(minitrines) > 0:
					intersection_entries.append(trine_entries[i])
					intersection_entries.append(trine_entries[i+1])
				for j in minitrines:
					intersection_entries.append(j)
				if len(intersection_entries) > 2:
					gt.add(SpecialAspect(intersection_entries, 'grand trine'))
					break

		if len(opposition_entries) > 0:
			for i in range(len(square_entries)-1):
				otherp = square_entries[i].partnerPlanet(pn)
				otherp2 = square_entries[i+1].partnerPlanet(pn)
				miniopposition = [y for y in aspect_table \
				                  if y.isForPlanet(otherp) and y.isForPlanet(otherp2) \
				                  and y.aspect == 'opposition']
				minisquare = [y for y in aspect_table \
				              if (y.isForPlanet(otherp) or y.isForPlanet(otherp2)) \
				              and y.aspect == "square" \
				              and not y.isForPlanet(pn)]
				if len(miniopposition) > 0 and len(minisquare) > 0:
					intersection_entries2.append(square_entries[i])
					intersection_entries2.append(square_entries[i+1])
					intersection_entries2.append(miniopposition[0])
					intersection_entries2.append(minisquare[0])
					if len(intersection_entries2) > 3:
						gc.add(SpecialAspect(intersection_entries2, 'grand cross'))
						break

		if len(square_entries) > 2:
			for i in range(len(square_entries)-1):
				otherp = square_entries[i].partnerPlanet(pn)
				otherp2 = square_entries[i+1].partnerPlanet(pn)
				miniopposition = [y for y in aspect_table \
				                if y.isForPlanet(otherp) and y.isForPlanet(otherp2) \
				                and y.aspect == 'opposition']
				if len(miniopposition) > 0:
					intersection_entries3.append(square_entries[i])
					intersection_entries3.append(square_entries[i+1])
				for j in miniopposition:
					intersection_entries3.append(j)
				if len(intersection_entries3) > 2:
					tsq.add(SpecialAspect(intersection_entries3, 't-square'))
					break

		if len(conjunction_entries) > 2:
			for n in conjunction_entries:
				#Check for other conjunctions that do not involve the root planet
				if n.planet1 != pn:
					b=[y for y in aspect_table \
					   if y.isForPlanet(n.planet1) and not y.isForPlanet(pn) \
					   and y.aspect == 'conjunction']
				else:
					b=[y for y in aspect_table \
					   if y.isForPlanet(n.planet2) and not y.isForPlanet(pn) \
					   and y.aspect == 'conjunction']
				if len(b) > 0:
					intersection_entries4.append(n)
					for j in b:
						intersection_entries4.append(j)
					if len(intersection_entries4) > 2:
						stel.add(SpecialAspect(intersection_entries4, 'stellium'))
						break

		if len(inconjunct_entries) > 1:
			for i in range(len(inconjunct_entries)-1):
				otherp=inconjunct_entries[i].partnerPlanet(pn)
				otherp2=inconjunct_entries[i+1].partnerPlanet(pn)
				minisextiles=[y for y in aspect_table \
					          if y.isForPlanet(otherp) and y.isForPlanet(otherp2) \
					          and y.aspect == 'sextile']
				if len(minisextiles) > 0:
					intersection_entries5.append(inconjunct_entries[i])
					intersection_entries5.append(inconjunct_entries[i+1])
				for j in minisextiles:
					intersection_entries5.append(j)
				if len(intersection_entries5) > 2:
					yods.add(SpecialAspect(intersection_entries5, 'yod'))
					break

	#remove stelliums contained in stelliums that
	#involve the same planets

	if len(stel) > 1:
		for i in stel.copy():
			for j in stel.copy():
				if j.contains(i):
					stel.remove(i)
					break

	#remove redundant entries in tsq that are described in gc
	if len(tsq) > 0:
		for i in tsq.copy():
			for j in gc:
				if j.contains(i):
					tsq.remove(i)
					break

	return yods, gt, gc, stel, tsq
Exemplo n.º 18
0
 def get_planet_name(self, index):
     if isinstance(index, int):
         return swe.get_planet_name(index)
     return BodyPos.OTHER_BODIES[self.code]
Exemplo n.º 19
0
 def name(self):
     return sweph.get_planet_name(self.id)
Exemplo n.º 20
0
 def name(self):
     return sweph.get_planet_name(self.id)
Exemplo n.º 21
0
    # Preserves the input request if asked for it (with "re").
    # Possibly also debug data, time metrics, etc.
    if "extra" in re and re["extra"]:
      for (add, conf) in re["extra"].iteritems():
        if add == "re":
          e["0"][add] = re
          if "except" in re["extra"][add]:
            for minus in re["extra"][add]["except"]:
              del e["0"][add][minus]
    else:
      del e["0"]

    # Print to STDOUT.
    # JSON is the default (not even checked).
    out = re["out"] if "out" in re else "json"
    if out == "print":
      print(e)
    elif out == "pprint":
      for (what, offset) in {"1": 0, "2": 10000}.iteritems():
        replace = {}
        if what in e:
          for (key, val) in e[what].iteritems():
            replace[str(key) + '-' + swe.get_planet_name(key + offset)] = val
          e[what] = replace
      pprint(e)
    else:
      print json.JSONEncoder().encode(e)

    # Necessary when called from Node / Eden.
    sys.stdout.flush()
Exemplo n.º 22
0
Arquivo: qa.py Projeto: musalisa/se
swe_houses = swe.houses(jut, top_lat, top_long, b'P')

### CARTA Z #################################
#print( "\nCuspidi dei segni")
grado_z = 180 - AOHOR
cx = 350
cy = 350
z1 = 200
z2 = 300
#for i in range(0, 360, 30):
##print (grado_z+i, math.cos(math.radians(grado_z+i))*80, math.sin(math.radians(grado_z+i))*80,math.cos(math.radians(grado_z+i))*100, math.sin(math.radians(grado_z+i))*100);
#print ( "{ x1:", (math.cos(math.radians(grado_z+i)) * z1) + cx, ",")
#print ( "  y1:", (math.sin(math.radians(grado_z+i)) * -z1) + cy, ",")
#print ( "  x2:", (math.cos(math.radians(grado_z+i)) * z2) + cx, ",")
#print ( "  y2:", (math.sin(math.radians(grado_z+i)) * -z2) + cy, "\n},")

#print(swe_houses)
print("\nPIANETI - Eclittiche ed equatoriali")
for p in range(0, 7):
    print("\n" + swe.get_planet_name(p))
    print("lamda %.4f beta %4f" % (swe.calc_ut(
        jut, p, swe.FLG_SPEED)[0], swe.calc_ut(jut, p, swe.FLG_SPEED)[1]))
    print("alfa %.4f delta %4f" % (swe.calc_ut(jut, p, swe.FLG_EQUATORIAL)[0],
                                   swe.calc_ut(jut, p, swe.FLG_EQUATORIAL)[1]))

#print(swe.houses_ex(jut, top_lat, top_long, b'P'))
#        Calculate houses cusps (UT).
#
#        Args: float julday, float lat, float lon, char hsys='P'
#        Return: 2 tuples of 12 and 8 float (cusps, ascmc) (except Gauquelin)