IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3718


Ignore:
Timestamp:
Apr 19, 2005, 1:40:47 PM (21 years ago)
Author:
eugene
Message:

cleaned up ADD text

Location:
trunk/doc/pslib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/pslib/ChangeLogADD.tex

    r3564 r3718  
    2929\end{itemize}
    3030
    31 \subsection{Changes from version 09 (14 February 2005) to version 10 (29 March 2005}
     31\subsection{Changes from version 09 (14 February 2005) to version 10 (29 March 2005)}
    3232
    3333\begin{itemize}
     
    4848\item promoted all PSLib subsections to sections
    4949\end{itemize}
     50\end{itemize}
    5051
     52\subsection{Changes from version 10 (29 March 2005) to version 11 (19 April 2005)}
     53
     54\begin{itemize}
     55\item defined earth orientation algorithms
     56\item provided quaternions for rotations
     57\item moved some sections to reflect order in SDRS (matrix, fftw)
    5158\end{itemize}
  • trunk/doc/pslib/psLibADD.tex

    r3564 r3718  
    1 %%% $Id: psLibADD.tex,v 1.70 2005-03-30 21:14:48 eugene Exp $
     1%%% $Id: psLibADD.tex,v 1.71 2005-04-19 23:40:47 eugene Exp $
    22\documentclass[panstarrs]{panstarrs}
    33
     
    1414\project{Pan-STARRS Image Processing Pipeline}
    1515\organization{Institute for Astronomy}
    16 \version{10}
     16\version{11}
    1717\docnumber{PSDC-430-006}
    1818
    19 \setcounter{tocdepth}{5} % lowest level to be included in toc
     19% \setcounter{tocdepth}{5} % lowest level to be included in toc
    2020
    2121\newcommand\citealt{}
     
    414109 & 2005 Feb 14 & Frozen for Cycle 5 \\ \hline
    424210 & 2005 Mar 21 & Draft for Cycle 6 \\ \hline
     4311 & 2005 Apr 19 & Frozen for Cycle 6 \\ \hline
    4344\RevisionsEnd
    4445
     
    347348Note that the total adds to one --- the number of values added.
    348349
    349 \subsection{Matrix Operations}
    350 
    351 In this section, we define the linear algebra operations performed on
    352 matrices.  We have defined APIs to implement the following matrix
    353 functions:
    354 
     350\subsection{Polynomials}
     351\label{sec:polynomials}
     352
     353We will employ Chebyshev polynomials (NR \S 5.8) to approximate functions:
     354\begin{equation}
     355f(x) = \sum_{i=0}^{n} c_i T_i(x)
     356\end{equation}
     357These have some desirable features:
    355358\begin{itemize}
    356 \item Invert a matrix;
    357 \item Calculate a matrix determinant;
    358 \item Perform matrix addition, subtraction and multiplication;
    359 \item Transpose a matrix; and
    360 \item Convert a matrix to a vector.
     359\item They are bounded on $-1 < x < 1$, with the maxima and minima
     360over this range being 1 and $-1$, respectively;
     361\item Truncation of the higher-order terms leaves one with the most accurate
     362lower-order polynomial representation of the desired function.
    361363\end{itemize}
    362364
    363 Many of these operations are implemented using LU decomposition.  We
    364 define LU decomposition in the following paragraph.  Implementation of
    365 LU decomposition shall make use of the GSL function
    366 \code{gsl_linalg_LU_decomp}.
    367 
    368 \subsubsection{LU Decomposition}
    369 \label{LUdecomp}
    370 
    371 We wish to decompose the matrix $A$ with elements $a_{ij}$ into
    372 diagonal matrices that satisfy the relationship $A = L U$ where $L$ is
    373 a lower-diagonal matrix of the form:
    374 \begin{equation}
    375 L = \left(
    376 \begin{matrix}
    377 \alpha_{11} & 0           & 0           & 0 \\
    378 \alpha_{21} & \alpha_{22} & 0           & 0 \\
    379 \alpha_{31} & \alpha_{32} & \alpha_{33} & 0 \\
    380 \alpha_{41} & \alpha_{42} & \alpha_{43} & \alpha_{44} \\
    381 \end{matrix} \right)
    382 \end{equation}
    383 %
    384 (where all diagonal values $\alpha_{ii} = 1$) and $U$ is an upper-diagonal matrix of the form:
    385 \begin{equation}
    386 U = \left(
    387 \begin{matrix}
    388 \beta_{11} & \beta_{12} & \beta_{13} & \beta_{14} \\
    389 0          & \beta_{22} & \beta_{23} & \beta_{24} \\
    390 0          & 0          & \beta_{33} & \beta_{34} \\
    391 0          & 0          & 0          & \beta_{44} \\
    392 \end{matrix} \right)
    393 \end{equation}
    394 
    395 We can find the values of $\alpha_{ij}$ and $\beta_{ij}$ by following
    396 this procedure.  First, $\alpha_{ii} = 1$.  For all values of $j = 1,
    397 2, \dots, N$, follow the next steps: For each value of $i = 1, 2,
    398 \dots, j$, solve for $\beta_{ij}$ using the relationship:
    399 \begin{equation}
    400 \beta_{ij} = a_{ij} - \sum_{k=1}^{i-1} \alpha_{ik}\beta_{kj}
    401 \end{equation}
    402 For the values of $i = j+1, j+2, \dots, N$, solve for the values of
    403 $\alpha_{ij}$ with the following:
    404 %
    405 \begin{equation}
    406 \alpha_{ij} = \frac{1}{\beta_{jj}} \left( a_{ij} - \sum_{k=1}^{j-1} \alpha_{ik}\beta_{kj} \right)
    407 \end{equation}
    408 
    409 \subsubsection{Calculate a matrix determinant}
    410 
    411 The determinant $D$ of a matrix $a_{ij}$ is calculated from the
    412 product of the diagonal elements of the LU decomposition:
    413 \begin{equation}
    414 D = P_{i=1}{N} U_{ii}
    415 \end{equation}
    416 
    417 This shall be calculated using the GSL function
    418 \code{gsl_linalg_LU_det}.  If the matrix is large or the magnitude of
    419 the elements is large, the determinant may overflow the data type.  In
    420 these cases, the (natural) logarithm of the determinant may be
    421 calculated instead (as the sum of the logarithms of the diagonal
    422 elements).  In this case, the GSL function \code{gsl_linalg_LU_lndet}
    423 shall be used.
    424 
    425 \subsubsection{Solving a Linear Equation}
    426 
    427 The LU decomposition of a matrix may be used to solve the
    428 matrix equation $\sum_{j=1}^{N} A_{i,j} \times x_j = B_j $
    429 
    430 Given the LU decomposition of a matrix into $\alpha_{ij}$ and
    431 $\beta_{ij}$, the technique of back-substitution is used to solve the
    432 equation above. First solve the equation $L y = B$:
    433 \begin{eqnarray}
    434 y_1 & = & \frac{b_1}{\alpha_{11}} \\
    435 y_i & = & \frac{1}{\alpha_{ii}}\left(b_i - \sum_{j=1}^{i-1} \alpha_{ij} y_i\right)
    436 \end{eqnarray}
    437 
    438 The values of $y$ may be used to solve for $x_i$ using the
    439 relationship $U x = b$:
    440 \begin{eqnarray}
    441 x_N & = & \frac{y_N}{\beta_{NN}} \\
    442 x_i & = & \frac{1}{\beta_{ii}}\left(y_i - \sum_{j=i+1}^N \beta_{ij} y_ij\right)
    443 \end{eqnarray}
    444 
    445 \subsubsection{Invert a matrix}
    446 
    447 Inversion of a matrix using the LU decomposition is performed by
    448 performing back-subsitution to solve a series of linear equations of
    449 the form $\sum_{j=1}^{N} A_{i,j} \times x_j = B_j $ where the values
    450 of $B_j$ represent the columns of the identity matrix.  The solution
    451 vectors $x_j$ represent the columns of the inverse matrix.  This
    452 operation shall be implemented using the GSL function \code{gsl_linalg_LU_invert}.
    453 
    454 \subsubsection{Perform matrix addition, subtraction and multiplication}
    455 
    456 Matrix binary arithmetic operations differ from image binary
    457 arithmetic operations in a fundamental way: For image operations, the
    458 resulting pixel value is determined by performing the operation on the
    459 two corresponding input operand pixels.  For matrix operations, the
    460 resulting element value results from the operation on the
    461 corresponding pair of row and colum from the input matrices.  So, for
    462 example, given the input matrices $\alpha_{ij}$ and $\beta_{ij}$, the
    463 image and matrix multiplications correspond to:
    464 %
    465 \begin{eqnarray}
    466 \mbox{image}_{ij} & = & \alpha_{ij} \times \beta_{ij} \\
    467 \mbox{matrix}_{jk} = \sum_{i=1}^N \alpha_{ij} \times \beta_{ki}
    468 \end{eqnarray}
    469 %
    470 The matrix and image operations for addition and subtraction are
    471 identical: the operation is performed on the corresponding elements in
    472 each matrix.  Matrix division is not defined (to divide, the user
    473 should first invert the matrix, and then multiply).  The matrix math
    474 function \code{psMatrixOp} shall implement the matrix version of the
    475 binary arithmetical operations for the following operators: $+, -,
    476 \times$.
    477 
    478 \subsubsection{Transpose a matrix}
    479 
    480 The transpose of a matrix is simply the reorganization of the matrix
    481 elements by 'flipping' the matrix along a diagonal.  For non-square
    482 matrices with dimensions $N \times M$, the resulting matrix has
    483 dimensions $M \times N$.  The element of the output matrix $T_{ij}$ is
    484 given by
    485 %
    486 \begin{equation}
    487 T_{ij} = M_{ji}
    488 \end{equation}
    489 where $M_{ij}$ is the matrix to be transposed.
    490 
    491 \subsubsection{Convert a matrix to a vector}
    492 
    493 Matrix-to-vector conversion is only defined for a matrix that has a
    494 size of one in at least one dimension.  In that case, the elements
    495 should be extracted, and placed in a vector, with care that the
    496 \code{psType} is defined correctly --- a $1\times N$ matrix is
    497 converted to a \code{PS_DIMEN_VECTOR}-type vector, while a $N\times 1$
    498 matrix is converted to a \code{PS_DIMEN_TRANV}-type vector.
     365The first few Chebyshev polynomials are:
     366\begin{eqnarray}
     367T_0(x) & = & 1 \\
     368T_1(x) & = & x \\
     369T_2(x) & = & 2x^2 - 1 \\
     370T_3(x) & = & 4x^3 - 3x \\
     371T_4(x) & = & 8x^4 - 8x^2 + 1 \\
     372\end{eqnarray}
     373Chebyshev polynomials follow the recurrence relation:
     374\begin{equation}
     375T_{n+1} = 2xT_n - T_{n-1}
     376\end{equation}
     377
     378Practically, Chebyshev polynomials should be evaluated using Clenshaw's recurrence
     379formula (NR \S 5.5):
     380\begin{eqnarray}
     381d_j  & = & 2xd_{j+1} - d_{j+2} + c_j \\
     382f(x) & = & x*d_1 - d_2 + 1/2 c_0 \\
     383\end{eqnarray}
     384
     385It shall be the responsibility of the user to convert the domain into the range
     386$-1 < x < 1$.
     387
     388\subsubsection{Multi-dimensional polynomials}
     389
     390Multi-dimensional polynomials shall be composed of multiplications of
     3911D Chebyshev polynomials, with the coefficients stored in tensors of
     392the appropriate rank.
     393
     394%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    499395
    500396\subsection{Fitting}
     
    670566%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    671567
    672 \subsection{Polynomials}
    673 \label{sec:polynomials}
    674 
    675 We will employ Chebyshev polynomials (NR \S 5.8) to approximate functions:
    676 \begin{equation}
    677 f(x) = \sum_{i=0}^{n} c_i T_i(x)
    678 \end{equation}
    679 These have some desirable features:
    680 \begin{itemize}
    681 \item They are bounded on $-1 < x < 1$, with the maxima and minima
    682 over this range being 1 and $-1$, respectively;
    683 \item Truncation of the higher-order terms leaves one with the most accurate
    684 lower-order polynomial representation of the desired function.
    685 \end{itemize}
    686 
    687 The first few Chebyshev polynomials are:
    688 \begin{eqnarray}
    689 T_0(x) & = & 1 \\
    690 T_1(x) & = & x \\
    691 T_2(x) & = & 2x^2 - 1 \\
    692 T_3(x) & = & 4x^3 - 3x \\
    693 T_4(x) & = & 8x^4 - 8x^2 + 1 \\
    694 \end{eqnarray}
    695 Chebyshev polynomials follow the recurrence relation:
    696 \begin{equation}
    697 T_{n+1} = 2xT_n - T_{n-1}
    698 \end{equation}
    699 
    700 Practically, Chebyshev polynomials should be evaluated using Clenshaw's recurrence
    701 formula (NR \S 5.5):
    702 \begin{eqnarray}
    703 d_j  & = & 2xd_{j+1} - d_{j+2} + c_j \\
    704 f(x) & = & x*d_1 - d_2 + 1/2 c_0 \\
    705 \end{eqnarray}
    706 
    707 It shall be the responsibility of the user to convert the domain into the range
    708 $-1 < x < 1$.
    709 
    710 \subsubsection{Multi-dimensional polynomials}
    711 
    712 Multi-dimensional polynomials shall be composed of multiplications of
    713 1D Chebyshev polynomials, with the coefficients stored in tensors of
    714 the appropriate rank.
    715 
    716 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    717 
    718 \subsection{(Fast) Fourier Transforms}
    719 
    720 (Fast) Fourier Transforms (FFTs) shall be implemented using the
    721 \href{www.fftw.org}{{\em Fastest Fourier Transform in the West} (FFTW)
    722 library}.
    723 
    724 \subsubsection{FFTW Plans}
    725 
    726 FFTW requires the user to create a ``plan'' for each transform size,
    727 the time to create which is a function of the desired speed of the
    728 transform --- faster transforms for a given size (and machine) may be
    729 performed if more time is spent testing plans.
    730 
    731 In the \PS{} IPP, we will want to perform FFTs on images of common
    732 sizes (e.g.\ $512 \times 512$) regularly.  This means that we would
    733 gain from determining an FFTW plan for each of these common sizes.
    734 FFTW provides a binary, \code{fftw-wisdom} which may be used to
    735 generate and save ``wisdom''.  The location of the \code{wisdom} file
    736 will be specified as a configuration variable for the IPP (defaulting
    737 to \code{/etc/fftw/wisdom}).  The \code{wisdom} should be read in upon
    738 initialisation of the PSLib FFT functions and saved at the conclusion.
    739 
    740 \subsubsection{Function mapping}
    741 
    742 The forward and reverse transforms call the corresponding
    743 FFTW function to plan the transform:
    744 
    745 \begin{tabular}{ll}
    746   PSLib function        & Major FFTW call \\ \hline
    747 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    748   \code{psFFTForward()} & \code{fftw_plan_dft_r2c_2d()} \\
    749   \code{psFFTReverse()} & \code{fftw_plan_dft_c2r_2d()} \\
    750 \end{tabular}
    751 
    752 These plans should be formulated using the \code{FFTW_ESTIMATE} flag,
    753 which will allow FFTW to default to a minimal planning time if the
    754 wisdom has not been loaded.  Transforms should be performed out of
    755 place to avoid the need to pad the input array to hold the output.
    756 
    757 \subsubsection{More Complicated Functions}
    758 
    759 \code{psFFTCrossCorrelate()} and \code{psFFTConvolve()} both involve
    760 multiplication of two Fourier transforms.  In the former, the first
    761 Fourier transform is multiplied by the complex conjugate of the second
    762 Fourier transform to yield the Fourier transform of the
    763 cross-correlation (NR \S 13.2).  In the latter, the two Fourier
    764 transforms are multiplied directly to yield the Fourier transform of
    765 the convolution (NR \S 13.1).
    766 
    767 If the elements of the discrete Fourier transform are $C_k$, then the
    768 the elements of the power spectrum are (NR \S 13.4):
    769 \begin{eqnarray}
    770 P_0     & = & \left| C_0 \right|^2 / N^2 \\
    771 P_j     & = & \left( \left| C_j \right|^2 + \left| C_{N-j} \right|^2 \right)/ N^2 \\
    772 P_{N/2} & = & \left| C_{N/2} \right|^2 / N^2 \\
    773 \end{eqnarray}
    774 where $j = 1, 2, \ldots, (N/2 - 1)$.
    775 
    776 Note that we leave the issue of ``windowing'' the data up to the
    777 caller, and choose to normalise by $1/N^2$.
    778 
    779568\subsection{Image Manipulations}
    780569
     
    971760
    972761\pagebreak
     762
     763\subsection{Matrix Operations}
     764
     765In this section, we define the linear algebra operations performed on
     766matrices.  We have defined APIs to implement the following matrix
     767functions:
     768
     769\begin{itemize}
     770\item Invert a matrix;
     771\item Calculate a matrix determinant;
     772\item Perform matrix addition, subtraction and multiplication;
     773\item Transpose a matrix; and
     774\item Convert a matrix to a vector.
     775\end{itemize}
     776
     777Many of these operations are implemented using LU decomposition.  We
     778define LU decomposition in the following paragraph.  Implementation of
     779LU decomposition shall make use of the GSL function
     780\code{gsl_linalg_LU_decomp}.
     781
     782\subsubsection{LU Decomposition}
     783\label{LUdecomp}
     784
     785We wish to decompose the matrix $A$ with elements $a_{ij}$ into
     786diagonal matrices that satisfy the relationship $A = L U$ where $L$ is
     787a lower-diagonal matrix of the form:
     788\begin{equation}
     789L = \left(
     790\begin{matrix}
     791\alpha_{11} & 0           & 0           & 0 \\
     792\alpha_{21} & \alpha_{22} & 0           & 0 \\
     793\alpha_{31} & \alpha_{32} & \alpha_{33} & 0 \\
     794\alpha_{41} & \alpha_{42} & \alpha_{43} & \alpha_{44} \\
     795\end{matrix} \right)
     796\end{equation}
     797%
     798(where all diagonal values $\alpha_{ii} = 1$) and $U$ is an upper-diagonal matrix of the form:
     799\begin{equation}
     800U = \left(
     801\begin{matrix}
     802\beta_{11} & \beta_{12} & \beta_{13} & \beta_{14} \\
     8030          & \beta_{22} & \beta_{23} & \beta_{24} \\
     8040          & 0          & \beta_{33} & \beta_{34} \\
     8050          & 0          & 0          & \beta_{44} \\
     806\end{matrix} \right)
     807\end{equation}
     808
     809We can find the values of $\alpha_{ij}$ and $\beta_{ij}$ by following
     810this procedure.  First, $\alpha_{ii} = 1$.  For all values of $j = 1,
     8112, \dots, N$, follow the next steps: For each value of $i = 1, 2,
     812\dots, j$, solve for $\beta_{ij}$ using the relationship:
     813\begin{equation}
     814\beta_{ij} = a_{ij} - \sum_{k=1}^{i-1} \alpha_{ik}\beta_{kj}
     815\end{equation}
     816For the values of $i = j+1, j+2, \dots, N$, solve for the values of
     817$\alpha_{ij}$ with the following:
     818%
     819\begin{equation}
     820\alpha_{ij} = \frac{1}{\beta_{jj}} \left( a_{ij} - \sum_{k=1}^{j-1} \alpha_{ik}\beta_{kj} \right)
     821\end{equation}
     822
     823\subsubsection{Calculate a matrix determinant}
     824
     825The determinant $D$ of a matrix $a_{ij}$ is calculated from the
     826product of the diagonal elements of the LU decomposition:
     827\begin{equation}
     828D = P_{i=1}{N} U_{ii}
     829\end{equation}
     830
     831This shall be calculated using the GSL function
     832\code{gsl_linalg_LU_det}.  If the matrix is large or the magnitude of
     833the elements is large, the determinant may overflow the data type.  In
     834these cases, the (natural) logarithm of the determinant may be
     835calculated instead (as the sum of the logarithms of the diagonal
     836elements).  In this case, the GSL function \code{gsl_linalg_LU_lndet}
     837shall be used.
     838
     839\subsubsection{Solving a Linear Equation}
     840
     841The LU decomposition of a matrix may be used to solve the
     842matrix equation $\sum_{j=1}^{N} A_{i,j} \times x_j = B_j $
     843
     844Given the LU decomposition of a matrix into $\alpha_{ij}$ and
     845$\beta_{ij}$, the technique of back-substitution is used to solve the
     846equation above. First solve the equation $L y = B$:
     847\begin{eqnarray}
     848y_1 & = & \frac{b_1}{\alpha_{11}} \\
     849y_i & = & \frac{1}{\alpha_{ii}}\left(b_i - \sum_{j=1}^{i-1} \alpha_{ij} y_i\right)
     850\end{eqnarray}
     851
     852The values of $y$ may be used to solve for $x_i$ using the
     853relationship $U x = b$:
     854\begin{eqnarray}
     855x_N & = & \frac{y_N}{\beta_{NN}} \\
     856x_i & = & \frac{1}{\beta_{ii}}\left(y_i - \sum_{j=i+1}^N \beta_{ij} y_ij\right)
     857\end{eqnarray}
     858
     859\subsubsection{Invert a matrix}
     860
     861Inversion of a matrix using the LU decomposition is performed by
     862performing back-subsitution to solve a series of linear equations of
     863the form $\sum_{j=1}^{N} A_{i,j} \times x_j = B_j $ where the values
     864of $B_j$ represent the columns of the identity matrix.  The solution
     865vectors $x_j$ represent the columns of the inverse matrix.  This
     866operation shall be implemented using the GSL function \code{gsl_linalg_LU_invert}.
     867
     868\subsubsection{Perform matrix addition, subtraction and multiplication}
     869
     870Matrix binary arithmetic operations differ from image binary
     871arithmetic operations in a fundamental way: For image operations, the
     872resulting pixel value is determined by performing the operation on the
     873two corresponding input operand pixels.  For matrix operations, the
     874resulting element value results from the operation on the
     875corresponding pair of row and colum from the input matrices.  So, for
     876example, given the input matrices $\alpha_{ij}$ and $\beta_{ij}$, the
     877image and matrix multiplications correspond to:
     878%
     879\begin{eqnarray}
     880\mbox{image}_{ij} & = & \alpha_{ij} \times \beta_{ij} \\
     881\mbox{matrix}_{jk} = \sum_{i=1}^N \alpha_{ij} \times \beta_{ki}
     882\end{eqnarray}
     883%
     884The matrix and image operations for addition and subtraction are
     885identical: the operation is performed on the corresponding elements in
     886each matrix.  Matrix division is not defined (to divide, the user
     887should first invert the matrix, and then multiply).  The matrix math
     888function \code{psMatrixOp} shall implement the matrix version of the
     889binary arithmetical operations for the following operators: $+, -,
     890\times$.
     891
     892\subsubsection{Transpose a matrix}
     893
     894The transpose of a matrix is simply the reorganization of the matrix
     895elements by 'flipping' the matrix along a diagonal.  For non-square
     896matrices with dimensions $N \times M$, the resulting matrix has
     897dimensions $M \times N$.  The element of the output matrix $T_{ij}$ is
     898given by
     899%
     900\begin{equation}
     901T_{ij} = M_{ji}
     902\end{equation}
     903where $M_{ij}$ is the matrix to be transposed.
     904
     905\subsubsection{Convert a matrix to a vector}
     906
     907Matrix-to-vector conversion is only defined for a matrix that has a
     908size of one in at least one dimension.  In that case, the elements
     909should be extracted, and placed in a vector, with care that the
     910\code{psType} is defined correctly --- a $1\times N$ matrix is
     911converted to a \code{PS_DIMEN_VECTOR}-type vector, while a $N\times 1$
     912matrix is converted to a \code{PS_DIMEN_TRANV}-type vector.
     913
     914\subsection{(Fast) Fourier Transforms}
     915
     916(Fast) Fourier Transforms (FFTs) shall be implemented using the
     917\href{www.fftw.org}{{\em Fastest Fourier Transform in the West} (FFTW)
     918library}.
     919
     920\subsubsection{FFTW Plans}
     921
     922FFTW requires the user to create a ``plan'' for each transform size,
     923the time to create which is a function of the desired speed of the
     924transform --- faster transforms for a given size (and machine) may be
     925performed if more time is spent testing plans.
     926
     927In the \PS{} IPP, we will want to perform FFTs on images of common
     928sizes (e.g.\ $512 \times 512$) regularly.  This means that we would
     929gain from determining an FFTW plan for each of these common sizes.
     930FFTW provides a binary, \code{fftw-wisdom} which may be used to
     931generate and save ``wisdom''.  The location of the \code{wisdom} file
     932will be specified as a configuration variable for the IPP (defaulting
     933to \code{/etc/fftw/wisdom}).  The \code{wisdom} should be read in upon
     934initialisation of the PSLib FFT functions and saved at the conclusion.
     935
     936\subsubsection{Function mapping}
     937
     938The forward and reverse transforms call the corresponding
     939FFTW function to plan the transform:
     940
     941\begin{tabular}{ll}
     942  PSLib function        & Major FFTW call \\ \hline
     943%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     944  \code{psFFTForward()} & \code{fftw_plan_dft_r2c_2d()} \\
     945  \code{psFFTReverse()} & \code{fftw_plan_dft_c2r_2d()} \\
     946\end{tabular}
     947
     948These plans should be formulated using the \code{FFTW_ESTIMATE} flag,
     949which will allow FFTW to default to a minimal planning time if the
     950wisdom has not been loaded.  Transforms should be performed out of
     951place to avoid the need to pad the input array to hold the output.
     952
     953\subsubsection{More Complicated Functions}
     954
     955\code{psFFTCrossCorrelate()} and \code{psFFTConvolve()} both involve
     956multiplication of two Fourier transforms.  In the former, the first
     957Fourier transform is multiplied by the complex conjugate of the second
     958Fourier transform to yield the Fourier transform of the
     959cross-correlation (NR \S 13.2).  In the latter, the two Fourier
     960transforms are multiplied directly to yield the Fourier transform of
     961the convolution (NR \S 13.1).
     962
     963If the elements of the discrete Fourier transform are $C_k$, then the
     964the elements of the power spectrum are (NR \S 13.4):
     965\begin{eqnarray}
     966P_0     & = & \left| C_0 \right|^2 / N^2 \\
     967P_j     & = & \left( \left| C_j \right|^2 + \left| C_{N-j} \right|^2 \right)/ N^2 \\
     968P_{N/2} & = & \left| C_{N/2} \right|^2 / N^2 \\
     969\end{eqnarray}
     970where $j = 1, 2, \ldots, (N/2 - 1)$.
     971
     972Note that we leave the issue of ``windowing'' the data up to the
     973caller, and choose to normalise by $1/N^2$.
     974
    973975\section{PSLib Astronomy Utilities}
    974 
    975 Most of the astronomy utilities will be implemented through wrapping
    976 the
    977 \href{http://star-www.rl.ac.uk/star/docs/sun67.htx/sun67.html}{SLALIB
    978 Positional Astronomy Library}.  \tbd{SLAlib support will be dropped in
    979 the next release}
    980976
    981977\subsection{Time}
     
    10151011Leap-seconds are declared by the International Earth Rotation and Reference
    10161012Systems Service (IERS)\footnote{IERS website - http://www.iers.org/}.
    1017 leap-seconds only occur in the UTC time system and cannot be accurately
     1013Leap-seconds only occur in the UTC time system and cannot be accurately
    10181014predicted due to variations in the Earth's rotational period.  To determine the
    10191015number of leap-second in a given UTC date a table of leap-seconds as annouced by
     
    10211017leap-second occurs.
    10221018
    1023 For ease of conversion, UTC should be represented as the number of seconds
    1024 since the UNIX epoch of ``1970-01-01T00:00:00Z'', non-inclusive of leap-seconds.
    1025 \emph{Times will always be expressed in the 'UTC timezone'.  Use of the local
    1026 timezone is forbidden.}
     1019For ease of conversion, UTC should be represented as the number of
     1020seconds since the UNIX epoch of ``1970-01-01T00:00:00Z'',
     1021non-inclusive of leap-seconds.  \tbd{what does this statement
     1022actually mean? what is the source of time (gettimeofday?  let's be
     1023explicit here}
     1024
     1025\tbd{Times will always be expressed in the 'UTC timezone'.  Use of
     1026the local timezone is forbidden.  -- this makes no sense given that we
     1027define LST.  In any case, this statement, or somethign equivalent,
     1028belongs in the SDRS not the ADD}
    10271029
    10281030\subsubsection{International Atomic Time (TAI)}
     
    10401042
    10411043For ease of conversion, TAI should be represented as the number of
    1042 seconds since the UNIX epoch of ``1970-01-01T00:00:00Z''.
     1044seconds since the UNIX epoch of ``1970-01-01T00:00:00Z''. \tbd{what
     1045does this statement actually mean?}
    10431046
    10441047\subsubsection{Leap-seconds}
     
    10761079local disk in a known location (i.e., there is no need that it is
    10771080downloaded from the internet by PSLib).  Later, the location of this
    1078 file will be made configurable.
    1079 
    1080 This data is available from: \code{ftp://maia.usno.navy.mil/ser7/tai-utc.dat}
     1081file will be made configurable. This data is available from
     1082USNO\footnote{ftp://maia.usno.navy.mil/ser7/tai-utc.dat}.
     1083
     1084\subsubsection{Universal Time (UT1)}
     1085\label{sec:ut1}
     1086
     1087UT1 is directly tied to the rotation of the Earth.  Historically, time
     1088has been measured with respect to the rising and setting of the
     1089Sun. However, in the modern era of atomic clocks, the rotation of the
     1090Earth makes for a highly unstable time standard. Tidal effects,
     1091changes in the angular momentum of the atmosphere, seasonal changes in
     1092the polar ice caps, movement within the Earth's core, and other
     1093effects all cause measurable changes in the Earth's rotation on a
     1094daily basis.  However, UT1 is still vitally important for determining
     1095the orientation of the Earth with respect to the sky.  UT1 is
     1096calculated by applying the value UT1-UTC to the value of UTC.  UT1 is
     1097continuously measured by the International Earth Rotation Service, and
     1098tabulated values of the offset of UT1 from UTC are published at
     1099regular intervals, along with predicted future values.  The process of
     1100calculating the UT1-UTC offsets are discussed in the section on Earth
     1101Orientation (Section~\ref{sec:ut1}).
    10811102
    10821103\subsubsection{Gregorian dates to seconds}
     
    12091230
    12101231
    1211 \subsubsection{Universal Time (UT1)}
    1212 \label{sec:ut1}
    1213 
    1214 UT1 is directly tied to the rotation of the Earth.  Historically, time has been
    1215 measured with respect to the rising and setting of the Sun. However, in the
    1216 modern era of atomic clocks, the rotation of the Earth makes for a highly
    1217 unstable time standard. Tidal effects, changes in the angular momentum of the
    1218 atmosphere, seasonal changes in the polar ice caps, movement within the Earth's
    1219 core, and other effects all cause measurable changes in the Earth's rotation on
    1220 a daily basis.  However, UT1 is still vitally important for determining the
    1221 orientation of the Earth with respect to the sky.
    1222 
    1223 Since 2003-01-01, UT1 has been defined as directly proportional to the Earth
    1224 Rotation Angle (see IERS Technical Note 32\footnote{IERS Technical Note 32 -
    1225 http://maia.usno.navy.mil/conv2003.html}).  Previous to that date, a different
    1226 definition was in effect (see IERS Technical Note 21\footnote{IERS Technical
    1227 Note 21 - http://maia.usno.navy.mil/conventions.html}).  We will always use the
    1228 post-2003 definition.
    1229 
    1230 UT1 is continuously measured by the International Earth Rotation Service, and
    1231 tabulated values of the offset of UT1 from UTC are published at regular
    1232 intervals, along with predicted future values.  IERS Bulletin A gives ``rapid
    1233 response'' values necessary for real-time and near real-time data analysis
    1234 (such as Pan-STARRS Otis and IPP subsystems). Bulletin B gives the results of a
    1235 final, definitive data reduction.  An amalgam of Bulletin A and B values is
    1236 published daily on the IERS website\footnote{IERS Bulletin A \& B -
    1237 http://maia.usno.navy.mil/ser7/finals2000A.daily} along with a desciption of
    1238 the format\footnote{IERS finals2000A.daily table format -
    1239 http://maia.usno.navy.mil/ser7/readme.finals2000A}.
    1240 
    1241 The UT1 offsets should be interpolated using the prescription of IERS Gazette
    1242 \#13\footnote{IERS Gazette \#13 - http://maia.usno.navy.mil/iers-gaz13}.  This
    1243 entails using a third order polynomial to interpolate the table values, and
    1244 then applying a model for diurnal and semi-diurnal fluctuations due to tidal
    1245 effects.  An example implimentation\footnote{interp.f -
    1246 ftp://maia.usno.navy.mil/dist/interp.f} written in Fortran is available.
    1247 
    1248 \verbatiminput{interp.f}
    1249 
    1250 The Polar motion X, and Y coordinates are also important for determining the
    1251 orientation of the Earth with respect to the sky. This is also given in the
    1252 IERS publications references above, and should be interpolated in the same way.
    1253 
    12541232\subsubsection{Julian Date and Modified Julian Date}
    12551233
     
    13691347
    13701348Gives $GMST00$ in seconds.
    1371 
    1372 \subsubsection{Longitude}
    1373 
    1374 Longitudes are often expressed in the form of decimal degrees while the
    1375 algorithm for calculating GMST outputs seconds.
    1376 
    1377 \begin{equation}
    1378 1\degree = 240s
    1379 \end{equation}
    1380 
    1381 \subsubsection{Polar Motion}
    1382 \tbd{move this to Earth Motion section}
    1383 
    1384 The polar coordinates, $x_p$ and $y_p$, required for the transformation from
    1385 tangent plane to celestial coordiates (and hence \code{psGrommit}), may be
    1386 calculated through table lookups.
    1387 
    1388 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    13891349
    13901350\subsection{2D transformations}
     
    14421402%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    14431403
    1444 \subsection{Spherical Rotations with Quaternions}
     1404\subsection{Spherical Rotations}
     1405
     1406Spherical rotations may be implemented with a variety of mathematical
     1407methods.  A single rotation may be specified by three angles which
     1408describe rotations about the principal axes.  Figure~\ref{rotations}
     1409shows the rotation angles for an arbitrary 3-D rotation.  A single
     1410rotation may be represented by defining this set of Euler angles.  As
     1411an alternative, the quaternion is a convenient construct with which to
     1412represent a single rotation, and it has useful mathematical properties
     1413when applying those rotations.
     1414
     1415\begin{figure}
     1416\begin{center}
     1417\psfig{file=rotations.ps}
     1418\caption{Definition of the rotation angles\label{rotations}}
     1419\end{center}
     1420\end{figure}
    14451421
    14461422\subsubsection{Quaternion Construction}
     
    14591435Note that the sine and cosine are taken of the half angle of the
    14601436rotation.  Note also that this implies that the quaternion components
    1461 are normalized such that $|\bar{q}| \def q_0^2 + q_1^2 + q_2^2 + q_3^2
     1437are normalized such that $|\bar{q}| \equiv q_0^2 + q_1^2 + q_2^2 + q_3^2
    14621438= 1$.
    14631439
     
    14721448\subsubsection{Combining Two Rotations}
    14731449
    1474 Given two quaternions $\bar{p1}$ and $\bar{p2}$, there is a third
     1450Given two quaternions $\bar{a}$ and $\bar{b}$, there is a third
    14751451quaternion, $\bar{p}$, which represents the result of first applying
    1476 $\bar{p1}$, and then $\bar{p2}$. The components of $\bar{p}$ are given
     1452$\bar{a}$, and then $\bar{b}$. The components of $\bar{p}$ are given
    14771453by:
    14781454
    1479 \begin{verbatim}
    1480 p_0 & = &  p2_3 p1_0 + p2_2 p1_1 - p2_1 p1_2 + p2_0 p1_3 \\
    1481 p_1 & = & -p2_2 p1_0 + p2_3 p1_1 + p2_0 p1_2 + p2_1 p1_3 \\
    1482 p_2 & = &  p2_1 p1_0 - p2_0 p1_1 + p2_3 p1_2 + p2_2 p1_3 \\
    1483 p_3 & = & -p2_0 p1_0 - p2_1 p1_1 - p2_2 p1_2 + p2_3 p1_3 \\
    1484 \end{verbatim}
     1455\begin{eqnarray}
     1456p_0 & = &  b_3 a_0 + b_2 a_1 - b_1 a_2 + b_0 a_3 \\
     1457p_1 & = & -b_2 a_0 + b_3 a_1 + b_0 a_2 + b_1 a_3 \\
     1458p_2 & = &  b_1 a_0 - b_0 a_1 + b_3 a_2 + b_2 a_3 \\
     1459p_3 & = & -b_0 a_0 - b_1 a_1 - b_2 a_2 + b_3 a_3 \\
     1460\end{eqnarray}
    14851461
    14861462\subsubsection{Rotating a Vector}
    14871463
    14881464You may rotate a unit vector by first constructing a quaternion
    1489 $\bar{p2}$, whose first three components are the components of the
     1465$\bar{b}$, whose first three components are the components of the
    14901466unit vector, and whose fourth component is zero. To rotate this vector
    1491 by a quaternion $\bar{p1}$, you apply the formula above for combining
     1467by a quaternion $\bar{a}$, you apply the formula above for combining
    14921468two quaternions. The rotated vector is found in the first three
    14931469components of the resulting quaternion, $\bar{p}$.
     
    15031479    rot_{y,y} & = & -q_0 q_0 + q_1 q_1 - q_2 q_2 + q_3 q_3 \\
    15041480    rot_{z,z} & = & -q_0 q_0 - q_1 q_1 + q_2 q_2 + q_3 q_3 \\
    1505 
    15061481    rot_{x,y} & = & 2 (q_0 q_1 + q_2 q_3) \\
    15071482    rot_{y,x} & = & 2 (q_0 q_1 - q_2 q_3) \\
    1508 
    15091483    rot_{x,z} & = & 2 (q_0 q_2 - q_1 q_3) \\
    15101484    rot_{z,x} & = & 2 (q_0 q_2 + q_1 q_3) \\
    1511 
    15121485    rot_{y,z} & = & 2 (q_1 q_2 + q_0 q_3) \\
    15131486    rot_{z,y} & = & 2 (q_1 q_2 - q_0 q_3) \\
     
    15761549\end{itemize}
    15771550Note that $\theta_p$, the latitude of the source system pole in the
    1578 target system, is equal to $\delta_p$ by symmetry.
     1551target system, is equal to $\delta_p$ by symmetry.  Transformations
     1552between arbitrary systems are specified by determining the appropriate
     1553values of $\alpha_p$, $\delta_p$, and $\phi_p$, and then constructing
     1554the quarternion for this transformation.
     1555
     1556\tbd{can we drop this, since we do this with the quaternion?}
    15791557
    15801558The relevant trigonometric relationships are:
     
    16271605\subsubsection{Precession}
    16281606
    1629 The appropriate values, from Elixir, are:
     1607Approximate precession, good for modest sub-arcsecond precision, may
     1608be rapidly calculated using the following rotation angles:
    16301609\begin{eqnarray}
    16311610\alpha_p & = & 90^\circ - (0^\circ.6406161\, T + 0^\circ.0000839\, T^2 + 0^\circ.0000050\, T^3) \\
     
    16601639%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    16611640
    1662 \subsection{Tangent Plane to Sky}
    1663 
    1664 \tbd{we will replace the SLALIB version of AOPPA with a new function}
    1665 
    1666 Mappings between the tangent plane and the sky will be implemented
    1667 using SLALIB.
    1668 
    1669 To speed up the transformations, SLALIB allows the storage of
    1670 ``apparent-to-observed parameters'', which will be contained in a
    1671 \code{psGrommit}.  The \code{psGrommit} consists of the following:
    1672 \begin{enumerate}
    1673 \item geodetic latitude (radians)
    1674 \item sine and cosine of geodetic latitude
    1675 \item magnitude of diurnal aberration vector
    1676 \item height (metres)
    1677 \item ambient temperature (degrees K)
    1678 \item pressure (mB)
    1679 \item relative humidity (0--1)
    1680 \item wavelength ($\mu$m)
    1681 \item lapse rate (degrees K per metre)
    1682 \item refraction constants A and B (radians)
    1683 \item longitude + eqn of equinoxes + ``sidereal $\Delta$ UT'' (radians)
    1684 \item local apparent sidereal time (radians)
    1685 \end{enumerate}
    1686 These may be calculated using \code{sla_AOPPA}.  Note that a
    1687 \code{psGrommit} is only appropriate for a single exposure.
    1688 
    1689 Once the \code{psGrommit} has been calculated, the functions
    1690 \code{sla_OAPQK} and \code{sla_AOPQK} convert from the tangent plane
    1691 to the sky, and the sky to the tangent plane, respectively.  (Note
    1692 that ``observed'' in SLALIB refers to the tangent plane, and
    1693 ``apparent'' refers to the apparent position on the sky.)
    1694 
    1695 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1696 
    1697 \subsection{Sky to Tangent Plane (II)}
     1641\subsection{Sky to Tangent Plane}
    16981642
    16991643This section describes the transformation between celestial coordinates
     
    17251669
    17261670\begin{figure}
    1727 \psfig{file=transforms.ps}
    1728 \caption{Coordinates systems and the transformations between them}
    1729 
     1671\begin{center}
     1672\psfig{file=earthrot.ps}
     1673\caption{Coordinates systems and the transformations between them\label{earthrot}}
     1674\end{center}
    17301675\end{figure}
    1731 Figure X shows the transformation steps and intermediate coordinate systems
    1732 between celestial and local terrestrial coordinate systems. The intermediate
    1733 coordinate systems are defined below.
     1676
     1677Figure~\ref{earthrot} shows the transformation steps and intermediate
     1678coordinate systems between celestial and local terrestrial coordinate
     1679systems. The intermediate coordinate systems are defined below.
    17341680
    17351681\paragraph{ICRS}
     
    17861732\paragraph{Gravitational Deflection}
    17871733
    1788 The Sun's gravity bends the path of light rays which pass near it.
    1789 To first order, a light ray is deflected by an angle of $4GM/c^2r_0$ radians,
    1790 where $G$ is the gravitational constant,
    1791 $M$ is the mass of the Sun,
    1792 $c$ is the speed of light, and
    1793 $r_0$ is the point of closest approach to the light ray to the Sun.
    1794 To the same order this is equal to the impact parameter - i.e. the point
    1795 of closest approach if the light ray were not deflected. Note that
    1796 $r_0/d = \tan(\theta)$, where $d$ is the distance from the Earth
    1797 to the Sun, and $\theta$
    1798 is the angular separation of the star from the center of the Sun.
    1799 
    1800 There is a maximum deflection of 1.75 arc seconds if we set
    1801 $r_0$ to the radius of the sun.
    1802 Since the Sun bends light rays toward it, a star appears shifted away from the sun in the sky.
     1734The Sun's gravity bends the path of light rays which pass near it.  To
     1735first order, a light ray is deflected by an angle of $4GM/c^2r_0$
     1736radians, where $G$ is the gravitational constant, $M$ is the mass of
     1737the Sun, $c$ is the speed of light, and $r_0$ is the point of closest
     1738approach to the light ray to the Sun.  To the same order this is equal
     1739to the impact parameter - i.e. the point of closest approach if the
     1740light ray were not deflected. Note that $r_0/d = \tan(\theta)$, where
     1741$d$ is the distance from the Earth to the Sun, and $\theta$ is the
     1742angular separation of the star from the center of the Sun.
     1743
     1744There is a maximum deflection of 1.75 arc seconds if we set $r_0$ to
     1745the radius of the sun.  Since the Sun bends light rays toward it, a
     1746star appears shifted away from the sun in the sky.
    18031747
    18041748\paragraph{Aberration}
    18051749
    1806 Aberration is the apparent change in direction of a ray of light in the
    1807 reference frame of a moving observer. Traditionally the aberration
     1750Aberration is the apparent change in direction of a ray of light in
     1751the reference frame of a moving observer. Traditionally the aberration
    18081752calculation has been done with a linear expansion of the full
    18091753relativistic expression, often neglecting all but the linear term in
    1810 $v/c$, since the relativistic terms are on the order of a miliarcsecond.
    1811 However, the full relativistic expression poses no challenge for modern
    1812 computers, so psLib will use the following procedure to calculate aberration.
     1754$v/c$, since the relativistic terms are on the order of a
     1755miliarcsecond.  However, the full relativistic expression poses no
     1756challenge for modern computers, so psLib will use the following
     1757procedure to calculate aberration.
    18131758
    18141759Suppose an observer has a velocity $\beta\hat{\beta}$, with respect to
    18151760the Solar System barycenter, where $\beta$ is in units of the speed of
    1816 light, and $\hat{\beta}$ is a unit vector. Suppose also that the unit vector
    1817 $\hat{r}$ points toward a star in the barycenter frame of reference
    1818 (i.e. the ``actual'' position).
    1819 and $\hat{r}'$ gives the direction of the star in the observer's frame,
    1820 (i.e. the apparent position).
    1821 
    1822 First, decompose $\hat{r}$ into components parallel and perpendicular to
    1823 $\hat{\beta}$ by calculating
    1824 $\mu = \hat{r}\cdot\hat{\beta}$ and
     1761light, and $\hat{\beta}$ is a unit vector. Suppose also that the unit
     1762vector $\hat{r}$ points toward a star in the barycenter frame of
     1763reference (i.e. the ``actual'' position).  and $\hat{r}'$ gives the
     1764direction of the star in the observer's frame, (i.e. the apparent
     1765position).
     1766
     1767First, decompose $\hat{r}$ into components parallel and perpendicular
     1768to $\hat{\beta}$ by calculating $\mu = \hat{r}\cdot\hat{\beta}$ and
    18251769$\vec{r}_\perp = \hat{r} - \mu \hat{\beta}$.
    18261770
     
    18491793relatively rapid rotation of the Earth from the motion of its rotational axis.
    18501794
    1851 This section is largely a summary of
    1852 Chapter 5 of IERS Technical Note 32 \footnote{http://maia.usno.navy.mil/conv2003.html}
    1853 (hereafter IERS32),
    1854 which is a description of the implementation of the Resoltions of the
    1855 XXIVth General Assembly of the IAU, available from the same URL as above.
    1856 These two documents describe a set of conventions which have been in effect
    1857 since 2003-01-01. The conventions in effect before that date will not be
    1858 implemented by psLib.
    1859 
     1795This section is largely a summary of Chapter 5 of IERS Technical Note
     179632 \footnote{http://maia.usno.navy.mil/conv2003.html} (hereafter
     1797IERS32), which is a description of the implementation of the
     1798Resoltions of the XXIVth General Assembly of the IAU, available from
     1799the same URL as above.  These two documents describe a set of
     1800conventions which have been in effect since 2003-01-01. The
     1801conventions in effect before that date will not be implemented by
     1802psLib.
    18601803
    18611804\paragraph{Precession/Nutation}
    18621805
    1863 The transform between the GCRS and the CIP/CEO coordinate systems is described
    1864 by the IAU 2000A precession-nutation model, which is accurate to the
    1865 0.2 mas level.
    1866 For higher accuracy the user must apply corrections to the model, which are tabulated by the IERS.
    1867 
    1868 
    1869 
    1870 The IAU 2000A precession-nutation model may be calculated in the following
    1871 way. First calculate the time $t$ as the number of Julian centuries since
    1872 2000-01-01T12:00:00 TT.
     1806The transform between the GCRS and the CIP/CEO coordinate systems is
     1807described by the IAU 2000A precession-nutation model, which is
     1808accurate to the 0.2 mas level.  For higher accuracy the user must
     1809apply corrections to the model, which are tabulated by the IERS.
     1810
     1811The IAU 2000A precession-nutation model may be calculated in the
     1812following way. First calculate the time $t$ as the number of Julian
     1813centuries since 2000-01-01T12:00:00 TT.
    18731814
    18741815Next calculate the fundamental arguments of nutation using equations (40)
     
    19351876\end{itemize}
    19361877
    1937 
    1938 A FORTRAN reference implementation for the precession/nutation model is available from the IERS
     1878A FORTRAN reference implementation for the precession/nutation model
     1879is available from the IERS
    19391880\footnote{http://maia.usno.navy.mil/conv2000/chapter5/XYS2000A.f}.
    19401881The psLib results should agree with the reference implementation to within
    19411882the limits of numerical precision.
    19421883
    1943 Next, corrections to $X$, and $Y$ may be obtained from the IERS as part of
    1944 Bulletin A, or B. It is recommended to use the values published daily in
    1945 http://maia.usno.navy.mil/ser7/finals2000A.daily, which has the format
    1946 described by http://maia.usno.navy.mil/ser7/readme.finals2000A. The
    1947 quantities of interest are labeled dX and dY. Note that UT1$-$UTC and the
    1948 polar motion values are obtained from this same table.
    1949 
    1950 By convention, nutation terms with periods of less
    1951 than two days
    1952 are accounted for by the corresponding polar motion. So it is sufficient to
    1953 interpolate the corrections tabulated daily by the IERS, and take the result as
    1954 instantaneous values.
     1884Next, corrections to $X$, and $Y$ may be obtained from the IERS as
     1885part of Bulletin A, or B. It is recommended to use the values
     1886published daily by USNO in the table
     1887\code{finals2000A.daily}\footnote{http://maia.usno.navy.mil/ser7/finals2000A.daily},
     1888which has the format described by
     1889\code{readme.finals2000A}\footnote{http://maia.usno.navy.mil/ser7/readme.finals2000A}. The
     1890quantities of interest are labeled dX and dY. Note that UT1$-$UTC and
     1891the polar motion values are obtained from this same table.
     1892
     1893By convention, nutation terms with periods of less than two days are
     1894accounted for by the corresponding polar motion. So it is sufficient
     1895to interpolate the corrections tabulated daily by the IERS, and take
     1896the result as instantaneous values.
    19551897
    19561898The final step is to use $X$, $Y$, and $s$ to calculate the rotation
     
    19871929\paragraph{Polar Motion}
    19881930
    1989 The motion of the CIP in the ITRS is known as ``polar motion''. Similarly to
    1990 precession/nutation, the instantaneous position of the CIP in the
    1991 ITRS is specified by the quantites $x_p$, and $y_p$, and a third quantity,
    1992 $s'$, gives the position of the TEO with respect to the ITRS.
    1993 The values of $x_p$ and $y_p$ are published daily by the IERS in
    1994 http://maia.usno.navy.mil/ser7/finals2000A.daily, which has the format
    1995 described by http://maia.usno.navy.mil/ser7/readme.finals2000A.
    1996 The UT1$-$UTC, and the precession/nutation corrections (discussed elsewhere
    1997 in this document) come from this same source.
    1998 
    1999 The polar motion coordinates should be interpolated using a third order
    2000 polynomial, as described in
    2001 IERS Gazette \#13 \footnote{http://maia.usno.navy.mil/iers-gaz13},
    2002 which gives a
    2003 FORTRAN reference implementation of the correct procedure.
    2004 
    2005 \tbd{reference to interpolation in this doc?}
     1931The motion of the CIP in the ITRS is known as ``polar
     1932motion''. Similarly to precession/nutation, the instantaneous position
     1933of the CIP in the ITRS is specified by the quantites $x_p$, and $y_p$,
     1934and a third quantity, $s'$, gives the position of the TEO with respect
     1935to the ITRS.  The values of $x_p$ and $y_p$ are published daily by the
     1936IERS\footnote{http://maia.usno.navy.mil/ser7/finals2000A.daily}, with
     1937a format described by their
     1938\code{readme.finals2000A}\footnote{http://maia.usno.navy.mil/ser7/readme.finals2000A}.
     1939The UT1$-$UTC, and the precession/nutation corrections (discussed
     1940elsewhere in this document) come from this same source.
     1941
     1942The polar motion coordinates should be interpolated using a third
     1943order polynomial, as described in IERS Gazette \#13
     1944\footnote{http://maia.usno.navy.mil/iers-gaz13}, which gives a FORTRAN
     1945reference implementation of the correct procedure.
    20061946
    20071947The values published by the IERS are smoothed to remove noise and
    20081948variations on the timescale of a day or less. There are two sources of
    2009 short timescale variations - tidal effects on the order of 0.1 milliarcseconds,
    2010 and short period nutation terms on the order of 15 microarcseconds.
    2011 Both of these effects may be modeled and added to the interpolated values
    2012 for higher accuracy.
    2013 
    2014 The tidal effects should be included using the FORTRAN reference implementation
    2015 of the Ray tidal model given in IERS Gazette \#13. This code should be
    2016 mimiced to machine accuracy by psLib.
    2017 
    2018 By definition of the CIP, nutation terms with periods less than 2 days are
    2019 not included in the IAU 2000A precession/nutation model.
    2020 So these motions
    2021 must be compensated for by their equivalent polar motions. These may
    2022 be calculated using a form similar to that of the precession/nutation $X$,
    2023 and $Y$. The constants to use are given in Table 5.1 of IERS32.
    2024 Note that only the terms with periods less than 2 days should be used.
    2025 
    2026 The quantity $s'$ may be approximated with microarcsecond accuracy over this
    2027 century by $s' = -4.7 \times 10^{-5} t$ in arcseconds. There is no need
    2028 to apply short timescale corrections to $s'$.
     1949short timescale variations - tidal effects on the order of 0.1
     1950milliarcseconds, and short period nutation terms on the order of 15
     1951microarcseconds.  Both of these effects may be modeled and added to
     1952the interpolated values for higher accuracy.
     1953
     1954The tidal effects should be included by using the Ray tidal model
     1955given in IERS Gazette \#13. The definition of this correction is
     1956provided below.
     1957
     1958By definition of the CIP, nutation terms with periods less than 2 days
     1959are not included in the IAU 2000A precession/nutation model.  So these
     1960motions must be compensated for by their equivalent polar
     1961motions. These may be calculated using a form similar to that of the
     1962precession/nutation $X$, and $Y$. The constants to use are given in
     1963Table 5.1 of IERS32.  Note that only the terms with periods less than
     19642 days should be used.
     1965
     1966The quantity $s'$ may be approximated with microarcsecond accuracy
     1967over this century by $s' = -4.7 \times 10^{-5} t$ in arcseconds. There
     1968is no need to apply short timescale corrections to $s'$.
    20291969
    20301970The transform from the ITRS to the CIP/TEO frame can be constructed by
    2031 first rotating about the X axis by $y_p$, then rotating about the X axis by
    2032 $x_p$, and finally rotating about the Z axis by $s'$.
    2033 The IERS reference implementation for this is given in the subroutine
    2034 POM2000 \footnote{http://maia.usno.navy.mil/conv2000/chapter5/POM2000.f}.
    2035 Note that we describe the transform toward celestial coordinates (upward in
    2036 figure X), in order to match the reference implementation.
     1971first rotating about the X axis by $y_p$, then rotating about the X
     1972axis by $x_p$, and finally rotating about the Z axis by $s'$.  The
     1973IERS reference implementation for this is given in the subroutine
     1974POM2000
     1975\footnote{http://maia.usno.navy.mil/conv2000/chapter5/POM2000.f}.
     1976Note that we describe the transform toward celestial coordinates
     1977(upward in Figure~\ref{earthrot}), in order to match the reference
     1978implementation.
     1979
     1980\subsubsection{Universal Time (UT1)}
     1981\label{sec:ut1}
     1982
     1983Since 2003-01-01, UT1 has been defined as directly proportional to the
     1984Earth Rotation Angle (see IERS Technical Note 32\footnote{IERS
     1985Technical Note 32 - http://maia.usno.navy.mil/conv2003.html}).
     1986Previous to that date, a different definition was in effect (see IERS
     1987Technical Note 21\footnote{IERS Technical Note 21 -
     1988http://maia.usno.navy.mil/conventions.html}).  We will always use the
     1989post-2003 definition.
     1990
     1991UT1 is continuously measured by the International Earth Rotation Service, and
     1992tabulated values of the offset of UT1 from UTC are published at regular
     1993intervals, along with predicted future values.  IERS Bulletin A gives ``rapid
     1994response'' values necessary for real-time and near real-time data analysis
     1995(such as Pan-STARRS Otis and IPP subsystems). Bulletin B gives the results of a
     1996final, definitive data reduction.  An amalgam of Bulletin A and B values is
     1997published daily on the IERS website\footnote{IERS Bulletin A \& B -
     1998http://maia.usno.navy.mil/ser7/finals2000A.daily} along with a desciption of
     1999the format\footnote{IERS finals2000A.daily table format -
     2000http://maia.usno.navy.mil/ser7/readme.finals2000A}.
     2001
     2002The UT1 offsets should be interpolated using the prescription of IERS
     2003Gazette \#13\footnote{IERS Gazette \#13 -
     2004http://maia.usno.navy.mil/iers-gaz13}.  This entails using a third
     2005order polynomial to interpolate the table values, and then applying a
     2006model for diurnal and semi-diurnal fluctuations due to tidal effects.
     2007An example implimentation\footnote{interp.f -
     2008ftp://maia.usno.navy.mil/dist/interp.f} written in Fortran is
     2009available.  The interpolated value of $dT$ must then have the tidal
     2010correction from the Ray Tidal Model applied.
     2011
     2012\subsubsection{Ray Tidal Model}
     2013
     2014The Ray Model tidal corrections to X, Y, and dT are given by the the
     2015Fortran code listed below.  The input information is the epoch of
     2016interest in MJD, while the output results are the corrections $C_x$,
     2017$C_y$, and $C_dt$, which are in turn added to the interpolated values
     2018determined above.
     2019
     2020\verbatiminput{raymodel.f}
     2021
     2022The Polar motion X, and Y coordinates are also important for determining the
     2023orientation of the Earth with respect to the sky. This is also given in the
     2024IERS publications references above, and should be interpolated in the same way.
     2025
     2026\subsubsection{Longitude}
     2027
     2028Longitudes are often expressed in the form of decimal degrees while the
     2029algorithm for calculating GMST outputs seconds.
     2030
     2031\begin{equation}
     20321\degree = 240s
     2033\end{equation}
     2034
     2035%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    20372036
    20382037\subsubsection{ITRS - Alt/Az}
     
    23442343\subsection{Positions of Major Solar System Objects}
    23452344
    2346 \tbd{ephemerides code to replace this}
     2345\tbd{ephemerides code to replace this?}
    23472346
    23482347The SLALIB function \code{SLA_RDPLAN} returns the apparent position of
     
    23582357
    23592358\pagebreak
     2359
    23602360\section{Pan-STARRS Modules}
    23612361
Note: See TracChangeset for help on using the changeset viewer.