Index: trunk/doc/pslib/psLibADD.tex
===================================================================
--- trunk/doc/pslib/psLibADD.tex	(revision 1548)
+++ trunk/doc/pslib/psLibADD.tex	(revision 1554)
@@ -1,3 +1,3 @@
-%%% $Id: psLibADD.tex,v 1.24 2004-08-16 19:12:54 eugene Exp $
+%%% $Id: psLibADD.tex,v 1.25 2004-08-17 01:56:41 eugene Exp $
 \documentclass[panstarrs]{panstarrs}
 
@@ -644,12 +644,17 @@
 
 Correct time representation is critical in astronomical software.
-PSLib uses the \code{psTime} structure to represent all time
-values.  This structure represents a time which is equivalent to TAI
-(International Atomic Time) and has the following properties:
-\begin{itemize}
-\item it represents both seconds and microseconds
-\item the seconds are continuous (no leap seconds)
-\item the zero reference point is \tbd{1970/01/01,00:00:10} UTC.
-\end{itemize}
+PSLib uses the \code{psTime} structure to represent all time values.
+This structure represents a time which is consists of seconds and
+fractions of seconds in a time system defined by the \code{psTimeType}
+element \code{type}.  Two possible time systems are currently
+available: TAI and UTC.  Both are defined in terms of the reference
+epoch 1970-01-01T00:00:00Z, but with minor modifications for
+leap-seconds as needed.  The first represenatation, TAI (International
+Atomic Time), has seconds of uniform length and no leap seconds.  The
+exact zero reference is 1970/01/01,00:00:10 UTC.  The second
+representations is UTC, which has seconds of uniform length and
+leap-seconds as needed to adjust it to remain within 0.9 seconds of
+the Earth's rotation.  It has a zero-point of exactly
+1970/01/01,00:00:00 UTC.
 
 Julian Day (JD) and Modified Julian Day (MJD) are both continuous time
@@ -708,4 +713,19 @@
 \end{verbatim}
 
+The conversion from a time and longitude to local mean sidereal time
+is performed using the SLA Lib function \code{sla_GMST}.  This
+function requires the value $\Delta$ UT1 = UTC - UT1.  The value of
+$\Delta$ UT1 may be determined from the following site in real time:
+
+\code{ftp://maia.usno.navy.mil/ser7/ser7.dat}
+
+In addition, the long-term values may be determined from the table
+found at: \code{ftp://maia.usno.navy.mil/ser7/finals.all}.  See also
+the web page \code{http://maia.usno.navy.mil/}.  The most significant
+accuracy requirements are for the current value when calculating the
+LST.  For this purpose, the table above (\code{ser7.dat}), which
+provides predictions over a 2 month period, must be made available
+locally to PSLib and updated regularly. 
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
@@ -842,16 +862,36 @@
 \subsubsection{Projections}
 
-We implement three types of projections, {\em zenithal} and {\em
-cylindrical} and {\em pseudocylindrical} projections.  These three
-require slightly different handling.  Our representations are based on
-the treatment of projections presented by
+We implement three types of projections: {\em zenithal}, {\em
+cylindrical} and {\em pseudocylindrical}, each requiring slightly
+different handling.  Our representations are based on the treatment of
+projections presented by
 \href{http://www.cv.nrao.edu/fits/documents/wcs/wcs.all.ps}{Greisen \&
-Calabretta (1995, ADASS, 4, 233)}.
+Calabretta (1995, ADASS, 4, 233)}.  In all of these projections, we
+are converting from a spherical coordinate $\alpha,\delta$ to a linear
+(2-D) coordinate $x_p,y_p$.  The projection is defined by the
+projection type, the projection center ($\alpha_p, \delta_p$) and the
+the plate scales in the $x_p$ and $y_p$ directions ($\rho_x,\rho_y$).
+
+In the structure, \code{psProjection}, the projection type is defined
+by the element \code{type}, the projection center $\alpha_p,\delta_p$
+is defined by the elements \code{R,D}, and the plate scales,
+$\rho_x,\rho_y$, are defined by the elements \code{Xs,Ys}.  The plate
+scales are applied independently to the $x$ and $y$ coordinates to
+convert them to the corresponding linear units (ie, pixels):
+%
+\begin{eqnarray}
+x_p & = & \rho_x x \\
+y_p & = & \rho_y y \\
+\end{eqnarray}
+% 
+In the discussions below, we ignore this last step (or first step,
+depending on the direction of the conversion).
 
 \paragraph{Zenithal Projections}
 
 The {\em zenithal} projections are defined relative to a set of
-spherical coordinates whose pole is the center of the projection
-($\alpha_p, \delta_p$, or \code{psProjection.R, psProjection.D}).  In
+spherical coordinates with pole at the center of the projection
+($\alpha_p, \delta_p$), and which thus represents a coordinate system
+rotated relative to the coordinate system of $\alpha, \delta$.  In
 this spherical coordinate system, the coordinate of longitude is
 labeled $\phi$, and has domain of $-\pi < \phi \le \pi$, while the
@@ -859,37 +899,10 @@
 $0 \le \theta \le \pi$.
 
-For zenithal projections (e.g.\ Gnomonic and Orthographic) the
-following hold:
-%
-\begin{eqnarray}
-x & = & R_\theta \sin \phi \\
-y & = & -R_\theta \cos \phi
-\end{eqnarray}
-%
-and
-%
-\begin{eqnarray}
-R_\theta & = & \sqrt{x^2 + y^2} \\
-\phi     & = & {\rm arg} (-y,x)
-\end{eqnarray}
-%
-The coordinates $x,y$ above are defined to be in angular units (ie,
-radians).  The plate scales ($\rho_x, \rho_y$ = \code{psProjection.Xs,
-psProjection.Ys}) are applied independently to the $x$ and $y$
-coordinates to convert them to the corresponding linear units (ie,
-pixels):
-%
-\begin{eqnarray}
-x_p & = & \rho_x x \\
-y_p & = & \rho_y y \\
-\end{eqnarray}
-
 For an arbitrary projection center, it is necessary to convert the
 spherical coordinates to be projected ($\alpha,\delta$) to the
-projection spherical coordinate system coordinates ($\phi, \theta$)
-from which $x,y$ may be calculated using the relationships above,
-given a prescription for $R_\theta$.  In practice, we construct the
-following useful trigonometric relationships between $\phi$ and
-$\theta$ which may be employed in the equations of $x,y$ above:
+projection spherical coordinate system coordinates ($\phi, \theta$).
+In practice, we construct the following useful trigonometric
+relationships between $\phi$ and $\theta$ which may be employed in the
+equations of $x,y$ below:
 %
 \begin{eqnarray}
@@ -907,17 +920,27 @@
 \end{eqnarray}
 %
+For zenithal projections, the linear coordinates are related to
+$\phi,\theta$ by:
+%
+\begin{eqnarray}
+x & = & R_\theta \sin \phi \\
+y & = & -R_\theta \cos \phi
+\end{eqnarray}
+%
+and the inverse:
+%
+\begin{eqnarray}
+R_\theta & = & \sqrt{x^2 + y^2} \\
+\phi     & = & {\rm arg} (-y,x)
+\end{eqnarray}
+%
+The coordinates $x,y$ above are defined to be in angular units (ie,
+radians).  
+
 From these relationships, we can calculate $\alpha, \delta$ as:
 %
 \begin{eqnarray}
-\alpha - \alpha_p & = & arg (\sin \alpha, \cos \alpha) \\
-\delta            & = & arcsin (sin \delta) \\
-\end{eqnarray}
-%
-The necessary relationships for $\phi$ are equivalent for all zenithal projections:
-%
-\begin{eqnarray}
-R_\theta  & = & \sqrt{x^2 + y^2} \\
-\sin \phi & = & x / R_\theta \\
-\cos \phi & = & -y / R_\theta \\
+\alpha - \alpha_p & = & \arctan (\sin \alpha, \cos \alpha) \\
+\delta            & = & \arcsin (\sin \delta) \\
 \end{eqnarray}
 %
@@ -933,6 +956,6 @@
 x           & = & \frac{\cos \theta \sin \phi}{\sin \theta} \\
 y           & = & \frac{-\cos \theta \cos \phi}{\sin \theta} \\
-\sin \theta & = & \zeta / \sqrt (1 + \zeta^2) \\
-\cos \theta & = & 1 / \sqrt (1 + \zeta^2) \\
+\sin \theta & = & \zeta / \sqrt{1 + \zeta^2} \\
+\cos \theta & = & 1 / \sqrt{1 + \zeta^2} \\
 \end{eqnarray}
 
@@ -958,18 +981,17 @@
 coincident with the pole of the spherical coordinates.  These
 projections are particularly used for full-sky representations, and
-are only defined for projection centers with $\delta_c = 0$.  In this
+are only defined for projection centers with $\delta_p = 0$.  In this
 spherical coordinate system, the coordinate of longitude is labeled
 $\phi$, and has domain of $-\pi < \phi \le \pi$, while the latitude,
 measured from the pole, is labeled $\theta$ and has domain $0 \le
-\theta \le \pi$.  The projection center longitude, $\alpha_c$
+\theta \le \pi$.  The projection center longitude, $\alpha_p$
 corresponds to $\phi = 0$, thus the value of $\phi$ is determined as
-$\alpha - \alpha_c$ for all such projections.  The terms
-$\alpha_c,\delta_c$ are equivalent to the elements
-\code{psProjection.R} and \code{psProjection.D}.
+$\alpha - \alpha_p$ for all such projections.
 
 \subparagraph{Cartesian}
 
-The Cartesian projection (``CAR'') is a very simple cylindrical with
-the following relationships between $x,y$ and $\phi,\theta$:
+The Cartesian projection (``CAR'') is a very simple cylindrical
+projection with the following relationships between $x,y$ and
+$\phi,\theta$:
 
 \begin{eqnarray}
@@ -985,15 +1007,15 @@
 x & = & \phi \\
 y & = & \ln \left( \tan (\pi/4 + \theta/2) \right) \\
-{\rm and}\hspace{1cm} \theta & = & 2 \arctan \left( e^y \right) - \pi/2^\circ
+{\rm and}\hspace{1cm} \theta & = & 2 \arctan \left( e^y \right) - \pi/2
 \end{eqnarray}
 
 \subparagraph{Hammer-Aitoff}
 
-The Hammer-Aitoff projection is a pseudocylindrical projection, and is defined:
-
-\begin{eqnarray}
-x & = & 2 \alpha \cos \theta \sin \frac{\phi}{2} \\
-y & = & \alpha \sin \theta \\
-{\rm where}\hspace{1cm} \alpha^{-1} & \equiv & \sqrt{\frac{1}{2}\left(1 + \cos \theta \cos \frac{\phi}{2} \right)}
+The Hammer-Aitoff projection(``AIT'') is a pseudocylindrical projection, and is defined:
+
+\begin{eqnarray}
+x & = & 2 \zeta \cos \theta \sin \frac{\phi}{2} \\
+y & = & \zeta \sin \theta \\
+{\rm where}\hspace{1cm} \zeta^{-1} & \equiv & \sqrt{\frac{1}{2}\left(1 + \cos \theta \cos \frac{\phi}{2} \right)}
 \end{eqnarray}
 
@@ -1001,5 +1023,5 @@
 
 \begin{eqnarray}
-\phi & = & 2 {\rm arg} (2z^2 - 1, x z) \\
+\phi & = & 2 {\rm \arctan} (2z^2 - 1, x z) \\
 \theta & = & \arcsin (yz) \\
 {\rm where}\hspace{1cm} z & \equiv & \sqrt{1 - (x/2)^2 - y^2}
