How can I calculate position (ra, dec) of star for observer at some station (longitude, latitude) on specific date and time? I need full coordinates reduction with all elements included in calculation (proper motion of star, atmospheric pressure and temperature... )
I tried with pyephem but I am not sure can I finish.
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
I also tried with astroplan and I think that I am closer to solution, but still don't know how to get coordinates after reduction and add proper motion.
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()
You might want to try Skyfield, the successor to PyEphem which has nearly reached 1.0. While PyEphem's underlying library does not store proper motions, but instead has to move all the stars during input if it is going to apply proper motion, Skyfield does it dynamically based on the motion stored in the Star
object itself. The reduction you are considering would look something like this in 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)
Further documentation is at http://rhodesmill.org/skyfield/ if you are curious!