def indexInfo(self, index):
     """ Returns information about a specific 
     planetary time. 
     
     """
     entry = self.table[index]
     info = {
         # Default is diurnal
         'mode': 'Day',
         'ruler': self.dayRuler(),
         'dayRuler': self.dayRuler(),
         'nightRuler': self.nightRuler(),
         'hourRuler': entry[2],
         'hourNumber': index + 1,
         'tableIndex': index,
         'start': Datetime.fromJD(entry[0], self.date.utcoffset),
         'end': Datetime.fromJD(entry[1], self.date.utcoffset)
     }
     if index >= 12:
         # Set information as nocturnal
         info.update({
             'mode': 'Night',
             'ruler': info['nightRuler'],
             'hourNumber': index + 1 - 12
         })
     return info
Beispiel #2
0
def nextLunarEclipse(date):
    """ Returns the Datetime of the maximum phase of the
    next global lunar eclipse.

    """

    eclipse = swe.lunarEclipseGlobal(date.jd, backward=False)
    return Datetime.fromJD(eclipse['maximum'], date.utcoffset)
Beispiel #3
0
def prevLunarEclipse(date):
    """ Returns the Datetime of the maximum phase of the
    previous global lunar eclipse.

    """

    eclipse = swe.lunarEclipseGlobal(date.jd, backward=True)
    return Datetime.fromJD(eclipse['maximum'], date.utcoffset)
  def __init__(self, date, hour_min, utc, geo_pos_1, geo_pos_2):
    # Build a chart for a date and location
    date = Datetime(date, hour_min, utc)
    pos = GeoPos(geo_pos_1, geo_pos_2)
    chart = Chart(date, pos, hsys=const.HOUSES_PLACIDUS, IDs=const.LIST_OBJECTS) #Page 25, livre: Cours complet d'astrologie
    
    # Prepare angles
    angles = []
    angles.append(chart.get(const.ASC))
    angles.append(chart.get(const.IC))
    angles.append(chart.get(const.DESC))
    angles.append(chart.get(const.MC))

    # Prepare houses
    houses = []
    houses.append(chart.get(const.HOUSE1))
    houses.append(chart.get(const.HOUSE2))
    houses.append(chart.get(const.HOUSE3))
    houses.append(chart.get(const.HOUSE4))
    houses.append(chart.get(const.HOUSE5))
    houses.append(chart.get(const.HOUSE6))
    houses.append(chart.get(const.HOUSE7))
    houses.append(chart.get(const.HOUSE8))
    houses.append(chart.get(const.HOUSE9))
    houses.append(chart.get(const.HOUSE10))
    houses.append(chart.get(const.HOUSE11))
    houses.append(chart.get(const.HOUSE12))

    # Prepare planets
    planets = []
    planets.append(chart.get(const.SUN))
    planets.append(chart.get(const.MOON))
    planets.append(chart.get(const.MERCURY))
    planets.append(chart.get(const.VENUS))
    planets.append(chart.get(const.MARS))
    planets.append(chart.get(const.JUPITER))
    planets.append(chart.get(const.SATURN))
    planets.append(chart.get(const.URANUS))
    planets.append(chart.get(const.NEPTUNE))
    planets.append(chart.get(const.PLUTO))
    planets.append(chart.get(const.CHIRON))
    planets.append(chart.get(const.NORTH_NODE))
    planets.append(chart.get(const.SOUTH_NODE))
    planets.append(chart.get(const.PARS_FORTUNA))
    self.data = export(angles=angles, houses=houses, planets=planets)
    
    This recipe shows sample code for handling 
    accidental dignities.

"""

from flatlibfr import const
from flatlibfr.chart import Chart
from flatlibfr.datetime import Datetime
from flatlibfr.geopos import GeoPos

from flatlibfr.dignities import accidental
from flatlibfr.dignities.accidental import AccidentalDignity

# 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)

# Get some objects
obj = chart.get(const.VENUS)
sun = chart.get(const.SUN)

# Sun relation
relation = accidental.sunRelation(obj, sun)
print(relation)

# Augmenting or Diminishing light
light = accidental.light(obj, sun)
print(light)
Beispiel #6
0
"""
    Author: João Ventura <*****@*****.**>
    
    
    This recipe shows sample code for calculating the dates
    of the previous and next solar and lunar eclipses.

"""

from flatlibfr.datetime import Datetime
from flatlibfr.ephem import ephem

# Build a Datetime object
date = Datetime('2016/10/11', '12:00', '+00:00')

# Get the date of the maximum phase of the next global lunar eclipse
lunar_eclipse = ephem.nextLunarEclipse(date)
print(lunar_eclipse)  # <2017/02/11 00:43:48 00:00:00>

# Get the date of the maximum phase of the next global solar eclipse
solar_eclipse = ephem.nextSolarEclipse(date)
print(solar_eclipse)  # <2017/02/26 14:53:23 00:00:00>
    plt.ylabel('Distance in minutes')
    plt.xlabel('Year')
    plt.title(title)
    plt.axhline(y=0, c='red')
    plt.show()


# Set the starting year
sYear = 1980

# Get successive spring equinox dates
equinoxes = []
span = 100
for year in range(sYear, sYear + span):

    # Get the spring equinox date for the year
    dt = Datetime('%s/01/01' % year, '00:00')
    sr = ephem.nextSolarReturn(dt, 0.00)
    equinoxes.append([year, sr.jd])

# Compute successive differences
diffs = []
for i in range(len(equinoxes) - 1):
    year1, jd1 = equinoxes[i]
    year2, jd2 = equinoxes[i + 1]
    diffs.append([year1, (jd2 - jd1 - 365.2425) * 24 * 60])

print(diffs)
title = 'Solar year length from %s to %s\n' % (sYear, sYear + span)
title += '(Compared to average year of 365.2425)'
plot(diffs, title)
    Author: João Ventura <*****@*****.**>
    
    
    This recipe shows sample code for handling 
    solar returns.

"""

from flatlibfr import const
from flatlibfr.chart import Chart
from flatlibfr.datetime import Datetime
from flatlibfr.geopos import GeoPos
from flatlibfr.predictives import returns

# Build a chart for a date and location
date = Datetime('2013/06/13', '17:00', '+01:00')
pos = GeoPos('38n32', '8w54')
chart = Chart(date, pos)

# Get the next solar return Chart given a date
today = Datetime('2015/04/06', '10:40', '+01:00')
srChart = returns.nextSolarReturn(chart, today)

# Print the date and Asc
asc = srChart.get(const.ASC)
print(asc)  # <Asc Taurus +26:25:47>
print(srChart.date)  # <2015/06/14 04:38:37 01:00:00>

# Solar return of the year
srChart = chart.solarReturn(2015)
print(asc)  # <Asc Taurus +26:25:47>
 def setUp(self):
     self.date = Datetime('2015/03/13', '17:00', '+00:00')
     self.pos = GeoPos('38n32', '8w54')
Beispiel #10
0
def nextSunrise(date, pos):
    """ Returns the date of the next sunrise. """
    jd = eph.nextSunrise(date.jd, pos.lat, pos.lon)
    return Datetime.fromJD(jd, date.utcoffset)
Beispiel #11
0
def prevSolarReturn(date, lon):
    """ Returns the previous date when sun is at longitude 'lon'. """
    jd = eph.prevSolarReturn(date.jd, lon)
    return Datetime.fromJD(jd, date.utcoffset)
Beispiel #12
0
def nextSolarReturn(date, lon):
    """ Returns the next date when sun is at longitude 'lon'. """
    jd = eph.nextSolarReturn(date.jd, lon)
    return Datetime.fromJD(jd, date.utcoffset)
Beispiel #13
0
def nextStation(ID, date):
    """ Returns the aproximate date of the next station. """
    jd = eph.nextStation(ID, date.jd)
    return Datetime.fromJD(jd, date.utcoffset)
Beispiel #14
0
def lastSunset(date, pos):
    """ Returns the date of the last sunset. """
    jd = eph.lastSunset(date.jd, pos.lat, pos.lon)
    return Datetime.fromJD(jd, date.utcoffset)
Beispiel #15
0
    years = [elem[0] for elem in hdiff]
    hours = [elem[1] for elem in hdiff]
    plt.plot(years, hours)
    plt.ylabel('Hour distance')
    plt.xlabel('Year')
    plt.title(title)
    plt.axhline(y=-24, c='red')
    plt.show()


# Set the birth date and time
date = [1983, 3, 21]
time = ['+', 0, 0, 0]

# Get the sun position at birth
dt = Datetime(date, time)
pos = GeoPos('38n32', '8w54')
sun = ephem.getObject(const.SUN, dt, pos)

# Collect hour differences for the following 100 years
hdiff = []
span = 100
for year in range(date[0], date[0] + 1 + span):

    # Get solar return of the year
    dt = Datetime('%s/01/01' % year, '00:00')
    sr = ephem.nextSolarReturn(dt, sun.lon)

    # Create anniversary date for the year
    date[0] = year
    an = Datetime(date, time)
"""
    Author: João Ventura <*****@*****.**>
    
    
    This recipe shows sample code for handling 
    profections.

"""

from flatlibfr import const
from flatlibfr.chart import Chart
from flatlibfr.datetime import Datetime
from flatlibfr.geopos import GeoPos
from flatlibfr.predictives import profections


# Build a chart for a date and location
date = Datetime('2011/03/13', '17:00', '+00:00')
pos = GeoPos('38n32', '8w54')
chart = Chart(date, pos)

# Get the profection Chart for a date
today = Datetime('2015/04/06', '10:40', '+01:00')
pChart = profections.compute(chart, today)

# Print the Asc
asc = pChart.get(const.ASC)
print(asc)  #  <Asc Capricorn +05:23:06>