我正在探索 Brandon Rhodes 开发的出色软件 Skyfield 的可能性。我制作了一个脚本来计算随机对象之间的 Right Ascension 连词。我使用以下脚本:
from skyfield import almanac
from skyfield.searchlib import find_maxima, find_minima, find_discrete
from skyfield.api import Star, load
from datetime import datetime, date,timedelta
import pytz
planets = load('de430t.bsp')
earth = planets['earth']
x = [
['Aldebaran',[4, 35, 55.2],[16, 30, 33]],
['Regulus',[10, 8, 22.3],[11, 58, 2]],
['Pollux',[7, 45, 18.9],[28, 1, 34]],
['Antares',[16, 29, 24.4],[-26, 25, 55]],
]
ts = load.timescale(builtin=True)
t = ts.now()
tzn = 'Europe/Amsterdam'
tz = pytz.timezone(tzn)
now = datetime(2020, 1, 1, 0, 0, 0)
t0 = ts.utc(tz.localize(now))
t1 = ts.utc(tz.localize(now) + timedelta(days=+365))
def difference(t):
e = earth.at(t)
ra11, dec11, distance = e.observe(object).radec()
ra12, dec12, distance2 = e.observe(planets[target1]).radec()
diff = ra11.hours - ra12.hours
return diff >= 0
difference.rough_period = 1.0
for count in range (len(x)):
object = Star(ra_hours=(x[count][1][0], x[count][1][1], x[count][1][2]),dec_degrees=(x[count][2][0], x[count][2][1], x[count][2][2]))
target1 = 'venus'
t, b = find_discrete(t0, t1, difference)
if len(t) > 0:
print (f"{x[count][0]} and {target1}")
for i, (a, b) in enumerate(zip(t, b)):
e = earth.at(a)
ra11, dec11, distance = e.observe(object).radec('date')
ra12, dec12, distance2 = e.observe(planets[target1]).radec('date')
print (f"Diff: {ra11.hours - ra12.hours}, ra_{x[count][0]}: {ra11.hours}, ra_{target1}: {ra12.hours}")
print(f"{a.utc_iso()},{dec11._degrees - dec12._degrees}")
print ("")
我相信这是在计算两个对象具有相同 RA 的时间实例。
以“Diff”开头的行是监视输出有效性的行。Diff 代表计算出的 RA 差异。它应该接近于零。其他两个值是两个对象的赤经。它们应该非常相似。第二行是我想要的结果,它是计算的时间和对象之间的度数距离。正如您所看到的,出于某种原因,对于每组对象,我得到了时间实例的无效结果:2020-02-07T21:20:06Z,并且该实例的差值肯定不接近于零。如果我将对象 venus 更改为 moon 它会变得更糟,因为每秒结果都是无效的。我根据 Skychart / Cartes du Ciel 软件和那些结帐检查了其他结果。
我不知道这里出了什么问题。有人能帮助我吗?
紫衣仙女
相关分类