def get_chart_aspects_for_planet(planetName, baseChart, chart): planet = baseChart.get(planetName) res = [] for other_body in LIST_PLANETS: other_planet = chart.get(other_body) aspect = aspects.getAspect(planet, other_planet, const.MAJOR_ASPECTS) if aspect.type != -1: aspect_part = aspect.active if aspect.active.id != planetName else aspect.passive if aspect_part.id not in LIST_PLANETS: # don't care about Lilith and nodes continue if not aspect.inOrb(planet.id): continue if not aspect.mutualAspect(): continue if planetName in ['Sun', 'Moon', 'Asc']: if aspect.orb > 2.5: continue elif aspect.orb > 2: continue res.append({ 'first': planetName, 'second': aspect_part.id, 'type': aspect.type, 'type_name': ASPECT_LABELS[aspect.type], 'orb': aspect.orb }) return res
def __init__(self, chart, body): self.planet = chart.get(body) self.house = chart.houses.getObjectHouse(self.planet).id self.aspects = [] self.name = body if body != 'Asc' else 'Ascendant' for house_id in const.LIST_HOUSES: house = chart.get(house_id) if house.sign == self.planet.sign: self.house = house_id break for other_body in LIST_PLANETS: other_planet = chart.get(other_body) aspect = aspects.getAspect(self.planet, other_planet, const.MAJOR_ASPECTS) if aspect.type != -1: aspect_part = aspect.active if aspect.active.id != body else aspect.passive if aspect_part.id not in LIST_PLANETS: # don't care about Lilith and nodes continue if aspect.orb > 10: # maybe #TODO: use different values per type? continue self.aspects.append({ 'first': self.name, 'second': aspect_part.id, 'type': aspect.type, 'type_name': ASPECT_LABELS[aspect.type], 'orb': aspect.orb })
def aspectsByCat(self, ID, aspList): """ Returns the aspects an object makes with the other six planets, separated by category (applicative, separative, exact). Aspects must be within orb of the object. """ res = { const.APPLICATIVE: [], const.SEPARATIVE: [], const.EXACT: [], const.NO_MOVEMENT: [] } objA = self.chart.getObject(ID) valid = self.validAspects(ID, aspList) for elem in valid: objB = self.chart.getObject(elem['id']) asp = aspects.getAspect(objA, objB, aspList) role = asp.getRole(objA.id) if role['inOrb']: movement = role['movement'] res[movement].append({ 'id': objB.id, 'asp': asp.type, 'orb': asp.orb }) return res
def __aspectLists(self, IDs, aspList): """ Returns a list with the aspects that the object makes to the objects in IDs. It considers only conjunctions and other exact/applicative aspects if in aspList. """ res = [] for otherID in IDs: # Ignore same if otherID == self.obj.id: continue # Get aspects to the other object otherObj = self.chart.getObject(otherID) asp = aspects.getAspect(self.obj, otherObj, aspList) if asp.type == const.NO_ASPECT: continue elif asp.type == const.CONJUNCTION: res.append(asp.type) else: # Only exact or applicative aspects movement = asp.movement() if movement in [const.EXACT, const.APPLICATIVE]: res.append(asp.type) return res
def get_aspects_for_transits(planetName, baseChart, chart, debug=False): planet = baseChart.get(planetName) res = [] if debug: print(f"------ get_chart_aspects_for_planet: {planetName} ------") print(f" lat: {planet.lat} lon: {planet.lon}") for other_body in LIST_PLANETS: # We don't use Ascendant on the transit's chart when looking at these if other_body == 'Asc': continue other_planet = chart.get(other_body) aspect = aspects.getAspect(planet, other_planet, const.MAJOR_ASPECTS) if aspect.type != -1: aspect_part = aspect.active if aspect.active.id != planetName else aspect.passive if aspect_part.id not in LIST_PLANETS: # i don't care about Lilith and nodes continue if debug: print(f"{other_planet} - {ASPECT_LABELS[aspect.type]}") sep = angle.closestdistance(planet.lon, other_planet.lon) diff_to_aspect_exact = abs(aspect.type - abs(sep)) orb_limit = 2 if aspect_part.id == 'Moon': orb_limit = 5 if diff_to_aspect_exact > orb_limit: if debug: print( f" Skipping, orb {diff_to_aspect_exact} out of limit of {orb_limit}" ) continue date_range = calculate_date_range_for_transit( planetName, other_planet, aspect, sep) if not date_range['already_ended']: res.append({ 'natal': planetName, 'transit': aspect_part.id, 'type': aspect.type, 'type_name': ASPECT_LABELS[aspect.type], 'orb': aspect.orb, 'date_start': date_range['start'], 'date_end': date_range['end'], 'date_exact': date_range['exact_on'] }) return res
import datetime import time from flatlib.datetime import Datetime from flatlib.geopos import GeoPos from flatlib.chart import Chart from flatlib import const from flatlib import aspects # Build a chart for a date and location data = datetime.datetime.utcnow() d = data.strftime('%Y/%m/%d') h = data.strftime('%H:%M:%S') date = Datetime(d, h) pos = GeoPos('38n43', '9w8') chart = Chart(date, pos) # Retrieve the Sun and Moon sun = chart.get(const.SUN) moon = chart.get(const.MOON) venus = chart.get(const.VENUS) # Get the aspect aspect1 = aspects.getAspect(sun, moon, const.MAJOR_ASPECTS) aspect2 = aspects.getAspect(sun, venus, const.ALL_ASPECTS) print(aspect1) print(aspect2xsc)
""" Author: João Ventura <*****@*****.**> This recipe shows sample code for handling aspects. """ from flatlib import aspects from flatlib import const from flatlib.chart import Chart from flatlib.datetime import Datetime from flatlib.geopos import GeoPos # Build a chart for a date and location date = Datetime('2015/03/13', '17:00', '+00:00') pos = GeoPos('38n32', '8w54') chart = Chart(date, pos) # Retrieve the Sun and Moon sun = chart.get(const.SUN) moon = chart.get(const.MOON) # Get the aspect aspect = aspects.getAspect(sun, moon, const.MAJOR_ASPECTS) print(aspect) # <Moon Sun 90 Applicative +00:24:30>
def get_aspects(chart1, chart2, *, threshold): for planet1 in chart1.objects: for planet2 in chart2.objects: aspect = aspects.getAspect(planet1, planet2, const.MAJOR_ASPECTS) if aspect.exists() and aspect.orb <= threshold: yield aspect