当前位置: 首页>>代码示例>>Python>>正文


Python swisseph.calc_ut函数代码示例

本文整理汇总了Python中swisseph.calc_ut函数的典型用法代码示例。如果您正苦于以下问题:Python calc_ut函数的具体用法?Python calc_ut怎么用?Python calc_ut使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了calc_ut函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_moon_sun_diff

def get_moon_sun_diff(day):
    degree1 = swisseph.calc_ut(day, swisseph.MOON)[0]
    degree2 = swisseph.calc_ut(day, swisseph.SUN)[0]
    swisseph.close()
    # we need some imprecision due to some oddities involving new and full moons
    diff = round(degree2 - degree1)
    return diff
开发者ID:ShadowKyogre,项目名称:ChronosLNX,代码行数:7,代码来源:astro_rewrite.py

示例2: get_last_dhanur_transit

def get_last_dhanur_transit (jd_start,latitude,longitude):
  swisseph.set_sid_mode(swisseph.SIDM_LAHIRI) #Force Lahiri Ayanamsha
  for d in range(-25,0):
    jd = jd_start + d
    [y,m,d,t] = swisseph.revjul(jd)
  
    jd_sunrise=swisseph.rise_trans(jd_start=jd,body=swisseph.SUN,lon=longitude,
      lat=latitude,rsmi=swisseph.CALC_RISE|swisseph.BIT_DISC_CENTER)[1][0]
    jd_sunrise_tmrw=swisseph.rise_trans(jd_start=jd+1,body=swisseph.SUN,
      lon=longitude,lat=latitude,rsmi=swisseph.CALC_RISE|swisseph.BIT_DISC_CENTER)[1][0]
    jd_sunset =swisseph.rise_trans(jd_start=jd,body=swisseph.SUN,lon=longitude,
      lat=latitude,rsmi=swisseph.CALC_SET|swisseph.BIT_DISC_CENTER)[1][0]
  
    longitude_sun=swisseph.calc_ut(jd_sunrise,swisseph.SUN)[0]-swisseph.get_ayanamsa(jd_sunrise)
    longitude_sun_set=swisseph.calc_ut(jd_sunset,swisseph.SUN)[0]-swisseph.get_ayanamsa(jd_sunset)
    sun_month_rise = int(1+math.floor(((longitude_sun)%360)/30.0))
    sun_month = int(1+math.floor(((longitude_sun_set)%360)/30.0))
    longitude_sun_tmrw=swisseph.calc_ut(jd_sunrise+1,swisseph.SUN)[0]-swisseph.get_ayanamsa(jd_sunrise+1)
    sun_month_tmrw = int(1+math.floor(((longitude_sun_tmrw)%360)/30.0))

    if sun_month_rise!=sun_month_tmrw:
      if sun_month!=sun_month_tmrw:
        return jd+1
      else:
        return jd
开发者ID:sreeramcoder,项目名称:panchangam,代码行数:25,代码来源:writePanchangamTeX.py

示例3: lunar_return

def lunar_return(date, month, year, data, refinements=2):  # data contains the angle, date is for a reasonable baseline
    day = datetime_to_julian(date)
    progress, cycles = math.modf((day / LUNAR_MONTH_DAYS))

    cycles = cycles + (year - date.year) * LMONTH_IN_SYEAR
    cycles = cycles + (month - date.month) * LMONTH_TO_MONTH

    day = (cycles) * LUNAR_MONTH_DAYS

    for i in range(refinements):
        angle = swisseph.calc_ut(day, swisseph.MOON)[0]
        day = day + (data - angle) / 360 * LUNAR_MONTH_DAYS

    for i in range(refinements):
        angle = swisseph.calc_ut(day, swisseph.MOON)[0]
        sec = ((data - angle) / LUNAR_DEGREE_SECOND) / SECS_TO_DAYS
        day = day + sec

    for i in range(refinements):
        angle = swisseph.calc_ut(day, swisseph.MOON)[0]
        msec = ((data - angle) / LUNAR_DEGREE_MS) / (SECS_TO_DAYS * 1000)
        day = day + msec

    for i in range(refinements):
        angle = swisseph.calc_ut(day, swisseph.MOON)[0]
        nsec = ((data - angle) / LUNAR_DEGREE_NS) / (SECS_TO_DAYS * 1000000)
        day = day + nsec

    return revjul_to_datetime(swisseph.revjul(day))
开发者ID:ShadowKyogre,项目名称:ChronosLNX,代码行数:29,代码来源:astro_rewrite.py

示例4: part_of_fortune_rudhyar

def part_of_fortune_rudhyar(cht):
	"""Calculate part of fortune (Rudhyar).
	
	:type cht: Chart
	"""
	flag = cht._filter.get_calcflag()
	sun = swe.calc_ut(cht.julday, swe.SUN, flag)
	moon = swe.calc_ut(cht.julday, swe.MOON, flag)
	pos = swe.degnorm(
		cht._houses.get_positions('Asc')._longitude + (
			swe.difdegn(moon[0], sun[0])))
	return (pos, 0, 0, 0, 0, 0)
开发者ID:astrorigin,项目名称:oroboros,代码行数:12,代码来源:parts.py

示例5: _swisseph

        def _swisseph(t, ipl):
            t = t[0]
            jd = swe.julday(t.year,t.month,t.day,t.hour+t.minute/60)
            rslt = swe.calc_ut(jd, ipl , swe.FLG_EQUATORIAL | swe.FLG_SWIEPH | swe.FLG_SPEED)
        
            if ipl == 1: #Moon
                rm = swe.calc_ut(jd, ipl , swe.FLG_EQUATORIAL | swe.FLG_SWIEPH | swe.FLG_SPEED |swe.FLG_TRUEPOS | swe.FLG_RADIANS)
                sinhp = EARTH_RADIUS / rm[2] / AUNIT
                moondist=asin(sinhp) / DEGTORAD *3600
                return rslt[0], rslt[1], moondist

            return rslt[0], rslt[1], rslt[2]
开发者ID:zhuzhenping,项目名称:TradingTensors,代码行数:12,代码来源:planetry_functions.py

示例6: solar_return

def solar_return(date, year, data, refinements=2):  # data contains the angule, date is for a reasonable baseline
    day = datetime_to_julian(date) + (SOLAR_YEAR_DAYS * (year - date.year))

    for i in range(refinements):
        angle = swisseph.calc_ut(day, swisseph.SUN)[0]
        sec = ((data - angle) / SOLAR_DEGREE_SECOND) / SECS_TO_DAYS
        day = day + sec
    for i in range(refinements):
        angle = swisseph.calc_ut(day, swisseph.SUN)[0]
        msec = ((data - angle) / SOLAR_DEGREE_MS) / (SECS_TO_DAYS * 1000)

    return revjul_to_datetime(swisseph.revjul(day + msec))
开发者ID:ShadowKyogre,项目名称:ChronosLNX,代码行数:12,代码来源:astro_rewrite.py

示例7: updatePandC

def updatePandC(date, observer, houses, entries):
    day = datetime_to_julian(date)
    obliquity = swisseph.calc_ut(day, swisseph.ECL_NUT)[0]
    cusps, asmc = swisseph.houses(day, observer.lat, observer.lng)
    fill_houses(date, observer, houses=houses, data=cusps)
    for i in range(10):
        calcs = swisseph.calc_ut(day, i)
        hom = swisseph.house_pos(asmc[2], observer.lat, obliquity, calcs[0], objlat=calcs[1])
        if i == swisseph.SUN or i == swisseph.MOON:
            retrograde = "Not Applicable"
        else:
            retrograde = str(calcs[3] < 0)
        entries[i].retrograde = retrograde
        entries[i].m.longitude = calcs[0]
        entries[i].m.latitude = calcs[1]
        entries[i].m.progress = hom % 1.0
        entries[i].m.house_info = houses[int(hom - 1)]
    if len(entries) > 10:  # add node entries
        calcs = swisseph.calc_ut(day, swisseph.TRUE_NODE)
        hom = swisseph.house_pos(asmc[2], observer.lat, obliquity, calcs[0], objlat=calcs[1])
        retrograde = "Always"

        entries[10].retrograde = retrograde
        entries[10].m.longitude = calcs[0]
        entries[10].m.latitude = calcs[1]
        entries[10].m.progress = hom % 1.0
        entries[10].m.house_info = houses[int(hom - 1)]

        # do some trickery to display the South Node
        reverse = swisseph.degnorm(calcs[0] - 180.0)
        revhouse = (int(hom) + 6) % 12
        # revprogress = 1-hom%1.0
        revprogress = hom % 1.0
        entries[11].retrograde = retrograde
        entries[11].m.longitude = reverse
        entries[11].m.latitude = calcs[1]
        entries[11].m.progress = revprogress
        entries[11].m.house_info = houses[int(revhouse - 1)]
    if len(entries) > 12:
        ascendant = asmc[0]
        descendant = cusps[6]
        mc = asmc[1]
        ic = cusps[3]
        retrograde = "Not a Planet"

        entries[12].m.longitude = ascendant
        entries[13].m.longitude = descendant
        entries[14].m.longitude = mc
        entries[15].m.longitude = ic

    swisseph.close()
开发者ID:ShadowKyogre,项目名称:ChronosLNX,代码行数:51,代码来源:astro_rewrite.py

示例8: natal_chart_calc

def natal_chart_calc(t_zone, b_offset, b_date, t_birth_hour, t_birth_min, b_latitude, b_longitude, is_time, h_type):
    date_year_birth = int(b_date.strftime("%Y"))
    date_month_birth = int(b_date.strftime("%m"))
    date_day_birth = int(b_date.strftime("%d"))
    # print 'naren', date_year_birth, date_month_birth, date_day_birth, t_birth_hour, t_birth_min, t_zone, b_offset,\
    # (t_birth_hour + (t_birth_min / 60.)) - (t_zone + b_offset)
    now_julian = swe.julday(date_year_birth, date_month_birth, date_day_birth,
                            (t_birth_hour + (t_birth_min / 60.)) - (t_zone + b_offset))
    # print now_julian
    l_birthchart = len(constants.BIRTH_PLANETS)
    bchart_pos = np.zeros(l_birthchart + 2)
    bchart_speed = np.zeros(l_birthchart)
    for i in range(l_birthchart):
        pos_p = swe.calc_ut(now_julian, constants.BIRTH_PLANETS[i])
        bchart_pos[i] = pos_p[0]
        bchart_speed[i] = pos_p[3]

    if is_time:
        house_array = (swe.houses(now_julian, b_latitude, b_longitude, h_type))
        bchart_pos[i + 1] = house_array[1][0]
        bchart_pos[i + 2] = house_array[1][1]
    else:
        bchart_pos[i + 1] = 0
        bchart_pos[i + 2] = 0
    return bchart_pos, bchart_speed
开发者ID:aman-ekant,项目名称:myastro,代码行数:25,代码来源:birthchart.py

示例9: _calc_ecl_nut

    def _calc_ecl_nut(self):
        """Calculate obliquity and nutation.

        Result is an unmodified swe.calc_ut tuple.

        """
        ##self._setup_swisseph()
        ##print self.julday
        self._ecl_nut = swe.calc_ut(self.julday, swe.ECL_NUT)
开发者ID:astrorigin,项目名称:oroboros,代码行数:9,代码来源:chartcalc.py

示例10: sweObject

def sweObject(obj, jd):
    """ Returns an object from the Ephemeris. """
    sweObj = SWE_OBJECTS[obj]
    sweList = swisseph.calc_ut(jd, sweObj)
    return {
        'id': obj,
        'lon': sweList[0],
        'lat': sweList[1],
        'lonspeed': sweList[3],
        'latspeed': sweList[4]
    }
开发者ID:ruthenium,项目名称:flatlib,代码行数:11,代码来源:swe.py

示例11: check_bodies_in_any_range

def check_bodies_in_any_range(bodies, ranges):
    for id in bodies:
        try:
            long = sweph.calc_ut(jd_now(), id, sweph.FLG_SWIEPH)[0]
        except sweph.Error as e:
            print("id %d doesn't exist: %s" % (id, e))
            next
        for range in ranges:
            if long > range[0] and long < range[1]:
                sign_idx = int(long / 30)
                deg = long - sign_idx*30
                print("%d %s: %d %s" % (id-sweph.AST_OFFSET, sweph.get_planet_name(id), deg, signs[sign_idx]))
开发者ID:ruthenium,项目名称:cerridwen,代码行数:12,代码来源:asteroids.py

示例12: calc_chart

def calc_chart(date):
    year = date.year
    month = date.month
    day = date.day
    hour = date.hour + date.minute/60
    julday = swe.julday(year, month, day, hour)
    dic = {}
    for planet_index in range(10):
        n = planets[planet_index]
        d = swe.calc_ut(julday, planet_index)[0]
        s = calc_sign(d)
        dic[n.lower()] = d
    return dic
开发者ID:flp9001,项目名称:astro,代码行数:13,代码来源:insert_data.py

示例13: calc_ut

	def calc_ut(self, jd, flag, chart=None):
		"""Return calculations results.
		
		Houses cusps are calculated in block (see chartcalc).
		Parts require that you pass the chart object.
		
		:type jd: numeric
		:type flag: int
		:type chart: ChartCalc
		:raise ValueError: invalid planet (houses)
		"""
		if self._family == 4:
			raise ValueError('Cannot calculate houses.')
		# "inverted objects". Should invert latitude too??
		elif self._num == -2: # ketu (mean)
			r = swe.calc_ut(jd, 10, flag)
			return (swe.degnorm(r[0]-180),
				r[1], r[2], r[3], r[4], r[5])
		elif self._num == -3: # ketu (true)
			r = swe.calc_ut(jd, 11, flag)
			return (swe.degnorm(r[0]-180),
				r[1], r[2], r[3], r[4], r[5])
		elif self._num == -4: # priapus (mean)
			r = swe.calc_ut(jd, 12, flag)
			return (swe.degnorm(r[0]-180),
				r[1], r[2], r[3], r[4], r[5])
		elif self._num == -5: # priapus (true)
			r = swe.calc_ut(jd, 13, flag)
			return (swe.degnorm(r[0]-180),
				r[1], r[2], r[3], r[4], r[5])
		# planets, asteroids, etc
		elif self._family in (0, 1, 3):
			return swe.calc_ut(jd, self._num, flag)
		# fixed stars
		elif self._family == 2:
			return swe.fixstar_ut(self._name, jd, flag)
		# parts
		elif self._family == 5:
			return oroboros.core.parts.calc_ut(self._name, chart)
开发者ID:astrorigin,项目名称:oroboros,代码行数:39,代码来源:planets.py

示例14: ephemeris_calc

def ephemeris_calc(t_zone, b_date, t_birth_hour, t_birth_min):
    date_year_birth = int(b_date.strftime("%Y"))
    date_month_birth = int(b_date.strftime("%m"))
    date_day_birth = int(b_date.strftime("%d"))
    now_julian = swe.julday(date_year_birth, date_month_birth, date_day_birth,
                            (t_birth_hour + (t_birth_min / 60.)) - t_zone)
    len_ephemeris = len(constants.EPHEMERIS_PLANETS)
    ephemeris_pos = np.zeros(len_ephemeris)
    ephemeris_speed = np.zeros(len_ephemeris)
    for i in range(len_ephemeris):
        pos_p = swe.calc_ut(now_julian, constants.EPHEMERIS_PLANETS[i])
        ephemeris_pos[i] = pos_p[0]
        ephemeris_speed[i] = pos_p[3]

    return ephemeris_pos, ephemeris_speed
开发者ID:aman-ekant,项目名称:myastro,代码行数:15,代码来源:birthchart.py

示例15: loc_of_planet

def loc_of_planet(planet, start, end, freq='1D', scale=1, fit360=False):
    """Calculate the locations of planet within a time span.

        parameters:

        planet: the planet variable in swisseph
        start, end: the time span
        freq: the calculation freq
        scale: mulitply the planet location

        return a pandas Series with planet location

    """

    results = []
    drange = pd.date_range(start, end, freq=freq, tz='utc')

    for date in drange:
        year   = date.year
        month  = date.month
        day    = date.day
        hour   = date.hour
        minute = date.minute
        second = date.second

        jd = swe.utc_to_jd(year, month, day, hour, minute, second, 1)
        ut = jd[1]

        loc = swe.calc_ut(ut, planet)

        results.append(loc[0]*scale)

    res = pd.Series(results, drange, name=swe.get_planet_name(planet))

    if scale > 1 and fit360:
        return res.apply(_fit360)

    return res
开发者ID:semio,项目名称:astoolbox,代码行数:38,代码来源:location.py


注:本文中的swisseph.calc_ut函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。