def _calc_aspects(self): """Calculate aspects. Planets must be calculated first. """ res = AspectDataList() # results f = self._filter all = self._planets all_asp = all_aspects() #;print 'moo' # TODO: fixed stars bug here!? # begin calc for i, pos1 in enumerate(all.sort_by_ranking()): p1, lon1, lonsp1 = pos1._planet, pos1._longitude, pos1._lonspeed for pos2 in all[i+1:]: p2, lon2, lonsp2 = pos2._planet, pos2._longitude, pos2._lonspeed for asp, doasp in f._aspects.items(): if not doasp: # dont use this aspect continue if not f._asprestr[p1._name] or not f._asprestr[p2._name]: continue # not this planet asp = all_asp[asp] # modify orb orb = f._orbs[asp._name] orbmod1 = f._orbrestr[p1._name].get_absolute(orb) orbmod2 = f._orbrestr[p2._name].get_absolute(orb) orb += (orbmod1 + orbmod2) / Decimal('2') if orb < 0: # we'll never get such a precision continue # check aspect match diff, apply, factor = swe._match_aspect2( lon1, lonsp1, lon2, lonsp2, float(asp._angle), float(orb)) if diff != None: res.feed(pos1, pos2, asp, diff, apply, factor) self._aspects = res
def _calc_interaspects(self): """Calculate inter-aspects of planets between charts 1 and 2.""" res = AspectDataList() if len(self) != 2: self._interaspects = res return f1 = self[0]._filter f2 = self[1]._filter all_asp = all_aspects() for pos1 in self[0]._planets: p1, lon1, lonsp1 = pos1._planet, pos1._longitude, pos1._lonspeed for pos2 in self[1]._planets: p2, lon2, lonsp2 = pos2._planet, pos2._longitude, pos2._lonspeed for asp, doasp in f1._aspects.items(): if not doasp: continue if not f2._aspects[asp]: continue if not f1._asprestr[p1._name] or not f2._asprestr[p1._name]: continue if not f2._asprestr[p2._name] or not f2._asprestr[p2._name]: continue asp = all_asp[asp] orb = (f1._orbs[asp._name]+f2._orbs[asp._name])/Decimal('2') orbmod1 = f1.orbrestr[p1._name].get_absolute(orb) orbmod2 = f2.orbrestr[p2._name].get_absolute(orb) orb += (orbmod1 + orbmod2) / Decimal('2') if orb < 0: continue diff, apply, factor = swe._match_aspect2( lon1, lonsp1, lon2, lonsp2, float(asp._angle), float(orb)) if diff != None: res.feed(pos1, pos2, asp, diff, apply, factor) self._interaspects = res
def _calc_midp_aspects(self): """Calculate midpoints aspects.""" res = MidPointAspectDataList() # results midpres = self._midpoints jd = self.julday flag = self._filter.get_calcflag() self._setup_swisseph() f = self._filter._midpoints all_pl = all_planets() all_asp = all_aspects() # get all concerned planets, if not already calculated plres = PlanetDataList() for pl in [x for x in f._planets if f._planets[x] and f._asprestr[x]]: try: plres.append(self._planets.get_data(pl)) except KeyError: p = all_pl[pl] plres.feed(p, p.calc_ut(jd, flag, self)) # get midp aspects plres.sort_by_ranking() for i, midp in enumerate(midpres): ##p1, p2 = midp._planet, midp._planet2 lon1, lonsp1 = midp._longitude, midp._lonspeed for pos in plres: pl, lon2, lonsp2 = pos._planet, pos._longitude, pos._lonspeed for asp, doasp in f._aspects.items(): if not doasp: # dont use this aspect continue asp = all_asp[asp] # modify orb orb = f._orbs[asp._name] #orbmod1 = plorbfilt[p1._name].get_absolute(orb) orbmod1 = 0 # todo?: midp obrestr orbmod2 = f._orbrestr[pl._name].get_absolute(orb) orb += (orbmod1 + orbmod2) / Decimal('2') if orb < 0: # we'll never get such a precision continue # check aspect match diff, apply, factor = swe._match_aspect2( lon1, lonsp1, lon2, lonsp2, float(asp._angle), float(orb)) if diff != None: res.feed(midp, pos, asp, diff, apply, factor) self._midp_aspects = res
def _calc_interaspects(self): """Calculate inter-aspects of planets between charts 1 and 2.""" res = AspectDataList() if len(self) != 2: self._interaspects = res return f1 = self[0]._filter f2 = self[1]._filter all_asp = all_aspects() for pos1 in self[0]._planets: p1, lon1, lonsp1 = pos1._planet, pos1._longitude, pos1._lonspeed for pos2 in self[1]._planets: p2, lon2, lonsp2 = pos2._planet, pos2._longitude, pos2._lonspeed for asp, doasp in f1._aspects.items(): if not doasp: continue if not f2._aspects[asp]: continue if not f1._asprestr[p1._name] or not f2._asprestr[ p1._name]: continue if not f2._asprestr[p2._name] or not f2._asprestr[ p2._name]: continue asp = all_asp[asp] orb = (f1._orbs[asp._name] + f2._orbs[asp._name]) / Decimal('2') orbmod1 = f1.orbrestr[p1._name].get_absolute(orb) orbmod2 = f2.orbrestr[p2._name].get_absolute(orb) orb += (orbmod1 + orbmod2) / Decimal('2') if orb < 0: continue diff, apply, factor = swe._match_aspect2( lon1, lonsp1, lon2, lonsp2, float(asp._angle), float(orb)) if diff != None: res.feed(pos1, pos2, asp, diff, apply, factor) self._interaspects = res
def _calc_intermidpoints(self): """Calculate aspects between midpoints.""" res = InterMidPointAspectDataList() if len(self) != 2: self._intermidpoints = res return elif not self[0]._filter._calc_midp or not self[1]._filter._calc_midp: self._intermidpoints = res return f1 = self[0]._filter._midpoints f2 = self[1]._filter._midpoints all_asp = all_aspects() # begin calc for i, pos1 in enumerate(self[0]._midpoints): p1, lon1, lonsp1 = pos1._data2, pos1._longitude, pos1._lonspeed for pos2 in self[1]._midpoints: p2, lon2, lonsp2 = pos2._data2, pos2._longitude, pos2._lonspeed for asp, doasp in f1._aspects.items(): if not doasp: # dont use this aspect continue if not f2._aspects[asp]: continue # no asp restr asp = all_asp[asp] # modify orb orb1 = f1._orbs[asp._name] orb2 = f2._orbs[asp._name] orb = orb1 + orb2 / Decimal('2') # nor orb restr # check aspect match diff, apply, factor = swe._match_aspect2( lon1, lonsp1, lon2, lonsp2, float(asp._angle), float(orb)) if diff != None: res.feed(pos1, pos2, asp, diff, apply, factor) self._intermidpoints = res