00001 /* 00002 * Copyright (C) 2007 Bernd Machenschalk, Reinhard Prix 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with with program; see the file COPYING. If not, write to the 00016 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00017 * MA 02111-1307 USA 00018 */ 00019 00020 /******************************* <lalVerbatim file="SkyCoordinatesLaldocHV"> 00021 Author: Creighton, T. D. 00022 $Id: SkyCoordinatesLaldoc.h,v 1.6 2008/05/21 06:23:32 teviet Exp $ 00023 **************************************************** </lalVerbatim> */ 00024 00025 /********************************************************** <lalLaTeX> 00026 00027 \section{Header \texttt{SkyCoordinates.h}} 00028 \label{s:SkyCoordinates.h} 00029 00030 Provides routines to convert among various sky coordinate systems. 00031 00032 \subsection*{Synopsis} 00033 \begin{verbatim} 00034 #include <lal/SkyCoordinates.h> 00035 00036 \end{verbatim} 00037 00038 This header covers routines to perform coordinate transformations 00039 among the various spherical coordinate systems used in astronomy. 00040 Most of these routines are discussed in Sec.~5.1 00041 of~\cite{Lang_K:1999}; we reproduce here some of the essential 00042 elements of this discussion. 00043 00044 \begin{wrapfigure}{r}{0.55\textwidth} 00045 \vspace{-2ex} 00046 \begin{center} 00047 \resizebox{0.5\textwidth}{!}{\includegraphics{inject_lat_long}} \\ 00048 \parbox{0.5\textwidth}{\caption{\label{fig:lat-long} Definition of 00049 latitude $\phi$ and longitude $\lambda$ for an arbitrary coordinate 00050 system.}} 00051 \end{center} 00052 \vspace{-2ex} 00053 \end{wrapfigure} 00054 A general spatial coordinate system is shown in 00055 Fig.~\ref{fig:lat-long}. It is defined by six parameters: three 00056 positions specifying the location of the origin $O$, two angles 00057 specifying the direction of the \emph{pole} or $z$-axis, and one 00058 further angle specifying a \emph{reference meridian} or $x$-axis 00059 orthogonal to the $z$-axis. A $y$-axis can also be defined such that 00060 $x$, $y$, and $z$ form an orthogonal right-handed coordinate system; 00061 however, in astronomy it is more conventional to use spherical 00062 coordinates, defined as follows: 00063 00064 For any given point $P$, define a plane (called its meridian) 00065 containing both the $z$-axis and the point in question. The 00066 \emph{longitude} $\lambda$ is the angle in the $x$-$y$ plane from the 00067 $x$-axis to the line where the object's meridian crosses the $x$-$y$ 00068 plane. The \emph{latitude} $\phi$ is the angle in the meridian plane 00069 between this line and the direction to the object. The 00070 \emph{distance} $r$ is simply measured in a straight line from the 00071 origin to the point. Longitude is defined to increase in the 00072 right-handed direction about the $z$-axis (i.e.\ the $y$-axis lies at 00073 \emph{positive} $\pi/2$~radians longitude), and is typically given in 00074 the range $[0,2\pi)$~radians. Latitude is defined to increase towards 00075 the $z$-axis (i.e.\ the $z$-axis lies at \emph{positive} 00076 $\pi/2$~radians latitude), and is typically given in the range 00077 $[-\pi/2,\pi/2]$~radians; a point with latitude $\pm\pi/2$~radians has 00078 arbitrary (undefined) longitude. Distance should always be positive. 00079 This convention is shown in Fig.~\ref{fig:lat-long}. 00080 00081 In the routines in this module, we do not perform transformations 00082 between coordinate systems having different origins. By default, all 00083 coordinates are assumed to be centred on the observer; however, one 00084 may also consider coordinate systems that are \emph{geogentric} 00085 (having their origin at the centre of the Earth), \emph{heliocentric} 00086 (origin at the centre of the Sun), \emph{barycentric} (origin at the 00087 centre of mass of the solar system), and \emph{Galactocentric} (origin 00088 at the centre of our Galaxy). Since we ignore translations in the 00089 coordinate origin, distances remain unchanged, so these routines only 00090 consider transformations in latitude and longitude. To put it another 00091 way, these routines transform \emph{directions} in space, not 00092 \emph{locations} in space. These directions are generically stored in 00093 the \verb@SkyPosition@ structure, defined below. 00094 00095 The coordinate systems that we consider are defined as follows: 00096 00097 00098 \newpage 00099 \begin{wrapfigure}{r}{0.63\textwidth} 00100 \vspace{-2ex} 00101 \begin{center} 00102 \resizebox{0.58\textwidth}{!}{\includegraphics{inject_horizon}} \\ 00103 \parbox{0.58\textwidth}{\caption{\label{fig:horizon} Definition of the 00104 horizon coordinate system.}} 00105 \end{center} 00106 \vspace{-2ex} 00107 \end{wrapfigure} 00108 \paragraph{Horizon coordinates:} This is a local coordinate system for 00109 a particular observation point $O$ on the Earth, as shown in 00110 Fig.~\ref{fig:horizon}. The $z$-axis is defined to be the direction 00111 opposite to the local acceleration due to gravity. The $x$-axis is 00112 defined to lie in the plane formed by the $z$-axis and the Earth's 00113 rotational axis, and to be directed into the northern hemisphere. In 00114 this coordinate system, the latitude coordinate is called the 00115 \emph{altitude} and the longitude coordinate is the \emph{negative} of 00116 what astronomers call the \emph{azimuth}; this sign reversal is due to 00117 the fact that astronomers define azimuth to increase clockwise, and 00118 our longitudinal coordinates uniformly increase counterclockwise about 00119 the $z$-axis. 00120 00121 This coordinate system is related to the geographic coordinate system 00122 (below) by the geographic latitude $\phi_z$ and longitude $\lambda_z$ 00123 of the observer's $z$-axis direction. 00124 00125 \begin{wrapfigure}{l}{0.43\textwidth} 00126 \vspace{-4ex} 00127 \begin{center} 00128 \resizebox{0.38\textwidth}{!}{\includegraphics{inject_geographic}} \\ 00129 \parbox{0.38\textwidth}{\caption{\label{fig:geographic} Definition of 00130 the geographic (Earth-fixed) coordinate system.}} 00131 \end{center} 00132 \end{wrapfigure} 00133 \paragraph{Geographic coordinates:} This is a planetwide Earth-fixed 00134 coordinate system, shown in Fig.~\ref{fig:geographic}. The $z$-axis 00135 is defined to be parallel to the Earth's axis, in the direction of the 00136 Earth's north pole. The $x$-axis is defined to be parallel to the 00137 direction perpendicular from the Earth's rotation axis to a reference 00138 point in Greenwich, UK (the \emph{prime meridian}. Note that we adopt 00139 a longitude convention that is consistent with the 00140 \textit{Astronomical Almanac}, but opposite to that 00141 in~\cite{Lang_K:1999}, in that our geographic longitudes increase 00142 \emph{eastward} (counterclockwise) like the rest of our longitudinal 00143 coordinates. 00144 00145 The terms ``latitude'' and ``longitude'' without qualification 00146 normally refer to geographic latitude and longitude. However, we 00147 emphasize once again that geographic latitude and longitude as defined 00148 above refer to directions in space, not to locations on the Earth's 00149 surface. This can lead to some confusion. The \emph{geodetic} 00150 latitude and longitude of a point on the Earth's surface are the 00151 latitude and longitude of its vertical direction; this is the standard 00152 meaning used by cartographers, and relates directly to the 00153 horizon-based coordinate system above. However, one can also define a 00154 \emph{geocentric} latitude and longitude for a point on the surface, 00155 which are the latitude and longitude of the direction from the 00156 geometric centre of the Earth through that point. These angles are 00157 not necessarily the same, due to the Earth's ellipticity, as shown in 00158 Fig.~\ref{fig:geodetic} in \verb@TerrestrialCoordinates.h@. 00159 00160 Geographic coordinates are related to sky-fixed equatorial coordinates 00161 by specifying the counterclockwise angle \emph{to} the prime meridian 00162 \emph{from} the reference meridian $\Upsilon$ of the sky-fixed 00163 coordinates, as defined below. This angle is called the Greenwich 00164 Mean Sidereal Time (GMST), and is often specified in hours, minutes, 00165 and seconds. 00166 00167 \newpage 00168 \begin{wrapfigure}{r}{0.46\textwidth} 00169 \vspace{-2ex} 00170 \begin{center} 00171 \resizebox{0.41\textwidth}{!}{\includegraphics{inject_ecliptic}} \\ 00172 \parbox{0.41\textwidth}{\caption{\label{fig:ecliptic} Definition of 00173 the ecliptic sky-fixed coordinate systems.}} 00174 \end{center} 00175 \vspace{-2ex} 00176 \end{wrapfigure} 00177 \paragraph{Equatorial coordinates:} This is the standard sky-fixed 00178 coordinate system. The $z$-axis is defined as for geographic 00179 coordinates, above; the plane orthogonal to this passing through the 00180 Earth's centre is called the \emph{equator}. The $x$-axis is defined 00181 to be the direction, as viewed from the centre of the Earth, where the 00182 Sun appears to cross the equator moving north in spring. This is 00183 called the \emph{vernal equinox} $\Upsilon$, and is shown in 00184 Fig.~\ref{fig:ecliptic}. In this coordinate system, the latitude 00185 coordinate is called the \emph{declination} $\delta$ and the longitude 00186 coordinate is called the \emph{right ascension} $\alpha$. 00187 00188 \paragraph{Ecliptic coordinates:} This is another sky-fixed coordinate 00189 system, shown in Fig.~\ref{fig:ecliptic}. The $z$-axis is defined to 00190 be the direction orthogonal to the orbital plane of the Earth about 00191 the Sun, directed such that the Earth orbits in a right-handed sense. 00192 The $x$-axis is defined as for equatorial coordinates, above; we note 00193 that by definition it lies parallel to the intersection of the 00194 equatorial and orbital planes of the Earth. 00195 00196 The equatorial and ecliptic coordinate systems are related by a single 00197 angle $\epsilon$, called the \emph{obliquity of the ecliptic} (that 00198 is, the inclination of the Earth's rotation axis relative to its 00199 orbital axis). Ecliptic latitude is normally denoted as $\beta$ and 00200 ecliptic longitude as $\lambda$. 00201 00202 \begin{wrapfigure}{l}{0.505\textwidth} 00203 \vspace{-4ex} 00204 \begin{center} 00205 \resizebox{0.455\textwidth}{!}{\includegraphics{inject_galactic}} \\ 00206 \parbox{0.455\textwidth}{\caption{\label{fig:galactic} Definition of 00207 the Galactic coordinate system.}} 00208 \end{center} 00209 \end{wrapfigure} 00210 \paragraph{Galactic coordinates:} This coordinate system is shown in 00211 Fig.~\ref{fig:galactic}. The $z$-axis is defined to be the direction 00212 orthogonal to the plane of our Galaxy and pointing into the northern 00213 hemisphere of the equatorial coordinate system. (Unfortunately this 00214 convention has the unintuitive result that the physical rotation of 00215 the Galaxy is left-handed about this axis.) The $x$-axis is defined 00216 to be the direction of the Galactic centre as viewed from the Earth. 00217 The Galactic latitude coordinate is normally denoted as $b$ and the 00218 Galactic longitude as $l$. 00219 00220 The definition of the Galactic coordinate system is completely 00221 unrelated to any of the the other coordinate systems; thus, the 00222 relationship between Galactic and equatorial coodinates requires one 00223 to specify three arbitrary (but constant) angles. Two of these are 00224 the right ascension $\alpha_\mathrm{NGP}$ and declination 00225 $\delta_\mathrm{NPG}$ of the North Galactic Pole ($z$-axis) in the 00226 equatorial coordinate system, the third is the Galactic longitude 00227 $l_\mathrm{ascend}$ of the point where the Galactic plane ascends 00228 through the equatorial plane; i.e.\ the $l$ value for the direction 00229 along the intersection of the Galactic and equatorial planes, such 00230 that right-handed rotation about the Galactic $z$-axis moves you from 00231 south to north through the equator. 00232 00233 ******************************************************* </lalLaTeX> */ 00234 00235 /********************************************************** <lalLaTeX> 00236 \subsection*{Error conditions} 00237 ****************************************** </lalLaTeX><lalErrTable> */ 00238 /* 00239 #define SKYCOORDINATESH_ENUL 1 00240 #define SKYCOORDINATESH_ESYS 2 00241 #define SKYCOORDINATESH_EZERO 3 00242 #define SKYCOORDINATESH_ESING 4 00243 00244 #define SKYCOORDINATESH_MSGENUL "Unexpected null pointer in arguments" 00245 #define SKYCOORDINATESH_MSGESYS "Wrong coordinate system in input" 00246 #define SKYCOORDINATESH_MSGEZERO "Angular coordinates undefined at origin" 00247 #define SKYCOORDINATESH_MSGESING "Point is inside singular ellipsoid" 00248 */ 00249 /******************************************** </lalErrTable><lalLaTeX> 00250 00251 \subsection*{Types} 00252 00253 \subsubsection*{Enumeration \texttt{CoordinateSystem}} 00254 \idx[Type]{CoordinateSystem} 00255 00256 This enumerated type is used to identify data as being in one of the 00257 coordinate systems discussed above. The allowed values are: 00258 00259 \idx[Constant]{COORDINATESYSTEM\_HORIZON} 00260 \idx[Constant]{COORDINATESYSTEM\_GEOGRAPHIC} 00261 \idx[Constant]{COORDINATESYSTEM\_EQUATORIAL} 00262 \idx[Constant]{COORDINATESYSTEM\_ECLIPTIC} 00263 \idx[Constant]{COORDINATESYSTEM\_GALACTIC} 00264 \medskip\noindent 00265 \begin{tabular}{ll} 00266 \verb@COORDINATESYSTEM_HORIZON@ & A horizon coordinate system. \\ 00267 \verb@COORDINATESYSTEM_GEOGRAPHIC@ & The Earth-fixed geographic 00268 coordinate system. \\ 00269 \verb@COORDINATESYSTEM_EQUATORIAL@ & The sky-fixed equatorial 00270 coordinate system. \\ 00271 \verb@COORDINATESYSTEM_ECLIPTIC@ & The ecliptic coordinate system. \\ 00272 \verb@COORDINATESYSTEM_GALACTIC@ & The galactic coordinate system. 00273 \end{tabular} 00274 \bigskip 00275 00276 ******************************************************* </lalLaTeX> */ 00277 00278 /********************************************************** <lalLaTeX> 00279 00280 \subsubsection*{Structure \texttt{SkyPosition}} 00281 \idx[Type]{SkyPosition} 00282 00283 This structure stores the two spherical coordinates of a sky position; 00284 i.e.\ a generic latitude and longitude. The structure is not defined 00285 specific to a particular coordinate system, but maintains a tag 00286 indicating which coordinate system it is expressed in. The fields 00287 are: 00288 00289 \begin{description} 00290 \item[\texttt{REAL8 longitude}] The longitudinal coordinate (in 00291 radians), as defined above. 00292 00293 \item[\texttt{REAL8 latitude}] The latitudinal coordinate (in 00294 radians), as defined above. 00295 00296 \item[\texttt{CoordinateSystem system}] The coordinate system in which 00297 the latitude and longitude have been expressed. 00298 \end{description} 00299 00300 ******************************************************* </lalLaTeX> */ 00301 00302 /********************************************************** <lalLaTeX> 00303 00304 \subsubsection*{Structure \texttt{EarthPosition}} 00305 \idx[Type]{EarthPosition} 00306 00307 This structure stores the location of a point on (or near) the surface 00308 of the Earth in both geodetic and geocentric coordinates, as described 00309 in \verb@TerrestrialCoordinates.c@. The fields are: 00310 00311 \begin{description} 00312 \item[\texttt{SkyPosition geodetic}] The geographic coordinates of the 00313 upward vertical direction from the point; that is, the point's 00314 \emph{geodetic} latitude and longitude. 00315 00316 \item[\texttt{REAL8 elevation}] The vertical distance of the point above 00317 the reference ellipsoid, in metres. 00318 00319 \item[\texttt{REAL8 x, y, z}] The Earth-fixed geocentric Cartesian 00320 coordinates of the point, in metres. 00321 00322 \item[\texttt{REAL8 radius}] The distance of the point from the 00323 geocentre, in metres. 00324 00325 \item[\texttt{SkyPosition geocentric}] The geographic coordinates of 00326 the direction from the centre of the Earth through the point; that is, 00327 the point's \emph{geocentric} latitude and longitude. 00328 \end{description} 00329 00330 ******************************************************* </lalLaTeX> */ 00331 00332 /********************************************************** <lalLaTeX> 00333 00334 \subsubsection*{Structure \texttt{ConvertSkyParams}} 00335 \idx[Type]{ConvertSkyParams} 00336 00337 This structure stores parameters for the function 00338 \verb@LALConvertSkyPosition()@. The fields are: 00339 00340 \begin{description} 00341 \item[\texttt{CoordinateSystem system}] The coordinate system to which 00342 one is transforming. 00343 00344 \item[\texttt{SkyPosition *zenith}] The position of the zenith of the 00345 horizon coordinate system; may be \verb@NULL@ if one is neither 00346 converting to nor from a horizon system. 00347 00348 \item[\texttt{LIGOTimeGPS *gpsTime}] The GPS time for conversions 00349 between Earth-fixed and sky-fixed coordinates; may be \verb@NULL@ if 00350 no such conversion is required (or if one is transforming to or from 00351 horizon coordinates and \verb@*zenith@ is given in the sky-fixed 00352 equatorial system). 00353 \end{description} 00354 00355 ******************************************************* </lalLaTeX> */ 00356 00357 /* <lalLaTeX> 00358 \vfill{\footnotesize\input{SkyCoordinatesLaldocHV}} 00359 </lalLaTeX> */ 00360 00361 00362 /* Function prototypes. */ 00363 00364 /* <lalLaTeX> 00365 \newpage\input{CelestialCoordinatesLaldocC} 00366 </lalLaTeX> */ 00367 00368 /* <lalLaTeX> 00369 \newpage\input{TerrestrialCoordinatesC} 00370 </lalLaTeX> */ 00371 00372 /* <lalLaTeX> 00373 \newpage\input{SkyCoordinatesC} 00374 </lalLaTeX> */ 00375 00376 /* <lalLaTeX> 00377 \newpage\input{SkyCoordinatesTestC} 00378 </lalLaTeX> */ 00379 00380 /* <lalLaTeX> 00381 \newpage\input{GeocentricGeodeticTestC} 00382 </lalLaTeX> */ 00383 00384 #include <lal/LALRCSID.h> 00385 NRCSID (SKYCOORDINATESLALDOCH,"$Id: SkyCoordinatesLaldoc.h,v 1.6 2008/05/21 06:23:32 teviet Exp $");
1.5.2