예제 #1
0
    def CaclHouses(self, Bday_accurate, lon, lat):

        print(lat)
        print(lon)
        house_loc = swe.houses_ex(Bday_accurate[1], lat, lon, str.encode('P'),
                                  FLG_SIDEREAL)

        Cusps = house_loc[0]

        Asc = house_loc[1]

        HouseDict = collections.OrderedDict()

        for j in House_list:
            HouseDict[Cusps[j - 1]] = str(j)

            print(
                "House " + str(j) + " in " +
                Zodiac_sign[int(Cusps[j - 1] / 30)],
                self.prnt(self.decdeg2dms((Cusps[j - 1] % 30))))

        HousePosList = sorted(HouseDict.keys())

        print(HousePosList)
        print(HouseDict)

        return HouseDict, HousePosList
예제 #2
0
 def get_zodiac_longitude_eastern_horizon(self, jd):
     """ Get the ID of the raashi what is currently rising.
 
 :param jd: 
 :return: 
 """
     return swe.houses_ex(jd, self.latitude, self.longitude)[1][0]
예제 #3
0
 def _calc_houses(self):
     """Calculate houses cusps."""
     self._setup_swisseph()
     cusps, ascmc = swe.houses_ex(self.julday, float(self._latitude),
         float(self._longitude), self._filter._hsys,
         self._filter.get_calcflag())
     self._houses = HousesDataList(cusps, ascmc, self._filter._hsys)
예제 #4
0
    def get_lagna_float(self, jd, offset=0, debug=False):
        """Returns the angam

          Args:
            :param jd: The Julian Day at which the lagnam is to be computed
            :param offset: Used by internal functions for bracketing
            :param debug

          Returns:
            float lagna
        """
        swe.set_sid_mode(self.ayanamsha_id)
        lcalc = swe.houses_ex(
            jd, self.city.latitude,
            self.city.longitude)[1][0] - swe.get_ayanamsa_ut(jd)
        lcalc = lcalc % 360

        if offset == 0:
            return lcalc / 30

        else:
            if debug:
                logging.debug(debug)
                logging.debug(('offset:', offset))
                logging.debug(('lcalc/30', lcalc / 30))
                logging.debug(('lcalc/30 + offset = ', lcalc / 30 + offset))

            # The max expected value is somewhere between 2 and -2, with bracketing

            if (lcalc / 30 + offset) >= 3:
                return (lcalc / 30) + offset - 12
            elif (lcalc / 30 + offset) <= -3:
                return (lcalc / 30)
            else:
                return (lcalc / 30) + offset
예제 #5
0
def ascendant(jd, place):
  """Lagna (=ascendant) calculation at any given time & place"""
  lat, lon, tz = place
  jd_utc = jd - (tz / 24.)
  set_ayanamsa_mode() # needed for swe.houses_ex()

  # returns two arrays, cusps and ascmc, where ascmc[0] = Ascendant
  nirayana_lagna = swe.houses_ex(jd_utc, lat, lon, flag = swe.FLG_SIDEREAL)[1][0]
  # 12 zodiac signs span 360°, so each one takes 30°
  # 0 = Mesha, 1 = Vrishabha, ..., 11 = Meena
  constellation = int(nirayana_lagna / 30)
  coordinates = to_dms(nirayana_lagna % 30)

  reset_ayanamsa_mode()
  return [constellation, coordinates, nakshatra_pada(nirayana_lagna)]
예제 #6
0
def ascendant(jd, place):
  """Lagna (=ascendant) calculation at any given time & place"""
  lat, lon, tz = place
  jd_utc = jd - (tz / 24.)
  set_ayanamsa_mode() # needed for swe.houses_ex()

  # returns two arrays, cusps and ascmc, where ascmc[0] = Ascendant
  nirayana_lagna = swe.houses_ex(jd_utc, lat, lon, flag = swe.FLG_SIDEREAL)[1][0]
  # 12 zodiac signs span 360°, so each one takes 30°
  # 0 = Mesha, 1 = Vrishabha, ..., 11 = Meena
  constellation = int(nirayana_lagna / 30)
  coordinates = to_dms(nirayana_lagna % 30)

  reset_ayanamsa_mode()
  return [constellation, coordinates, nakshatra_pada(nirayana_lagna)]
예제 #7
0
def get_lagna_float(jd, lat, lon, offset=0, ayanamsha_id=swe.SIDM_LAHIRI, debug=False):
  """Returns the angam

    Args:
      :param jd: The Julian Day at which the lagnam is to be computed
      :param lat: Latitude of the place where the lagnam is to be computed
      :param lon: Longitude of the place where the lagnam is to be computed
      :param offset: Used by internal functions for bracketing
      :param ayanamsha_id
      :param debug

    Returns:
      float lagna

    Examples:
      >>> get_lagna_float(2444961.7125,13.08784, 80.27847)
      10.353595502472984
  """
  swe.set_sid_mode(ayanamsha_id)
  lcalc = swe.houses_ex(jd, lat, lon)[1][0] - swe.get_ayanamsa_ut(jd)
  lcalc = lcalc % 360

  if offset == 0:
    return lcalc / 30

  else:
    if (debug):
      print('offset:', offset)
      print('lcalc/30', lcalc / 30)
      print('lcalc/30 + offset = ', lcalc / 30 + offset)

    # The max expected value is somewhere between 2 and -2, with bracketing

    if (lcalc / 30 + offset) >= 3:
      return (lcalc / 30) + offset - 12
    elif (lcalc / 30 + offset) <= -3:
      return (lcalc / 30)
    else:
      return (lcalc / 30) + offset
예제 #8
0
def compute_lagna_float(jd, lat=13.08784, lon=80.27847, offset=0, debug=False):
    swe.set_sid_mode(swe.SIDM_LAHIRI)  # Force Lahiri Ayanamsha
    lcalc = swe.houses_ex(jd, lat, lon)[1][0] - swe.get_ayanamsa_ut(jd)
    lcalc = lcalc % 360

    if offset == 0:
        return lcalc / 30

    else:
        if (debug):
            print('offset:', offset)
            print('lcalc/30', lcalc / 30)
            print('lcalc/30 + offset = ', lcalc / 30 + offset)

        # The max expected value is somewhere between 2 and -2, with bracketing

        if (lcalc / 30 + offset) >= 3:
            return (lcalc / 30) + offset - 12
        elif (lcalc / 30 + offset) <= -3:
            return (lcalc / 30)
        else:
            return (lcalc / 30) + offset
예제 #9
0
    def __init__(self, tjd_ut, flag, geolat, geolon, hsys, obl, ayanopt, ayan):
        if hsys in Houses.hsystems:
            self.hsys = hsys
        else:
            self.hsys = hsystems[0]

        self.obl = obl
        self.cusps, self.ascmc = swisseph.houses_ex(tjd_ut, geolat, geolon, bytes(self.hsys, 'utf-8'), flag)

        ##################
        if ayanopt != 0 and self.hsys == 'W':
            del self.cusps
            cusps = [0.0]
            sign = int(util.normalize(self.ascmc[Houses.ASC]-ayan))/30
            cusps.append(sign*30.0)
            for i in range(2, Houses.HOUSE_NUM+1):
                hc = util.normalize(cusps[i-1]+30.0)
                cusps.append(hc)

            #to tuple (which is a read-only list)
            self.cusps = tuple(cusps)
        ##################

        ascra, ascdecl, dist = swisseph.cotrans(self.ascmc[Houses.ASC], 0.0, 1.0, -obl)
        mcra, mcdecl, dist = swisseph.cotrans(self.ascmc[Houses.MC], 0.0, 1.0, -obl)
        self.ascmc2 = ((self.ascmc[Houses.ASC], 0.0, ascra, ascdecl), (self.ascmc[Houses.MC], 0.0, mcra, mcdecl))

        #zdAsc=90.0, zdMC=0.0
        #poleAsc=lat, poleMC=0.0
        qasc = math.degrees(math.asin(math.tan(math.radians(ascdecl))*math.tan(math.radians(geolat))))
        self.regioMPAsc = ascra-qasc
        self.regioMPMC = mcra

        self.cuspstmp = [[0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]
        for i in range(Houses.HOUSE_NUM):
            self.cuspstmp[i][0], self.cuspstmp[i][1], dist = swisseph.cotrans(self.cusps[i], 0.0, dist, -obl)

        self.cusps2 = ((self.cuspstmp[0][0], self.cuspstmp[0][1]), (self.cuspstmp[1][0], self.cuspstmp[1][1]), (self.cuspstmp[2][0], self.cuspstmp[2][1]), (self.cuspstmp[3][0], self.cuspstmp[3][1]), (self.cuspstmp[4][0], self.cuspstmp[4][1]), (self.cuspstmp[5][0], self.cuspstmp[5][1]), (self.cuspstmp[6][0], self.cuspstmp[6][1]), (self.cuspstmp[7][0], self.cuspstmp[7][1]), (self.cuspstmp[8][0], self.cuspstmp[8][1]), (self.cuspstmp[9][0], self.cuspstmp[9][1]), (self.cuspstmp[10][0], self.cuspstmp[10][1]), (self.cuspstmp[11][0], self.cuspstmp[11][1]))
예제 #10
0
	def __init__(self,year,month,day,hour,geolon,geolat,altitude,planets,zodiac,openastrocfg,houses_override=None):
		#ephemeris path (default "/usr/share/swisseph:/usr/local/share/swisseph")
		#swe.set_ephe_path(ephe_path)
		
		#basic location		
		self.jul_day_UT=swe.julday(year,month,day,hour)
		self.geo_loc = swe.set_topo(geolon,geolat,altitude)

		#output variables
		self.planets_sign = list(range(len(planets)))
		self.planets_degree = list(range(len(planets)))
		self.planets_degree_ut = list(range(len(planets)))
		self.planets_info_string = list(range(len(planets)))
		self.planets_retrograde = list(range(len(planets)))
		
		#iflag
		"""
		#define SEFLG_JPLEPH         1L     // use JPL ephemeris
		#define SEFLG_SWIEPH         2L     // use SWISSEPH ephemeris, default
		#define SEFLG_MOSEPH         4L     // use Moshier ephemeris
		#define SEFLG_HELCTR         8L     // return heliocentric position
		#define SEFLG_TRUEPOS        16L     // return true positions, not apparent
		#define SEFLG_J2000          32L     // no precession, i.e. give J2000 equinox
		#define SEFLG_NONUT          64L     // no nutation, i.e. mean equinox of date
		#define SEFLG_SPEED3         128L     // speed from 3 positions (do not use it, SEFLG_SPEED is // faster and preciser.)
		#define SEFLG_SPEED          256L     // high precision speed (analyt. comp.)
		#define SEFLG_NOGDEFL        512L     // turn off gravitational deflection
		#define SEFLG_NOABERR        1024L     // turn off 'annual' aberration of light
		#define SEFLG_EQUATORIAL     2048L     // equatorial positions are wanted
		#define SEFLG_XYZ            4096L     // cartesian, not polar, coordinates
		#define SEFLG_RADIANS        8192L     // coordinates in radians, not degrees
		#define SEFLG_BARYCTR        16384L     // barycentric positions
		#define SEFLG_TOPOCTR      (32*1024L)     // topocentric positions
		#define SEFLG_SIDEREAL     (64*1024L)     // sidereal positions 		
		"""
		#check for apparent geocentric (default), true geocentric, topocentric or heliocentric
		iflag=swe.FLG_SWIEPH+swe.FLG_SPEED
		if(openastrocfg['postype']=="truegeo"):
			iflag += swe.FLG_TRUEPOS
		elif(openastrocfg['postype']=="topo"):
			iflag += swe.FLG_TOPOCTR
		elif(openastrocfg['postype']=="helio"):
			iflag += swe.FLG_HELCTR

		#sidereal
		if(openastrocfg['zodiactype']=="sidereal"):
			iflag += swe.FLG_SIDEREAL
			mode="SIDM_"+openastrocfg['siderealmode']
			swe.set_sid_mode(getattr(swe,mode.encode("ascii")))

		#compute a planet (longitude,latitude,distance,long.speed,lat.speed,speed)
		for i in range(23):
			ret_flag = swe.calc_ut(self.jul_day_UT,i,iflag)
			for x in range(len(zodiac)):
				deg_low=float(x*30)
				deg_high=float((x+1)*30)
				if ret_flag[0] >= deg_low:
					if ret_flag[0] <= deg_high:
						self.planets_sign[i]=x
						self.planets_degree[i] = ret_flag[0] - deg_low
						self.planets_degree_ut[i] = ret_flag[0]
						#if latitude speed is negative, there is retrograde
						if ret_flag[3] < 0:						
							self.planets_retrograde[i] = True
						else:
							self.planets_retrograde[i] = False

							
		#available house systems:
		"""
		hsys= ‘P’     Placidus
				‘K’     Koch
				‘O’     Porphyrius
				‘R’     Regiomontanus
				‘C’     Campanus
				‘A’ or ‘E’     Equal (cusp 1 is Ascendant)
				‘V’     Vehlow equal (Asc. in middle of house 1)
				‘X’     axial rotation system
				‘H’     azimuthal or horizontal system
				‘T’     Polich/Page (“topocentric” system)
				‘B’     Alcabitus
				‘G’     Gauquelin sectors
				‘M’     Morinus
		"""
		#houses calculation (hsys=P for Placidus)
		#check for polar circle latitude < -66 > 66
		if houses_override:
			self.jul_day_UT = swe.julday(houses_override[0],houses_override[1],houses_override[2],houses_override[3])
			
		if geolat > 66.0:
			geolat = 66.0
			print("polar circle override for houses, using 66 degrees")
		elif geolat < -66.0:
			geolat = -66.0
			print("polar circle override for houses, using -66 degrees")
		#sidereal houses
		if(openastrocfg['zodiactype']=="sidereal"):
			sh = swe.houses_ex(self.jul_day_UT,geolat,geolon,openastrocfg['houses_system'].encode("ascii"),swe.FLG_SIDEREAL)
		else:
			sh = swe.houses(self.jul_day_UT,geolat,geolon,openastrocfg['houses_system'].encode("ascii"))
		self.houses_degree_ut = list(sh[0])
		self.houses_degree = list(range(len(self.houses_degree_ut)))
		self.houses_sign = list(range(len(self.houses_degree_ut)))
		for i in range(12):
			for x in range(len(zodiac)):
				deg_low=float(x*30)
				deg_high=float((x+1)*30)
				if self.houses_degree_ut[i] >= deg_low:
					if self.houses_degree_ut[i] <= deg_high:
						self.houses_sign[i]=x
						self.houses_degree[i] = self.houses_degree_ut[i] - deg_low
		



		#compute additional points and angles
		#list index 23 is asc, 24 is Mc, 25 is Dsc, 26 is Ic
		self.planets_degree_ut[23] = self.houses_degree_ut[0]
		self.planets_degree_ut[24] = self.houses_degree_ut[9]
		self.planets_degree_ut[25] = self.houses_degree_ut[6]
		self.planets_degree_ut[26] = self.houses_degree_ut[3]	
		#arabic parts
		sun,moon,asc = self.planets_degree_ut[0],self.planets_degree_ut[1],self.planets_degree_ut[23]
		dsc,venus = self.planets_degree_ut[25],self.planets_degree_ut[3]			
		#list index 27 is day pars
		self.planets_degree_ut[27] = asc + (moon - sun)
		#list index 28 is night pars
		self.planets_degree_ut[28] = asc + (sun - moon)
		#list index 29 is South Node
		self.planets_degree_ut[29] = self.planets_degree_ut[10] - 180.0
		#list index 30 is marriage pars
		self.planets_degree_ut[30] = (asc+dsc)-venus
		#if planet degrees is greater than 360 substract 360 or below 0 add 360
		for i in range(23,31):
			if self.planets_degree_ut[i] > 360.0:
				self.planets_degree_ut[i] = self.planets_degree_ut[i] - 360.0
			elif self.planets_degree_ut[i] < 0.0:
				self.planets_degree_ut[i] = self.planets_degree_ut[i] + 360.0
			#get zodiac sign
			for x in range(12):
				deg_low=float(x*30.0)
				deg_high=float((x+1.0)*30.0)
				if self.planets_degree_ut[i] >= deg_low:
					if self.planets_degree_ut[i] <= deg_high:
						self.planets_sign[i]=x
						self.planets_degree[i] = self.planets_degree_ut[i] - deg_low
						self.planets_retrograde[i] = False

		
		
		#close swiss ephemeris
		swe.close()
예제 #11
0
    def __init__(self,
                 year,
                 month,
                 day,
                 hour,
                 geolon,
                 geolat,
                 altitude,
                 planets,
                 zodiac,
                 openastrocfg,
                 houses_override=None):
        #ephemeris path (default "/usr/share/swisseph:/usr/local/share/swisseph")
        #swe.set_ephe_path(ephe_path)

        #basic location
        self.jul_day_UT = swe.julday(year, month, day, hour)
        self.geo_loc = swe.set_topo(geolon, geolat, altitude)

        #output variables
        self.planets_sign = list(range(len(planets)))
        self.planets_degree = list(range(len(planets)))
        self.planets_degree_ut = list(range(len(planets)))
        self.planets_info_string = list(range(len(planets)))
        self.planets_retrograde = list(range(len(planets)))

        #iflag
        """
		#define SEFLG_JPLEPH         1L     // use JPL ephemeris
		#define SEFLG_SWIEPH         2L     // use SWISSEPH ephemeris, default
		#define SEFLG_MOSEPH         4L     // use Moshier ephemeris
		#define SEFLG_HELCTR         8L     // return heliocentric position
		#define SEFLG_TRUEPOS        16L     // return true positions, not apparent
		#define SEFLG_J2000          32L     // no precession, i.e. give J2000 equinox
		#define SEFLG_NONUT          64L     // no nutation, i.e. mean equinox of date
		#define SEFLG_SPEED3         128L     // speed from 3 positions (do not use it, SEFLG_SPEED is // faster and preciser.)
		#define SEFLG_SPEED          256L     // high precision speed (analyt. comp.)
		#define SEFLG_NOGDEFL        512L     // turn off gravitational deflection
		#define SEFLG_NOABERR        1024L     // turn off 'annual' aberration of light
		#define SEFLG_EQUATORIAL     2048L     // equatorial positions are wanted
		#define SEFLG_XYZ            4096L     // cartesian, not polar, coordinates
		#define SEFLG_RADIANS        8192L     // coordinates in radians, not degrees
		#define SEFLG_BARYCTR        16384L     // barycentric positions
		#define SEFLG_TOPOCTR      (32*1024L)     // topocentric positions
		#define SEFLG_SIDEREAL     (64*1024L)     // sidereal positions 		
		"""
        #check for apparent geocentric (default), true geocentric, topocentric or heliocentric
        iflag = swe.FLG_SWIEPH + swe.FLG_SPEED
        if (openastrocfg['postype'] == "truegeo"):
            iflag += swe.FLG_TRUEPOS
        elif (openastrocfg['postype'] == "topo"):
            iflag += swe.FLG_TOPOCTR
        elif (openastrocfg['postype'] == "helio"):
            iflag += swe.FLG_HELCTR

        #sidereal
        if (openastrocfg['zodiactype'] == "sidereal"):
            iflag += swe.FLG_SIDEREAL
            mode = "SIDM_" + openastrocfg['siderealmode']
            swe.set_sid_mode(getattr(swe, mode.encode("ascii")))

        #compute a planet (longitude,latitude,distance,long.speed,lat.speed,speed)
        for i in range(23):
            ret_flag = swe.calc_ut(self.jul_day_UT, i, iflag)
            for x in range(len(zodiac)):
                deg_low = float(x * 30)
                deg_high = float((x + 1) * 30)
                if ret_flag[0] >= deg_low:
                    if ret_flag[0] <= deg_high:
                        self.planets_sign[i] = x
                        self.planets_degree[i] = ret_flag[0] - deg_low
                        self.planets_degree_ut[i] = ret_flag[0]
                        #if latitude speed is negative, there is retrograde
                        if ret_flag[3] < 0:
                            self.planets_retrograde[i] = True
                        else:
                            self.planets_retrograde[i] = False

        #available house systems:
        """
		hsys= ‘P’     Placidus
				‘K’     Koch
				‘O’     Porphyrius
				‘R’     Regiomontanus
				‘C’     Campanus
				‘A’ or ‘E’     Equal (cusp 1 is Ascendant)
				‘V’     Vehlow equal (Asc. in middle of house 1)
				‘X’     axial rotation system
				‘H’     azimuthal or horizontal system
				‘T’     Polich/Page (“topocentric” system)
				‘B’     Alcabitus
				‘G’     Gauquelin sectors
				‘M’     Morinus
		"""
        #houses calculation (hsys=P for Placidus)
        #check for polar circle latitude < -66 > 66
        if houses_override:
            self.jul_day_UT = swe.julday(houses_override[0],
                                         houses_override[1],
                                         houses_override[2],
                                         houses_override[3])

        if geolat > 66.0:
            geolat = 66.0
            print("polar circle override for houses, using 66 degrees")
        elif geolat < -66.0:
            geolat = -66.0
            print("polar circle override for houses, using -66 degrees")
        #sidereal houses
        if (openastrocfg['zodiactype'] == "sidereal"):
            sh = swe.houses_ex(self.jul_day_UT, geolat, geolon,
                               openastrocfg['houses_system'].encode("ascii"),
                               swe.FLG_SIDEREAL)
        else:
            sh = swe.houses(self.jul_day_UT, geolat, geolon,
                            openastrocfg['houses_system'].encode("ascii"))
        self.houses_degree_ut = list(sh[0])
        self.houses_degree = list(range(len(self.houses_degree_ut)))
        self.houses_sign = list(range(len(self.houses_degree_ut)))
        for i in range(12):
            for x in range(len(zodiac)):
                deg_low = float(x * 30)
                deg_high = float((x + 1) * 30)
                if self.houses_degree_ut[i] >= deg_low:
                    if self.houses_degree_ut[i] <= deg_high:
                        self.houses_sign[i] = x
                        self.houses_degree[
                            i] = self.houses_degree_ut[i] - deg_low

        #compute additional points and angles
        #list index 23 is asc, 24 is Mc, 25 is Dsc, 26 is Ic
        self.planets_degree_ut[23] = self.houses_degree_ut[0]
        self.planets_degree_ut[24] = self.houses_degree_ut[9]
        self.planets_degree_ut[25] = self.houses_degree_ut[6]
        self.planets_degree_ut[26] = self.houses_degree_ut[3]
        #arabic parts
        sun, moon, asc = self.planets_degree_ut[0], self.planets_degree_ut[
            1], self.planets_degree_ut[23]
        dsc, venus = self.planets_degree_ut[25], self.planets_degree_ut[3]
        #list index 27 is day pars
        self.planets_degree_ut[27] = asc + (moon - sun)
        #list index 28 is night pars
        self.planets_degree_ut[28] = asc + (sun - moon)
        #list index 29 is South Node
        self.planets_degree_ut[29] = self.planets_degree_ut[10] - 180.0
        #list index 30 is marriage pars
        self.planets_degree_ut[30] = (asc + dsc) - venus
        #if planet degrees is greater than 360 substract 360 or below 0 add 360
        for i in range(23, 31):
            if self.planets_degree_ut[i] > 360.0:
                self.planets_degree_ut[i] = self.planets_degree_ut[i] - 360.0
            elif self.planets_degree_ut[i] < 0.0:
                self.planets_degree_ut[i] = self.planets_degree_ut[i] + 360.0
            #get zodiac sign
            for x in range(12):
                deg_low = float(x * 30.0)
                deg_high = float((x + 1.0) * 30.0)
                if self.planets_degree_ut[i] >= deg_low:
                    if self.planets_degree_ut[i] <= deg_high:
                        self.planets_sign[i] = x
                        self.planets_degree[
                            i] = self.planets_degree_ut[i] - deg_low
                        self.planets_retrograde[i] = False

        #close swiss ephemeris
        swe.close()
예제 #12
0
파일: swiss.py 프로젝트: raininja/openastro
    def __init__(self,
                 year,
                 month,
                 day,
                 hour,
                 geolon,
                 geolat,
                 altitude,
                 planets,
                 zodiac,
                 openastrocfg,
                 houses_override=None):
        #ephemeris path (default "/usr/share/swisseph:/usr/local/share/swisseph")
        swe.set_ephe_path(ephe_path)

        #basic location
        self.jul_day_UT = swe.julday(year, month, day, hour)
        self.geo_loc = swe.set_topo(geolon, geolat, altitude)

        #output variables
        self.planets_sign = list(range(len(planets)))
        self.planets_degree = list(range(len(planets)))
        self.planets_degree_ut = list(range(len(planets)))
        self.planets_info_string = list(range(len(planets)))
        self.planets_retrograde = list(range(len(planets)))

        #iflag
        """
		#define SEFLG_JPLEPH         1L     // use JPL ephemeris
		#define SEFLG_SWIEPH         2L     // use SWISSEPH ephemeris, default
		#define SEFLG_MOSEPH         4L     // use Moshier ephemeris
		#define SEFLG_HELCTR         8L     // return heliocentric position
		#define SEFLG_TRUEPOS        16L     // return true positions, not apparent
		#define SEFLG_J2000          32L     // no precession, i.e. give J2000 equinox
		#define SEFLG_NONUT          64L     // no nutation, i.e. mean equinox of date
		#define SEFLG_SPEED3         128L     // speed from 3 positions (do not use it, SEFLG_SPEED is // faster and preciser.)
		#define SEFLG_SPEED          256L     // high precision speed (analyt. comp.)
		#define SEFLG_NOGDEFL        512L     // turn off gravitational deflection
		#define SEFLG_NOABERR        1024L     // turn off 'annual' aberration of light
		#define SEFLG_EQUATORIAL     2048L     // equatorial positions are wanted
		#define SEFLG_XYZ            4096L     // cartesian, not polar, coordinates
		#define SEFLG_RADIANS        8192L     // coordinates in radians, not degrees
		#define SEFLG_BARYCTR        16384L     // barycentric positions
		#define SEFLG_TOPOCTR      (32*1024L)     // topocentric positions
		#define SEFLG_SIDEREAL     (64*1024L)     // sidereal positions
		"""
        #check for apparent geocentric (default), true geocentric, topocentric or heliocentric
        iflag = swe.FLG_SWIEPH + swe.FLG_SPEED
        if (openastrocfg['postype'] == "truegeo"):
            iflag += swe.FLG_TRUEPOS
        elif (openastrocfg['postype'] == "topo"):
            iflag += swe.FLG_TOPOCTR
        elif (openastrocfg['postype'] == "helio"):
            iflag += swe.FLG_HELCTR

        #sidereal
        if (openastrocfg['zodiactype'] == "sidereal"):
            iflag += swe.FLG_SIDEREAL
            mode = "SIDM_" + openastrocfg['siderealmode']
            swe.set_sid_mode(getattr(swe, mode))

        #compute a planet (longitude,latitude,distance,long.speed,lat.speed,speed)
        for i in range(23):
            ret_flag = swe.calc_ut(self.jul_day_UT, i, iflag)
            for x in range(len(zodiac)):
                deg_low = float(x * 30)
                deg_high = float((x + 1) * 30)
                if ret_flag[0] >= deg_low:
                    if ret_flag[0] <= deg_high:
                        self.planets_sign[i] = x
                        self.planets_degree[i] = ret_flag[0] - deg_low
                        self.planets_degree_ut[i] = ret_flag[0]
                        #if latitude speed is negative, there is retrograde
                        if ret_flag[3] < 0:
                            self.planets_retrograde[i] = True
                        else:
                            self.planets_retrograde[i] = False

        #available house systems:
        """
		hsys= 		‘P’     Placidus
				‘K’     Koch
				‘O’     Porphyrius
				‘R’     Regiomontanus
				‘C’     Campanus
				‘A’ or ‘E’     Equal (cusp 1 is Ascendant)
				‘V’     Vehlow equal (Asc. in middle of house 1)
				‘X’     axial rotation system
				‘H’     azimuthal or horizontal system
				‘T’     Polich/Page (“topocentric” system)
				‘B’     Alcabitus
				‘G’     Gauquelin sectors
				‘M’     Morinus
		"""
        #houses calculation (hsys=P for Placidus)
        #check for polar circle latitude < -66 > 66
        if houses_override:
            self.jul_day_UT = swe.julday(houses_override[0],
                                         houses_override[1],
                                         houses_override[2],
                                         houses_override[3])

        if geolat > 66.0:
            geolat = 66.0
            print("polar circle override for houses, using 66 degrees")
        elif geolat < -66.0:
            geolat = -66.0
            print("polar circle override for houses, using -66 degrees")

        #sidereal houses
        if (openastrocfg['zodiactype'] == "sidereal"):
            sh = swe.houses_ex(self.jul_day_UT, geolat, geolon,
                               openastrocfg['houses_system'].encode("ascii"),
                               swe.FLG_SIDEREAL)
        else:
            sh = swe.houses(self.jul_day_UT, geolat, geolon,
                            openastrocfg['houses_system'].encode("ascii"))

        self.houses_degree_ut = list(sh[0])

        #arabic parts
        sun, moon, asc = self.planets_degree_ut[0], self.planets_degree_ut[
            1], self.houses_degree_ut[0]
        dsc, venus = self.houses_degree_ut[6], self.planets_degree_ut[3]

        #offset
        offset = moon - sun

        #if planet degrees is greater than 360 substract 360 or below 0 add 360
        for i in range(len(self.houses_degree_ut)):
            #add offset
            #self.houses_degree_ut[i] += offset

            if self.houses_degree_ut[i] > 360.0:
                self.houses_degree_ut[i] = self.houses_degree_ut[i] - 360.0
            elif self.houses_degree_ut[i] < 0.0:
                self.houses_degree_ut[i] = self.houses_degree_ut[i] + 360.0

        self.houses_degree = list(range(len(self.houses_degree_ut)))
        self.houses_sign = list(range(len(self.houses_degree_ut)))
        for i in range(12):
            for x in range(len(zodiac)):
                deg_low = float(x * 30)
                deg_high = float((x + 1) * 30)
                if self.houses_degree_ut[i] >= deg_low:
                    if self.houses_degree_ut[i] <= deg_high:
                        self.houses_sign[i] = x
                        self.houses_degree[
                            i] = self.houses_degree_ut[i] - deg_low

        #mean apogee
        bm = self.planets_degree_ut[12]
        #mean north node
        mn = self.planets_degree_ut[10]
        #perigee lunaire moyen
        pl = self.planets_degree_ut[22]
        #perigee solaire moyen
        #define SE_NODBIT_MEAN          1
        #define SE_NODBIT_OSCU          2
        #define SE_NODBIT_OSCU_BAR     4
        #define SE_NODBIT_FOPOINT     256
        #Return: 4 tuples of 6 float (asc, des, per, aph)
        ps = swe.nod_aps_ut(self.jul_day_UT, 0, swe.NODBIT_MEAN, iflag)
        pl = swe.nod_aps_ut(self.jul_day_UT, 1, swe.NODBIT_MEAN, iflag)
        ps = ps[2][0]
        pl = pl[2][0]
        #print mn
        #print sun
        #print ps
        #print moon
        #print pl

        c = 1.517 * math.sin(2 * math.radians(sun - mn))
        c += -0.163 * math.sin(math.radians(sun - ps))
        c += -0.128 * math.sin(2 * math.radians(moon - sun))
        c += 0.120 * math.sin(2 * math.radians(moon - mn))
        c += 0.107 * math.sin(2 * math.radians(pl - mn))
        c += 0.063 * math.sin(math.radians(3 * sun - ps - 2 * mn))
        c += 0.040 * math.sin(math.radians(moon + pl - 2 * sun))
        c += -0.040 * math.sin(math.radians(moon + pl - 2 * mn))
        c += 0.027 * math.sin(math.radians(moon - pl))
        c += -0.027 * math.sin(math.radians(sun + ps - 2 * mn))
        c += 0.015 * math.sin(2 * math.radians(sun - pl))
        c += -0.013 * math.sin(math.radians(moon + 2 * mn - pl - 2 * sun))
        c += -0.013 * math.sin(math.radians(moon - 2 * mn - pl + 2 * sun))
        c += -0.007 * math.sin(math.radians(2 * moon + pl - 3 * sun))
        c += 0.005 * math.sin(math.radians(3 * moon - pl - 2 * mn))
        c += -0.005 * math.sin(math.radians(3 * moon - pl - 2 * sun))
        #print c

        sbm = sun - bm
        if sbm < 0: sbm += 360
        if sbm > 180.0: sbm -= 180
        print("sun %s black moon %s sun-bm %s=%s" % (sun, bm, sun - bm, sbm))

        q = 12.333
        if sbm < 60.0:
            print('sbm<60')
            c = q * math.sin(1.5 * math.radians(sbm))
        elif sbm > 120.0:
            print('sbm>120')
            c = q * math.cos(1.5 * math.radians(sbm))
        else:
            print('sbm 60-120')
            c = -q * math.cos(3.0 * math.radians(sbm))

        true_lilith = c

        def true_lilith_calc(sun, lilith):
            deg = sun - lilith
            q = 12.333
            if deg < 0.0: deg += 360.0
            if deg > 180.0: deg -= 180.0

            if deg < 60.0:
                return q * math.sin(1.5 * math.radians(deg)
                                    ) - 1.892 * math.sin(3 * math.radians(deg))
            elif deg > 120.0:
                return q * math.cos(1.5 * math.radians(deg)
                                    ) + 1.892 * math.sin(3 * math.radians(deg))
            elif deg < 100.0:
                return -q * math.cos(
                    3.0 * math.radians(deg)) + 0.821 * math.cos(
                        4.5 * math.radians(deg))
            else:
                return -q * math.cos(3.0 * math.radians(deg))

        def true_lilith_calc2(sun, lilith):
            deg = sun - lilith
            q = 12.333
            if deg < 0.0: deg += 360.0
            if deg > 180.0: deg -= 180.0

            if deg < 60.0: return q * math.sin(1.5 * math.radians(deg))
            elif deg > 120.0: return q * math.cos(1.5 * math.radians(deg))
            else: return -q * math.cos(3.0 * math.radians(deg))

        true_lilith = true_lilith_calc2(sun, bm)
        #print c
        """
		if sbm < 60.0:
			print 'sbm 0-60'
			c=  q * math.sin(1.5*math.radians(sbm)) - 0.0917
		elif sbm >= 60.0 and sbm < 120.0:
			print 'sbm 60-120'
			c= -q * math.cos(3*math.radians(sbm)) - 0.0917
		elif sbm >= 120.0 and sbm < 240.0:
			print 'sbm 120-240'
			c= q * math.cos(1.5*math.radians(sbm)) - 0.0917
		elif sbm >= 240.0 and sbm < 300.0:
			print 'sbm 240-300'
			c= q * math.cos(3*math.radians(sbm)) - 0.0917
		else:
			print 'sbm 300-360'
			c= -q * math.sin(1.5*math.radians(sbm)) - 0.0917
		"""
        c += -0.117 * math.sin(math.radians(sun - ps))
        #print c

        #c+= x * -0.163 * math.sin(math.radians(sun-ps))
        #c+= x * -0.128 * math.sin(2*math.radians(moon-sun))
        #c+= x * 0.120 * math.sin(2*math.radians(moon-bm))
        #c+= x * 0.107 * math.sin(2*math.radians(pl-bm))
        #c+= x * 0.063 * math.sin(math.radians(3*sun-ps-2*bm))
        #c+= x * 0.040 * math.sin(math.radians(moon+pl-2*sun))
        #c+= x * -0.040 * math.sin(math.radians(moon+pl-2*bm))
        #c+= x * 0.027 * math.sin(math.radians(moon-pl))
        #c+= x * -0.027 * math.sin(math.radians(sun+ps-2*bm))
        #c+= x * 0.015 * math.sin(2*math.radians(sun-pl))
        #c+= x * -0.013 * math.sin(math.radians(moon+2*bm-pl-2*sun))
        #c+= x * -0.013 * math.sin(math.radians(moon-2*bm-pl+2*sun))
        #c+= x * -0.007 * math.sin(math.radians(2*moon+pl-3*sun))
        #c+= x * 0.005 * math.sin(math.radians(3*moon-pl-2*bm))
        #c+= x * -0.005 * math.sin(math.radians(3*moon-pl-2*sun))

        #compute additional points and angles
        #list index 23 is asc, 24 is Mc, 25 is Dsc, 26 is Ic
        self.planets_degree_ut[23] = self.houses_degree_ut[0]
        self.planets_degree_ut[24] = self.houses_degree_ut[9]
        self.planets_degree_ut[25] = self.houses_degree_ut[6]
        self.planets_degree_ut[26] = self.houses_degree_ut[3]

        #list index 27 is day pars
        self.planets_degree_ut[27] = asc + (moon - sun)
        #list index 28 is night pars
        self.planets_degree_ut[28] = asc + (sun - moon)
        #list index 29 is South Node
        self.planets_degree_ut[29] = self.planets_degree_ut[10] - 180.0
        #list index 30 is marriage pars
        self.planets_degree_ut[30] = (asc + dsc) - venus
        #list index 31 is black sun
        self.planets_degree_ut[31] = swe.nod_aps_ut(self.jul_day_UT, 0,
                                                    swe.NODBIT_MEAN,
                                                    swe.FLG_SWIEPH)[3][0]
        #list index 32 is vulcanus
        self.planets_degree_ut[32] = 31.1 + (self.jul_day_UT -
                                             2425246.5) * 0.00150579
        #list index 33 is persephone
        self.planets_degree_ut[33] = 240.0 + (self.jul_day_UT -
                                              2425246.5) * 0.002737829
        #list index 34 is true lilith (own calculation)
        self.planets_degree_ut[34] = self.planets_degree_ut[12] + true_lilith
        #swiss ephemeris version of true lilith
        #self.planets_degree_ut[34] = swe.nod_aps_ut(self.jul_day_UT,1,swe.NODBIT_OSCU,swe.FLG_SWIEPH)[3][0]

        #adjust list index 32 and 33
        for i in range(23, 35):
            while (self.planets_degree_ut[i] < 0):
                self.planets_degree_ut[i] += 360.0
            while (self.planets_degree_ut[i] > 360.0):
                self.planets_degree_ut[i] -= 360.0

            #get zodiac sign
            for x in range(12):
                deg_low = float(x * 30.0)
                deg_high = float((x + 1.0) * 30.0)
                if self.planets_degree_ut[i] >= deg_low:
                    if self.planets_degree_ut[i] <= deg_high:
                        self.planets_sign[i] = x
                        self.planets_degree[
                            i] = self.planets_degree_ut[i] - deg_low
                        self.planets_retrograde[i] = False

        #lunar phase, anti-clockwise degrees between sun and moon
        ddeg = moon - sun
        if ddeg < 0: ddeg += 360.0
        step = 360.0 / 28.0
        print(moon, sun, ddeg)
        for x in range(28):
            low = x * step
            high = (x + 1) * step
            if ddeg >= low and ddeg < high: mphase = x + 1
        sunstep = [
            0, 30, 40, 50, 60, 70, 80, 90, 120, 130, 140, 150, 160, 170, 180,
            210, 220, 230, 240, 250, 260, 270, 300, 310, 320, 330, 340, 350
        ]
        for x in range(len(sunstep)):
            low = sunstep[x]
            if x is 27: high = 360
            else: high = sunstep[x + 1]
            if ddeg >= low and ddeg < high: sphase = x + 1
        self.lunar_phase = {
            "degrees": ddeg,
            "moon_phase": mphase,
            "sun_phase": sphase
        }

        #close swiss ephemeris
        swe.close()