Beispiel #1
0
    def compute(self, in_date: datetime):
        in_date = in_date.astimezone(timezone.utc)
        _, in_date_jul = swe.utc_to_jd(in_date.year, in_date.month,
                                       in_date.day, in_date.hour,
                                       in_date.minute, in_date.second,
                                       swe.GREG_CAL)
        # print(in_date_jul)

        # in_date_jul = swe.julday(in_date.year, in_date.month, in_date.day,
        #                          in_date.hour + in_date.minute / 60 + in_date.second / 3600)
        sun_pos, _ = swe.calc(in_date_jul, swe.SUN, swe.FLG_SIDEREAL)
        moon_pos, _ = swe.calc(in_date_jul, swe.MOON, swe.FLG_SIDEREAL)
        sun_pos = sun_pos[0]
        moon_pos = moon_pos[0]
        self.tithi, self.pos_deg = self._calc_tithi(sun_pos, moon_pos)
Beispiel #2
0
    def retrograde(self):
        """ Verify if a planet is retrograde. """

        self.planets_house()
        planets_ret = []
        for plan in self.planets_list_temp:
            planet_number = self.get_number(plan["name"])
            if swe.calc(self.j_day, planet_number, self.iflag)[0][3] < 0:
                plan.update({'retrograde': True})
            else:
                plan.update({'retrograde': False})
            planets_ret.append(plan)

        self.planets_list = planets_ret
    def __init__(self, name, male, time, place, htype, notes,
                 options, full=True, proftype=0, nolat=False):
        self.name = name
        self.male = male
        self.time = time
        self.place = place
        self.htype = htype
        self.notes = notes
        self.options = options
        self.full = full
        self.proftype = proftype
        self.nolat = nolat

        d = swisseph.deltat(time.jd)
        self.obl = swisseph.calc(time.jd+d, astrology.SE_ECL_NUT, 0)
        # true obliquity of the ecliptic
        # mean
        #nutation in long
        #nutation in obl

        swisseph.set_topo(place.lon, place.lat, place.altitude)

        self.create()
Beispiel #4
0
    def planets_lister(self):
        """Sidereal or tropic mode."""
        self.iflag = swe.FLG_SWIEPH + swe.FLG_SPEED

        if self.zodiactype == "sidereal":
            self.iflag += swe.FLG_SIDEREAL
            mode = "SIDM_FAGAN_BRADLEY"
            swe.set_sid_mode(getattr(swe, mode))
        """Calculates the position of the planets and stores it in a list."""

        self.sun_deg = swe.calc(self.j_day, 0, self.iflag)[0][0]
        self.moon_deg = swe.calc(self.j_day, 1, self.iflag)[0][0]
        self.mercury_deg = swe.calc(self.j_day, 2, self.iflag)[0][0]
        self.venus_deg = swe.calc(self.j_day, 3, self.iflag)[0][0]
        self.mars_deg = swe.calc(self.j_day, 4, self.iflag)[0][0]
        self.jupiter_deg = swe.calc(self.j_day, 5, self.iflag)[0][0]
        self.saturn_deg = swe.calc(self.j_day, 6, self.iflag)[0][0]
        self.uranus_deg = swe.calc(self.j_day, 7, self.iflag)[0][0]
        self.neptune_deg = swe.calc(self.j_day, 8, self.iflag)[0][0]
        self.pluto_deg = swe.calc(self.j_day, 9, self.iflag)[0][0]
        self.mean_node_deg = swe.calc(self.j_day, 10, self.iflag)[0][0]
        self.true_node_deg = swe.calc(self.j_day, 11, self.iflag)[0][0]

        #print(swe.calc(self.j_day, 7, self.iflag)[3])

        self.planets_degs = [
            self.sun_deg, self.moon_deg, self.mercury_deg, self.venus_deg,
            self.mars_deg, self.jupiter_deg, self.saturn_deg, self.uranus_deg,
            self.neptune_deg, self.pluto_deg, self.mean_node_deg,
            self.true_node_deg
        ]

        return self.planets_degs
Beispiel #5
0
horaLocal = horaLocal - datetime.timedelta(hours=int(gmt))
#horaLocal = horaLocal - datetime.timedelta(minutes=int(30))
#print(horaLocal)

#Luego de aplicar el GMT
dia = horaLocal.strftime('%d')
mes = int(horaLocal.strftime('%m'))
anio = horaLocal.strftime('%Y')
hora = horaLocal.strftime('%H')
min = horaLocal.strftime('%M')

#print('Tiempo: ' + dia + '/' + mes + '/' + anio + ' ' + hora + ':' + min)

swe.set_ephe_path('/usr/share/libswe/ephe')

d = datetime.datetime(int(anio), int(mes), int(dia), int(hora), int(min))
jd1 = jdutil.datetime_to_jd(d)

np = [('Sol', 0), ('Luna', 1), ('Mercurio', 2), ('Venus', 3), ('Marte', 4),
      ('Júpiter', 5), ('Saturno', 6), ('Urano', 7), ('Neptuno', 8),
      ('Plutón', 9), ('Nodo Norte', 11), ('Nodo Sur', 10), ('Quirón', 15),
      ('Selena', 57), ('Lilith', 12)]

#La oblicuidad de calcula con ipl = SE_ECL_NUT = -1 en SWE pero en swisseph ECL_NUT = -1
posObli = swe.calc(jd1, -1, flag=swe.FLG_SWIEPH + swe.FLG_SPEED)
oblicuidad = posObli[0][0]
#pos=swe.calc_ut(jd1, np[4][1], flag=swe.FLG_SWIEPH+swe.FLG_SPEED)
#pos=swe.calc_ut(jd1, np[4][1], flag=swe.FLG_SWIEPH)
pos = swe.calc_ut(jd1, np[2][1], flag=swe.FLG_SPEED)
print(pos)
Beispiel #6
0
#     swe.set_sid_mode(k)
#     ayanamsa = swe.get_ayanamsa(now)
#     print(swe.get_ayanamsa_name(k),ayanamsa)
swe.set_sid_mode(swe.SIDM_LAHIRI)
# chart = Chart(now, pos, hsys=const.HOUSES_EQUAL)
# sun = chart.getObject(const.SUN)
# moon = chart.getObject(const.MOON)
chennai = skyfield.api.Topos('13.0827 N', '80.2707 E')
t0 = ts.utc(2019, 4, 14)
t1 = ts.utc(2020, 4, 14)
t, y = almanac.find_discrete(t0, t1, almanac.sunrise_sunset(planets, chennai))

now = t[0].tt
ayanamsa = swe.get_ayanamsa(now)

sun = swe.calc(now, swe.SUN, swe.FLG_SIDEREAL)
moon = swe.calc(now, swe.MOON, swe.FLG_SIDEREAL)
mars = swe.calc(now, swe.MARS, swe.FLG_SIDEREAL)
mercury = swe.calc(now, swe.MERCURY, swe.FLG_SIDEREAL)
jupiter = swe.calc(now, swe.JUPITER, swe.FLG_SIDEREAL)
venus = swe.calc(now, swe.VENUS, swe.FLG_SIDEREAL)
saturn = swe.calc(now, swe.SATURN, swe.FLG_SIDEREAL)
rahu = swe.calc(now, swe.MEAN_NODE, swe.FLG_SIDEREAL)
ketu = swe.calc(now, swe.TRUE_NODE, swe.FLG_SIDEREAL)
print('ayanamsa', ayanamsa, deg_min_sec(ayanamsa))

print('sun', deg_min_sec(sun[0]), int(floor(sun[0] / 30)) + 1)
print('moon', deg_min_sec(moon[0]), int(floor(moon[0] / 30)) + 1)
print('mars', deg_min_sec(mars[0]), int(floor(mars[0] / 30)) + 1)
print('mercury', deg_min_sec(mercury[0]), int(floor(mercury[0] / 30)) + 1)
Beispiel #7
0
 def radian_positions(dates1, p):
     return np.array(
         [swe.calc(date, p)[0][0] * math.pi / 180 for date in dates1])
Beispiel #8
0
import swisseph
from planets import *
from tools import *
from moon_meeus import moon_meeus

year = 1960
month = 3
print "Date(Y/M/A)\tlong_planets\tlong_moon_meeus\tlong_swisseph\t   diff1:3\t   diff2:3"
for day in range(1, 32):
    g1 = Planet('Moon', year, month, day).position()[1]
    g2 = moon_meeus(year, month, day)[1]
    g3 = swisseph.calc(swisseph._julday(year, month, day, 0, 0, 0), 1)[0]
    d13 = (g3 - g1) * 3600
    d23 = (g3 - g2) * 3600
    print "%4d %2d %2d %15.4f %15.4f %15.4f %15.4f %15.4f" % (
        year, month, day, g1, g2, g3, d13, d23)
Beispiel #9
0
    doty = random.randrange(1, 365)
    date = cal2jul(year, 1, 1) + doty
    cal_date = jul2cal(date)
    year = cal_date[0]
    month = cal_date[1]
    day = cal_date[2]
    #    print "\njulian date: %d calendar_date %s" % (date , str(cal_date))
    #    print "%20s %12s %12s %12s %12s %12s %12s" % ('body','ephem','vsop87c','swisseph','diff1-2','diff2-3', 'diff1-3')
    for body in planets:
        body_selected = planets[body](
            str(year) + "/" + str(month) + "/" + str(day),
            epoch=str(year) + "/" + str(month) + "/" + str(day))
        pos1 = math.degrees(ephem.Ecliptic(body_selected).lon)
        vsop87c_body = Planet(body, year, month, day)
        pos2 = vsop87c_body.calc()[1]
        diff12 = (pos2 - pos1) * 3600
        pos3 = swisseph.calc(date, swe_plan[body])[0]
        diff23 = (pos3 - pos2) * 3600
        diff13 = (pos3 - pos1) * 3600
        #        print "%20s %12.4f %12.4f %12.4f %12.4f %12.4f %12.4f" % (body, pos1, pos2, pos3, diff12, diff23, diff13)
        c.append(diff12)
        d.append(diff23)
        e.append(diff13)
print "\n" * 2
print "mean(stdev) ephem-vsop87c      %12.4f(%12.4f)" % (numpy.mean(c),
                                                         numpy.std(c))
print "mean(stdev) vsop87c-swisseph   %12.4f(%12.4f)" % (numpy.mean(d),
                                                         numpy.std(d))
print "mean(stdev) ephem-swisseph     %12.4f(%12.4f)" % (numpy.mean(e),
                                                         numpy.std(e))