5

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.

Ari Kaplan
  • 75
  • 1
  • 4

1 Answers1

1

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

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)>
Amit Kumar Gupta
  • 17,184
  • 7
  • 46
  • 64
  • Well damn I was close, I really should have been able to figure that out. That's exactly what I needed though, thank you. – Ari Kaplan Apr 28 '15 at 21:03
  • 1
    Just want to mention that (for astopy version 1.3 at least) you need to call `newAltAzcoordiantes.transform_to('icrs')` – macKaiver Feb 21 '17 at 16:41