Difference between revisions of "Coordinates"

From AstroBaki
Jump to navigationJump to search
 
Line 4: Line 4:
  
 
===References===
 
===References===
 +
* [https://github.com/AaronParsons/ugradio/blob/master/lab_bighorn/coords.pdf Spherical/Astronomical Coordinate Transformation]
 
* [http://en.wikipedia.org/wiki/Euler_angles Euler Angles (Wikipedia)]
 
* [http://en.wikipedia.org/wiki/Euler_angles Euler Angles (Wikipedia)]
 
* [http://www.scribd.com/doc/26818237/GOLDSTEIN-Classical-Mechanics Classical Mechanics (Goldstein)], see section 4.4 (pg. 150), starting with Euler angles
 
* [http://www.scribd.com/doc/26818237/GOLDSTEIN-Classical-Mechanics Classical Mechanics (Goldstein)], see section 4.4 (pg. 150), starting with Euler angles
Line 18: Line 19:
 
\title{Spherical or Astronomical Coordinate Transformation}
 
\title{Spherical or Astronomical Coordinate Transformation}
  
    In our never-ending attempt to make your life easier, we present
+
Converting from Galactic coordinates to altitude and
you with the quickest of quick summaries of spherical coordinate
+
azimuth involves three separate coordinate transformations:
transformation with matrix techniques.  For example, you might need to
 
point the telescope at some particular position in the Galaxy.  In other
 
words, you need to convert from Galactic coordinates to altitude and
 
azimuth.  This involves three separate coordinate transformations:
 
 
Galactic longitude and latitude to equatorial right ascension and
 
Galactic longitude and latitude to equatorial right ascension and
 
declination [($l$, $b$) $\rightarrow$ ($\alpha$, $\delta$)]; to hour angle
 
declination [($l$, $b$) $\rightarrow$ ($\alpha$, $\delta$)]; to hour angle
 
and declination [($\alpha$, $\delta$) $\rightarrow$ ($ha$, $\delta$)]; to
 
and declination [($\alpha$, $\delta$) $\rightarrow$ ($ha$, $\delta$)]; to
azimuth and altitude [($ha$, $\delta$) $\rightarrow$ ($az$, $alt$)].  Or maybe
+
azimuth and altitude [($ha$, $\delta$) $\rightarrow$ ($az$, $alt$)].  
you need to go all or partway in the the other direction, i.e.  [($az$,
 
$alt$) $\rightarrow$ [($\alpha$, $\delta$)] or maybe just [($az$, $alt$)
 
$\rightarrow$ [($ha$, $\delta$)].  
 
  
    These are conversions among four spherical coordinate systems.
+
It is possible (and recommended) to implement these coordinate transformations
Such conversions involve all those complicated combinations of trig
+
using {\it rotation matrices}.  In this method, you
functions (sigh).  You can write down all these trig functions for the
 
various possible transformation---twelve possibilities in all if you
 
include going both directions.
 
 
 
    But there is a much easier, more elegant, and more politically
 
correct way: using {\it rotation matrices}.  In this method, you
 
 
generate a vector in the original coordinate system; convert the vector
 
generate a vector in the original coordinate system; convert the vector
 
to another coordinate system by rotating the coordinates using matrix
 
to another coordinate system by rotating the coordinates using matrix
 
multiplication; and convert the vector to the angles of the new
 
multiplication; and convert the vector to the angles of the new
coordinate system.
+
coordinate system.   The method is {\it general} and can be applied to {\it any}
 
+
coordinate transformation.   
    There are two big advantages with this method.  First, you can
 
apply several transformations in succession by multiplying the rotation
 
matrices in succession, so you break the process down into single
 
transformations, each with its own rotation matrix.  Second, it's easy
 
to go ``backwards''---you just use the inverse of the matrix.
 
 
 
    The method is {\it general} and can be applied to {\it any}
 
coordinate transformation.  Spherical coordinates are characterized by
 
two angles.  One ``goes around the $z$-axis''---it is like longitude on
 
the earth.  The other ``goes up and down'' and is like latitude on the
 
earth.  These angles are ``longitude-like'' and ``latitude-like'', and
 
we'll denote them by $long$ and $lat$.  Thus, for Galactic coordinates,
 
$l$ is the ``longitude-like'' $long$ and $b$ is the ``latitude-like''
 
$lat$; for equatorial coordinates, it's $\alpha$ (or $ha$) and $\delta$;
 
for terrestrial coordinates, it's $az$ and $alt$.
 
 
 
    One more thing before we get into details. Our discussion is
 
oriented towards astronomy, but the method works for any type of
 
spherical coordinate transformation. There is an excellent, short
 
discussion of the general situation in Goldstein's {\it Classical
 
Mechanics}, \S 4.4.
 
% ARP: can now get this text on the web/wikipedia
 
  
 
\section {Rotation Matrices: The Method}
 
\section {Rotation Matrices: The Method}
Line 137: Line 103:
  
 
\section {Rotation Matrices: Specific for our Problem}
 
\section {Rotation Matrices: Specific for our Problem}
 
    OK, what are these rotation matrices? We'll do you a big favor
 
and tell you. 
 
  
 
\subsection {(Ra, Dec) to (Ha, Dec)}
 
\subsection {(Ra, Dec) to (Ha, Dec)}
Line 227: Line 190:
 
\end{eqnarray}  
 
\end{eqnarray}  
  
\noindent This is from Green's {\it Spherical Astronomy}, chapter 14.6,
+
In truth,
problem 14.6 (answers in back of book).  We should've made you derive
 
this, but we're softies.  You {\it really should} at least {\it glance}
 
at Green's chapter 2.7, which defines Galactic coordinates.  In truth,
 
 
the precession of the equatorial coordinate system makes this matrix a
 
the precession of the equatorial coordinate system makes this matrix a
 
function of time: the equatorial coordinates move around the sky, but
 
function of time: the equatorial coordinates move around the sky, but

Latest revision as of 16:40, 6 February 2018

Short Topical Videos[edit]

References[edit]

Spherical or Astronomical Coordinate Transformation

Converting from Galactic coordinates to altitude and azimuth involves three separate coordinate transformations: Galactic longitude and latitude to equatorial right ascension and declination [(, ) (, )]; to hour angle and declination [(, ) (, )]; to azimuth and altitude [(, ) (, )].

It is possible (and recommended) to implement these coordinate transformations using rotation matrices. In this method, you generate a vector in the original coordinate system; convert the vector to another coordinate system by rotating the coordinates using matrix multiplication; and convert the vector to the angles of the new coordinate system. The method is general and can be applied to any coordinate transformation.

1 Rotation Matrices: The Method

To restate the problem: we start with (, ) in one coordinate system and want to convert to (, ) in some other coordinate system. Here’s the prescription:

Step 1. First, convert the angles to rectangular coordinates. One would usually call these (, , ); here, to emphasize the vector/matrix flavor, we call them (, , ) and denote the 3-element vector . To accomplish this conversion in Python:

x = numpy.array([0.,0,0])
x[0] = numpy.cos(lat) * numpy.cos(long)
x[1] = numpy.cos(lat) * numpy.sin(long)
x[2] = nump.sin(lat)

Step 2. Apply the rotation matrix (we’ll discuss its definitions below):

In Python, we’ll use numpy arrays to represent and , and you do matrix multiplication with numpy.dot:

xp = numpy.dot(R, x)

Step 3. Convert the primed rectangular coordinates to the new set of spherical coordinates :

To do these in Python, where we’ll write longp, latp:

longp = numpy.arctan2(xp[1], xp[0])
latp = numpy.arcsin(xp[2])

That’s it! If you want to “go backwards”, you just apply the matrix multiplications using the inverse matrices. For rotation matrices, the inverse is always equal to the transpose(!)[1]—symbolically for the matrix , . So to go from the primed system to the unprimed, you switch the primed and unprimed in equation (2) and use the inverse rotation matrix

and in Python…

iR = numpy.linalg.inv(R)
x = numpy.dot(iR, xp)

2 Rotation Matrices: Specific for our Problem

2.1 (Ra, Dec) to (Ha, Dec)

Converting from keeps the declination the same and uses the relationship . It is easiest to think of this in two steps, so we express

First, we rotate around the equatorial pole by an angle equal to the Local Sidereal Time (), which does :

Next, the and go in opposite directions, which is equivalent to converting from the original left-handed to a right-handed coordinate system, so the second step is just to perform this reversal:

The full rotation matrix is the matrix product . Note the order! Applying at the beginning in the matrix product means that it operates last on the vector , which is what we want. So we have as the product…

2.2 (Ha,Dec) to (Azimuth, Altitude)

Because are Earth-based coordinates, this conversion depends only on your terrestrial latitude :

2.3 Equatorial to Galactic

In truth, the precession of the equatorial coordinate system makes this matrix a function of time: the equatorial coordinates move around the sky, but the Galactic ones do not. Precession amounts to nearly an arcminute per year! In principle, you should derive the matrix for the current epoch. In practice, you may not need such high accuracy. Better than the 1950 version are the numbers for epoch 2000, which are in Green’s equation (14.55); epoch 2000 is lots closer to the present than is epoch 1950:

2.4 Precession—converting equatorial between epochs.

We won’t need these for the lab course, but we give you the info for the sake of completeness. Generating the rotation matrix for precession is a bit tedious and we won’t give the explicit formulae here. They are in Green’s book. The elements of the matrix are in equation (9.31). These elements contain angles, which depend on time as in equation (9.23) if you are converting from epoch 2000 to some other epoch. Precession isn’t all there is; for precision exceeding Failed to parse (syntax error): {\displaystyle \sim 10”} you also need to account for nutation of the Earth, which has a random component and is not completely predictable. For the complete story, see Green’s chapter 9 and The Astronomical Almanac 1998, pages B39-B43—for interested parties only!

3 Doing all this in Python

Obviously, all this stuff is simple in Python/Numpy, which deals easily with matrices. Before beginning, though, a cautionary note about 2-D arrays on computers:

3.1 Examples in Python

Test , going both forwards and backwards. For an observatory at latitude , transforms to . Hour angle is usually given in hours using sexagesimal notation: .) See the PyEphem module for functions that go back and forth between decimal and sexagesimal notations.

Test by making up your own example, using the fact that .

Test for the Crab Nebula. The Crab has 1950 equatorial coordinates Failed to parse (syntax error): {\displaystyle (\alpha , \delta )=(05^ h31^ m.5, 21^\circ 59’)} and Galactic coordinates Failed to parse (syntax error): {\displaystyle (\ell ,b)=(184^\circ 33’, -5^\circ 47’)} .

Finally, put them all together and make sure that works, too. For all of these, make sure you know how to go backwards! For example, suppose you want to convert . You need to first apply and then . So the full rotation matrix in this case is…

Again, note the order! Applying at the beginning in the matrix product means that it operates last on the vector .

[1] If you don’t believe this, check on the ’s below in §2!