我正在探索 Brandon Rhodes 的宏伟软件 Skyfield 的可能性。我已经制作了一个脚本来计算随机对象之间的右升序中的连接。我使用以下脚本:
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 的时间实例。
不幸的是,我得到了这些结果:
Aldebaran and venus
Diff: 4.600705365706519, ra_Aldebaran: 4.6176105612629375, ra_venus: 0.016905195556418524
2020-02-07T21:20:06Z,16.962942031863825
Diff: -0.0014205156698450239, ra_Aldebaran: 4.617748605529588, ra_venus: 4.619169121199433
2020-04-17T20:25:49Z,-10.136618155596008
Diff: -0.000670093218860579, ra_Aldebaran: 4.617892691238783, ra_venus: 4.618562784457644
2020-06-08T07:56:08Z,-4.921187478324768
Diff: -0.0001286749609095139, ra_Aldebaran: 4.618000948409605, ra_venus: 4.618129623370515
2020-07-12T06:44:16Z,-0.962286810883981
Regulus and venus
Diff: 10.140247344361857, ra_Regulus: 10.157152539918275, ra_venus: 0.016905195556418524
2020-02-07T21:20:06Z,12.28436748615726
Diff: 5.852858068422506e-06, ra_Regulus: 10.157702949500333, ra_venus: 10.157697096642265
2020-10-02T23:42:45Z,0.0903429562716429
Pollux and venus
Diff: 7.758742204719277, ra_Pollux: 7.7756474002756955, ra_venus: 0.016905195556418524
2020-02-07T21:20:06Z,28.391501492522927
Diff: 0.001226225278400328, ra_Pollux: 7.776229220287632, ra_venus: 7.775002995009232
2020-09-01T16:39:22Z,8.682000412217121
Antares and venus
Diff: 16.493491164600684, ra_Antares: 16.510396360157102, ra_venus: 0.016905195556418524
2020-02-07T21:20:06Z,-26.059118330110437
Diff: 0.000832014094154232, ra_Antares: 16.51126040187071, ra_venus: 16.510428387776557
2020-12-23T00:34:39Z,-5.652225571050259
以“Diff”开头的行是监控输出有效性的行。Diff 代表计算得出的 RA 差异。它应该接近于零。其他两个值是两个对象的赤经。它们应该非常相似。第二行是我想要的结果,它是计算的时间和对象之间的距离(以度为单位)。正如您所看到的,出于某种原因,对于每组对象,我得到了时间实例的无效结果:2020-02-07T21:20:06Z,并且该实例的差异值肯定不会接近于零。如果我将对象金星更改为月球,情况会变得更糟,因为每秒钟的结果都是无效的。我对照 Skychart / Cartes du Ciel 软件和那些结帐检查了其他结果。
我无法弄清楚这里出了什么问题。有人能帮助我吗?