# [AstroPy] RA/Dec to Alt/Az

Peter pslowater at gmail.com
Tue Mar 24 06:14:13 EDT 2020

```I am using Stellarium to point a custom mount at the selected object which
at this time I am just testing rotation and using the sun & shadow.
Using the code below from samples it receives the dec/asc and calculates
the alt/az.
The problem I have is that when the sun is northish the az is close to what
Stellarium shows but when east or west then the az is about 8 Deg or more
off in the calculation compared to Stellarium and the Shadow also is not
correct.
I assume it's the way I am doing the calc, does what I have look correct?
The RA/DEC from Stellarium is J2000 from what I can work out.

Peter..

dec_in = float(vals)
asc_in= float(vals)
M42 = SkyCoord(ra=float(vals)*u.degree,
dec=float(vals)*u.degree, frame='icrs')
home = EarthLocation(lat=-38.06395*u.deg, lon=145.28455*u.deg,
height=40*u.m)
utcoffset = +11*u.hour  # Eastern Daylight Time
time = Time(datetime.datetime.now())
print("Time           :",time)
time = Time(datetime.datetime.now())- utcoffset
print("Time UTC       :",time)
m33altaz = M42.transform_to(AltAz(obstime=time,location=home))
print(dec_in," : ",asc_in)
print("Postion to
move:",numpy.around((m33altaz.alt*u.deg).value,3),"  : ",numpy.around((
m33altaz.az*u.deg).value,3))
print("====")
rotation = numpy.around((m33altaz.az*u.deg).value,3)
angle = numpy.around((m33altaz.alt*u.deg).value,3)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20200324/03845c0b/attachment.html>
```

More information about the AstroPy mailing list