• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python swisseph.calc_ut函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: calc_planets

def calc_planets():
    Planet = namedtuple('Planet', ['name', 'angle', 'sign'])
    planet_names = ['Sol', 'Lua', 'Mercurio', 'Venus', 'Marte', 'Jupiter','Saturno', 'Urano', 'Netuno' ,'Plutao']
    signs = ['Aries', 'Touro', 'Gemeos', 'Cancer', 'Leao', 'Virgem', 'Libra', 'Escorpiao', 'Sagitario', 'Capricornio', 'Aquario', 'Peixes']
    d = datetime.utcnow()
    t = list(d.timetuple()[:5])
    t[3] += t[4]/60.0
    t = t[:4]
    j = swe.julday(*t)
    result = {}
    result['date'] = d
    planets = []
    for i in range(10):
        a = swe.calc_ut(j,i)[0]
        s = signs[int(a/30)]
        
        d = {}
        d['index'] = i
        d['name'] = planet_names[i]
        d['angle'] = a
        d['sign'] = s
        planets.append(d)
    result['planets'] = planets
    return jsonify(result=result)
开发者ID:flp9001,项目名称:astro,代码行数:24,代码来源:views.py


示例17: majors

    # e["jd-ut1"] = swe.jdut1_to_utc(t[1], 1)
    # --->
    #
    # Ask for what is precious:
    #
    # 1. majors (the main things / points for astrology)
    # 2. minors (other objects - e.g. some "minor planets")
    # 3. angles (ascmc) = 8 of 10 doubles (unused 8 & 9)
    # 4. houses (cusps) = 12 of 13 doubles (unused zero)
    #

    for o in [{"what": "1", "offset": 0}, {"what": "2", "offset": 10000}]:
        iterate = re["stuff"][int(o["what"])]
        if iterate:
            for w in iterate:
                result = swe.calc_ut(t[1], (w + o["offset"]))
                output = {}
                for out in re["stuff"][0]:
                    output[out] = result[out]
                e[o["what"]][w] = output
        else:
            del e[o["what"]]

    # The angles & houses are possible only if given geo location.
    # For that, the latitude and longitude must set - to float, or
    # be able to convert to float (e.g. from string or perhaps int).
    if "geo" in re and "lat" in re["geo"] and "lon" in re["geo"] and re["geo"]["lat"] and re["geo"]["lon"]:
        e["4"], e["3"] = swe.houses(t[1], float(re["geo"]["lat"]), float(re["geo"]["lon"]), str(re["houses"] or "W"))
        # The Whole Sign default wasn't asked for.
        # None (null) or false means no houses wanted.
        if re["houses"]:
开发者ID:astrolet,项目名称:precious,代码行数:31,代码来源:ephemeris.py


示例18: declination

 def declination(self, jd=None):
     if jd is None: jd = self.jd
     flags = sweph.FLG_SWIEPH + sweph.FLG_EQUATORIAL
     dec = sweph.calc_ut(jd, self.id, flags)[1]
     return dec
开发者ID:ruthenium,项目名称:cerridwen,代码行数:5,代码来源:planets.py


示例19: enumerate

)

sn = 9*[0]
old=''
date1 = '1979-01-01'
date2 = '2030-01-01'
startdate = datetime.datetime.strptime(date1, '%Y-%m-%d')
enddate = datetime.datetime.strptime(date2, '%Y-%m-%d')
step = datetime.timedelta(days=1)

while startdate <= enddate:
	out = ''
	y,m,d = startdate.year, startdate.month, startdate.day
	j = s.julday(y, m, d, 12)
	for n, b in enumerate(planets):
		ra = (s.calc_ut(j, b))[0]
		sn[n] = int(ra//30.)
	p = sn[3]*1728+sn[8]*144+sn[6]*12+sn[5]
	q = sn[4]*1728+sn[7]*144+sn[2]*12+sn[0]
	p = "{0:x}".format(p)
	q = "{0:x}".format(q)
	if len(p) < 4:
		p = (4-len(p)) * '0' + p
	if len(q) < 4:
		q = (4-len(q)) * '0' + q
	for xx,yy in r:
		p = p.replace(yy,xx)
		q = q.replace(yy,xx)
	dmer = sn[1] - sn[0]
	if dmer == 1 or dmer == -11:
		mer = '+'
开发者ID:mdoege,项目名称:coleco_zodiac_table,代码行数:31,代码来源:coleco_table_advice_preview_create.py


示例20: speed

 def speed(self, jd=None):
     if jd is None: jd = self.jd
     speed = sweph.calc_ut(jd, self.id)[3]
     return speed
开发者ID:ruthenium,项目名称:cerridwen,代码行数:4,代码来源:planets.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python funcions.get_rec_attr函数代码示例发布时间:2022-05-27
下一篇:
Python swigibpy.EPosixClientSocket类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap