【发布时间】:2017-05-17 00:56:26
【问题描述】:
我使用 PyEphem 已经有一段时间了,但是从几天前(可能是几周?)开始,我的一个脚本就不再工作了。该脚本计算小行星的升起和落下时间,这是我使用CALLHORIZONS 从轨道元素创建的。我发现 PyEphem 没有正确计算小行星的高度 - 但是,它正确计算了太阳的高度。
这是一个最小的脚本:
import ephem
import numpy
import callhorizons
this_target = '3552'
body = callhorizons.query(this_target)
body.set_discreteepochs(2415730.0)
body.get_elements()
this_target = body.export2pyephem()[0]
### works fine for the Sun
#this_target = ephem.Sun()
date = ephem.now()
this_target.compute(date)
obs = ephem.Observer()
obs.epoch = 2000.0
obs.lon = -111.653152/180.*numpy.pi
obs.lat = 35.184108/180.*numpy.pi
obs.elevation = 2738 # m
obs.date = date
obs.horizon = 0.
# if target is '3552', this_target.alt stays constant
for time in numpy.arange(date, date+1, 0.1):
obs.date = time
this_target.compute(obs)
print time, this_target.alt, this_target.ra
### if this_target is '3552', this results in a segmentation fault
print obs.next_rising(this_target)
使用自定义目标(在本例中为3552),PyEphem 不会计算目标的高度,因此在尝试推导该目标的上升/设置时间时会遇到分段错误。
我尝试安装最新版本的 PyEphem (3.7.6.0),但没有帮助。任何人都可以复制(解释?)这个错误吗?
【问题讨论】:
标签: python-2.7 pyephem