Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
def sunRelation(obj, sun):
    """ Returns an object's relation with the sun. """
    if obj.id == const.SUN:
        return None
    dist = abs(angle.closestdistance(sun.lon, obj.lon))
    if dist < 0.2833: return CAZIMI
    elif dist < 8.0: return COMBUST
    elif dist < 16.0: return UNDER_SUN
    else:
        return None
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
def solarReturnJD(jd, lon, forward=True):
    """ Finds the julian date before or after 
    'jd' when the sun is at longitude 'lon'. 
    It searches forward by default.
    
    """
    sun = swe.sweObjectLon(const.SUN, jd)
    if forward:
        dist = angle.distance(sun, lon)
    else:
        dist = angle.distance(lon, sun)

    while abs(dist) > MAX_ERROR:
        jd = jd + dist / 0.9833  # Sun mean motion
        sun = swe.sweObjectLon(const.SUN, jd)
        dist = angle.closestdistance(sun, lon)
    return jd
Ejemplo n.º 5
0
def syzygyJD(jd):
    """ Finds the latest new or full moon and
    returns the julian date of that event. 
    
    """
    sun = swe.sweObjectLon(const.SUN, jd)
    moon = swe.sweObjectLon(const.MOON, jd)
    dist = angle.distance(sun, moon)

    # Offset represents the Syzygy type.
    # Zero is conjunction and 180 is opposition.
    offset = 180 if (dist >= 180) else 0
    while abs(dist) > MAX_ERROR:
        jd = jd - dist / 13.1833  # Moon mean daily motion
        sun = swe.sweObjectLon(const.SUN, jd)
        moon = swe.sweObjectLon(const.MOON, jd)
        dist = angle.closestdistance(sun - offset, moon)
    return jd