<p>How can I calculate position (alt, az) 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... )</p>

<p>I tried with pyephem but I am not sure can I finish.</p>

<pre><code>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
</code></pre>

<p>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. </p>

<pre><code>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()
</code></pre>

CC BY-SA 3.0
2016-04-15T19:19:06.750Z
The ra and dec of stars doesn't change much. Did you mean to calculate the altitude and azimuth?
James K
CC BY-SA 3.0
2016-04-15T19:21:22.107Z
Yes, I want altitude and azimuth but wit all factors included (precession, aberration, proper motion of stars...)
Prefect
CC BY-SA 3.0
2016-04-15T19:33:47.740Z
Edited the first sentence from "ra dec" to "alt az"
James K
CC BY-SA 3.0
2016-04-15T19:36:47.083Z
Have a look at the blog post https://oneau.wordpress.com/2010/07/04/astrometry-in-python-with-pyephem/
James K
CC BY-SA 3.0
2016-04-15T19:43:35.533Z
You seem to follow the astroplan example, in which alt and az are calculated as: `subaru.altaz(time, altair).alt` and `subaru.altaz(time, altair).az`.
skytux
CC BY-SA 3.0
2016-04-15T19:50:11.917Z
And if I want to do reduction for some star that is not in astroplan catalog for example I have ra, dec, proper motion (malpha, mdelta), and V, R?
Prefect
CC BY-SA 3.0
2016-04-15T20:23:16.737Z
As I can see from the examples in the astroplan site, stars can be defined from the `FixedTarget` class, using the `SkyCoord` class from astropy to input the coordinates, though it is not mentioned anything about proper motions.
skytux
CC BY-SA 4.0
2018-07-23T20:29:01.913Z
You can pass proper motion as `pm_ra_cosdec` and `pm_dec` and radial velocity (if you have it) in when you create the `SkyCoord` object e.g. `c = SkyCoord(ra=1*u.deg, dec=2*u.deg, pm_ra_cosdec=2*u.mas/u.yr, pm_dec=1*u.mas/u.yr, radial_velocity=10*u.km/u.s)`. Make sure you are consistent in the units for the proper motion in RA; sometimes the `cos(dec)` term is included and sometimes not.
astrosnapper
<coordinate><python>
Coordinates reduction python
Prefect
# Coordinates reduction python

(Asked by: username_0 on 2016-04-15)

How can I calculate position (alt, az) 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()

**Tags:** coordinate, python

> **Comments:**
> **username_1**: The ra and dec of stars doesn't change much. Did you mean to calculate the altitude and azimuth?  
> **username_0**: Yes, I want altitude and azimuth but wit all factors included (precession, aberration, proper motion of stars...)  
> **username_1**: Edited the first sentence from "ra dec" to "alt az"  
> **username_1**: Have a look at the blog post https://oneau.wordpress.com/2010/07/04/astrometry-in-python-with-pyephem/  
> **username_2**: You seem to follow the astroplan example, in which alt and az are calculated as: `subaru.altaz(time, altair).alt` and `subaru.altaz(time, altair).az`.  
> **username_0**: And if I want to do reduction for some star that is not in astroplan catalog for example I have ra, dec, proper motion (malpha, mdelta), and V, R?  
> **username_2**: As I can see from the examples in the astroplan site, stars can be defined from the `FixedTarget` class, using the `SkyCoord` class from astropy to input the coordinates, though it is not mentioned anything about proper motions.  
> **username_3**: You can pass proper motion as `pm_ra_cosdec` and `pm_dec` and radial velocity (if you have it) in when you create the `SkyCoord` object e.g. `c = SkyCoord(ra=1*u.deg, dec=2*u.deg, pm_ra_cosdec=2*u.mas/u.yr, pm_dec=1*u.mas/u.yr, radial_velocity=10*u.km/u.s)`. Make sure you are consistent in the units for the proper motion in RA; sometimes the `cos(dec)` term is included and sometimes not.  

---

## 0 answers

