def sweHouses(jd, lat, lon, hsys): """ Returns lists of houses and angles. """ hsys = SWE_HOUSESYS[hsys] hlist, ascmc = swisseph.houses(jd, lat, lon, hsys) # Add first house to the end of 'hlist' so that we # can compute house sizes with an iterator hlist += (hlist[0], ) houses = [{ 'id': const.LIST_HOUSES[i], 'lon': hlist[i], 'size': angle.distance(hlist[i], hlist[i + 1]) } for i in range(12)] angles = [{ 'id': const.ASC, 'lon': ascmc[0] }, { 'id': const.MC, 'lon': ascmc[1] }, { 'id': const.DESC, 'lon': angle.norm(ascmc[0] + 180) }, { 'id': const.IC, 'lon': angle.norm(ascmc[1] + 180) }, { 'id': const.VERTEX, 'lon': ascmc[3] }] return (houses, angles)
def sweHousesLon(jd, lat, lon, hsys): """ Returns lists with house and angle longitudes. """ hsys = SWE_HOUSESYS[hsys] hlist, ascmc = swisseph.houses(jd, lat, lon, hsys) angles = [ ascmc[0], ascmc[1], angle.norm(ascmc[0] + 180), angle.norm(ascmc[1] + 180), ascmc[3] ] return (hlist, angles)
def sweHousesLon(jd, lat, lon, hsys): """ Returns lists with house and angle longitudes. """ hsys = SWE_HOUSESYS[hsys] hlist, ascmc = swisseph.houses(jd, lat, lon, hsys) angles = [ ascmc[0], ascmc[1], angle.norm(ascmc[0] + 180), angle.norm(ascmc[1] + 180) ] return (hlist, angles)
def pfLon(jd, lat, lon): """ Returns the ecliptic longitude of Pars Fortuna. It considers diurnal or nocturnal conditions. """ sun = swe.sweObjectLon(const.SUN, jd) moon = swe.sweObjectLon(const.MOON, jd) asc = swe.sweHousesLon(jd, lat, lon, const.HOUSES_DEFAULT)[1][0] if isDiurnal(jd, lat, lon): return angle.norm(asc + moon - sun) else: return angle.norm(asc + sun - moon)
def arc(pRA, pDecl, sRA, sDecl, mcRA, lat): """ Returns the arc of direction between a Promissor and Significator. It uses the generic proportional semi-arc method. """ pDArc, pNArc = utils.dnarcs(pDecl, lat) sDArc, sNArc = utils.dnarcs(sDecl, lat) # Select meridian and arcs to be used # Default is MC and Diurnal arcs mdRA = mcRA sArc = sDArc pArc = pDArc if not utils.isAboveHorizon(sRA, sDecl, mcRA, lat): # Use IC and Nocturnal arcs mdRA = angle.norm(mcRA + 180) sArc = sNArc pArc = pNArc # Promissor and Significator distance to meridian pDist = angle.closestdistance(mdRA, pRA) sDist = angle.closestdistance(mdRA, sRA) # Promissor should be after significator (in degrees) if pDist < sDist: pDist += 360 # Meridian distances proportional to respective semi-arcs sPropDist = sDist / (sArc / 2.0) pPropDist = pDist / (pArc / 2.0) # The arc is how much of the promissor's semi-arc is # needed to reach the significator return (pPropDist - sPropDist) * (pArc / 2.0)
def getObject(ID, jd, lat, lon): """ Returns an object for a specific date and location. """ if ID == const.SOUTH_NODE: obj = swe.sweObject(const.NORTH_NODE, jd) obj.update({ 'id': const.SOUTH_NODE, 'lon': angle.norm(obj['lon'] + 180) }) elif ID == const.PARS_FORTUNA: pflon = tools.pfLon(jd, lat, lon) obj = { 'id': ID, 'lon': pflon, 'lat': 0, 'lonspeed': 0, 'latspeed': 0 } elif ID == const.SYZYGY: szjd = tools.syzygyJD(jd) obj = swe.sweObject(const.MOON, szjd) obj['id'] = const.SYZYGY else: obj = swe.sweObject(ID, jd) _signInfo(obj) return obj
def sweHouses(jd, lat, lon, hsys): """ Returns lists of houses and angles. """ hsys = SWE_HOUSESYS[hsys] hlist, ascmc = swisseph.houses(jd, lat, lon, hsys) # Add first house to the end of 'hlist' so that we # can compute house sizes with an iterator hlist += (hlist[0],) houses = [ { 'id': const.LIST_HOUSES[i], 'lon': hlist[i], 'size': angle.distance(hlist[i], hlist[i+1]) } for i in range(12) ] angles = [ {'id': const.ASC, 'lon': ascmc[0]}, {'id': const.MC, 'lon': ascmc[1]}, {'id': const.DESC, 'lon': angle.norm(ascmc[0] + 180)}, {'id': const.IC, 'lon': angle.norm(ascmc[1] + 180)} ] return (houses, angles)
def getObject(ID, jd, lat, lon): """ Returns an object for a specific date and location. """ if ID == const.SOUTH_NODE: obj = swe.sweObject(const.NORTH_NODE, jd) obj.update({ 'id': const.SOUTH_NODE, 'lon': angle.norm(obj['lon'] + 180) }) elif ID == const.PARS_FORTUNA: pflon = tools.pfLon(jd, lat, lon) obj = {'id': ID, 'lon': pflon, 'lat': 0, 'lonspeed': 0, 'latspeed': 0} elif ID == const.SYZYGY: szjd = tools.syzygyJD(jd) obj = swe.sweObject(const.MOON, szjd) obj['id'] = const.SYZYGY else: obj = swe.sweObject(ID, jd) _signInfo(obj) return obj