Skip to main content
 首页 » 编程设计

python之给定 RA/Dec 的 pyephem FixedObject()

2025年05月04日6zengkefu

我正在寻找确定 RA/Dec 在特定时间从 Mauna Kea 确定(不知名)恒星的 alt/az。我正在尝试使用 pyephem 计算这些参数,但生成的 alt/az 与其他来源不一致。以下是 Keck 对 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,正确的 alt/az 应该是:62:26:03 349:15:13 。我做错了什么?

编辑:更正纬度和经度,以前是颠倒的。

请您参考如下方法:

首先,你有倒退的时间和纬度;其次,您需要提供十六进制形式的字符串;第三,您需要提供 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