协调缩减python

时间:2016-04-12 20:10:03

标签: python astronomy pyephem

如何在某个站点(经度,纬度)的特定日期和时间计算观测者的恒星位置(ra,dec)?我需要用计算中包含的所有元素(恒星的正常运动,大气压力和温度......)进行全坐标减少。

我尝试过pyephem,但我不确定能否完成。

import ephem

polaris = ephem.readdb("Polaris,f|M|F7,2:31:48.704,89:15:50.72,2.02,1")

polaris.compute('2016/3/1 16:22:56')

print polaris.a_ra 
print polaris.a_dec

我也尝试过astroplan,我认为我更接近解决方案,但仍然不知道如何在减少后获得坐标并添加适当的动作。

import astropy.units as u
from astropy.coordinates import EarthLocation
from astropy.coordinates import SkyCoord
from pytz import timezone
from astroplan import Observer
from astropy.time import Time
from astroplan import FixedTarget
import numpy as np
import astropy.units as u
from astroplan.plots import plot_sky
from astroplan.plots import plot_parallactic
from astroplan.plots import plot_airmass
import matplotlib.pyplot as plt
from astroplan import FixedTarget


longitude = '21d33m20.4s'
latitude = '+43d08m24.6s'
elevation = 1150 * u.m
time = Time('2015-06-16 12:00:00')

location = EarthLocation.from_geodetic(longitude, latitude, elevation)

observer = Observer(name='Name',
               location=location,
               pressure=0.615 * u.bar,
               relative_humidity=0.11,
               temperature=0 * u.deg_C,
               timezone=timezone('Europe/Belgrade'),
               description="..")



coordinates = SkyCoord('2h31m48.704s', '89d15m50.72s', frame = 'icrs')
polaris = FixedTarget(name='Polaris', coord=coordinates)

plot_airmass(polaris, observer, time)

ax = plt.gca()
box = ax.get_position()
ax.set_position([box.x0, box.y0, box.width * 0.8, box.height * 0.8])

plt.legend(loc=1, bbox_to_anchor=(1.35, 1))
plt.show()

1 个答案:

答案 0 :(得分:1)

你可能想尝试Skyfield,它是PyEphem的继任者,已接近1.0。虽然PyEphem的底层库不存储正确的运动,但是如果它要应用适当的运动,则必须在输入期间移动所有星星,Skyfield根据存储在Star对象本身中的运动动态地执行它。您正在考虑的减少量在Skyfield中看起来像这样:

from skyfield.api import load, Star
ts = load.timescale()
t = ts.utc(2016, 4, 16, 15, 30)
planets = load('de421.bsp')
earth = planets['earth']
boston = earth.topos(longitude_degrees=(21, 33, 20.4),
                     latitude_degrees=(+43, 8, 24.6))
barnard = Star(ra_hours=(17, 57, 48.49803),
               dec_degrees=(4, 41, 36.2072),
               ra_mas_per_year=-798.71,
               dec_mas_per_year=+10337.77,
               parallax_mas=545.4,
               radial_km_per_s=-110.6)
astrometric = boston.at(t).observe(barnard)
ra, dec, distance = astrometric.radec()
print(ra)
print(dec)
apparent = astrometric.apparent()
ra, dec, distance = apparent.radec()
print(ra)
print(dec)
alt, az, distance = apparent.altaz(temperature_C=25.0,
                                   pressure_mbar=1013.25)
print(alt)
print(az)

如果您感到好奇,可以在http://rhodesmill.org/skyfield/获取进一步的文档!