Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you convert from AltAz coordinates to equatorial coordinates in Astropy

I have been trying to figure out how to convert a set of AltAz coordinates into equatorial coordinates, and so far all I have been able to find is how to convert equatorial into AltAz (but not the reverse) using the following method:

c = SkyCoord('22h50m0.19315s', '+24d36m05.6984s', frame='icrs')
loc = EarthLocation(lat = 31.7581*u.deg, lon = -95.6386*u.deg, height = 147*u.m)
time = Time('1991-06-06 12:00:00')
cAltAz = c.transform_to(AltAz(obstime = time, location = loc))

However now I want to rotate the azimuth of mpAltAz by some increment and figure out what the corresponding equatorial coordinates are of the new point.

i.e. I want something like this:

newAltAzcoordiantes = SkyCoord(alt = cAltAz.alt.deg, az = cAltAz.az.deg + x*u.deg, obstime = time, frame = 'altaz')
newAltAzcoordiantes.transform_to(ICRS)

The problem Im having though is it does not seem like I can build a SkyCoord object in the AltAz coordinate system

I hope that is clear enough, This is my first time posting on stackoverflow.

like image 715
Ari Kaplan Avatar asked Nov 09 '22 14:11

Ari Kaplan


1 Answers

I don't know much about astronomy, but it seems like there's plenty of documentation:

  • transforming between coordinates
  • full API docs for coordinates

For me, cAltAz.icrs works and returns the original c. I needed to tweak a bunch of stuff to make it work on newAltAzcoordiantes (need to define x, stop calling deg on attributes that already have units, add location):

>>> x = 5 # why not?
>>> newAltAzcoordiantes = SkyCoord(alt = cAltAz.alt, az = cAltAz.az + x*u.deg, obstime = time, frame = 'altaz', location = loc)
>>> newAltAzcoordiantes.icrs
<SkyCoord (ICRS): (ra, dec) in deg
    (341.79674062, 24.35770826)>
like image 200
Amit Kumar Gupta Avatar answered Nov 14 '22 22:11

Amit Kumar Gupta