pyephem给定赤经/赤纬的FixedObject()
我想要计算在特定时间,从毛纳基山观察某些不太知名的星星时,它们的高度和方位角。我的方法是使用pyephem这个工具来计算这些参数,但我得到的高度和方位角跟其他来源的不一致。以下是我从凯克天文台计算HAT-P-32的结果:
import ephem
telescope = ephem.Observer()
telescope.lat = '19.8210'
telescope.long = '-155.4683'
telescope.elevation = 4154
telescope.date = '2013/1/18 10:04:14'
star = ephem.FixedBody()
star._ra = ephem.degrees('02:04:10.278')
star._dec = ephem.degrees('+46:41:16.21')
star.compute(telescope)
print star.alt, star.az
结果是-28:43:54.0 73:22:55.3
,但根据Stellarium软件,正确的高度和方位角应该是62:26:03 349:15:13
。我哪里出错了呢?
编辑:我纠正了之前搞错的纬度和经度。
2 个回答
1
首先,你把经度和纬度搞反了;其次,你需要把字符串用十六进制的形式提供;最后,你需要把RA(赤经)以小时的形式提供,而不是用度数:
import ephem
telescope = ephem.Observer()
# Reversed longitude and latitude for Mauna Kea
telescope.lat = '19:49:28' # from Wikipedia
telescope.long = '-155:28:24'
telescope.elevation = 4154.
telescope.date = '2013/1/18 00:04:14'
star = ephem.FixedBody()
star._ra = ephem.hours('02:04:10.278') # in hours for RA
star._dec = ephem.degrees('+46:41:16.21')
star.compute(telescope)
这样,你就能得到:
>>> print star.alt, star.az
29:11:57.2 46:43:19.6
0
PyEphem总是使用协调世界时(UTC)来处理时间,这样无论在哪个地方运行程序,结果都是一样的。你只需要把你使用的日期转换成UTC时间,而不是用你所在的本地时区,这样得到的结果和Stellarium的结果会非常接近;你可以使用:
telescope.date = '2013/1/18 05:04:14'
得到的结果是这个高度/方位角:
62:27:19.0 349:26:19.4
要知道这两者之间小小的差异是从哪里来的,我需要研究一下这两个程序在计算每一步时是怎么处理的;不过这样做能不能让你得到足够接近的结果呢?