IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 16, 2004, 5:09:16 PM (22 years ago)
Author:
Paul Price
Message:

Added Powell's method.

File:
1 edited

Legend:

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

    r1554 r1555  
    1 %%% $Id: psLibADD.tex,v 1.25 2004-08-17 01:56:41 eugene Exp $
     1%%% $Id: psLibADD.tex,v 1.26 2004-08-17 03:09:16 price Exp $
    22\documentclass[panstarrs]{panstarrs}
    33
     
    450450
    451451\paragraph{Non-linear Fitting: Levenberg-Marquardt Method}
    452 
    453 \TBD{describe LMM for psMinimize and psMinimizeChi2}
    454452
    455453For models in which the system of equations defined by the partial
     
    523521\end{center}
    524522
     523
     524\paragraph{Non-linear fitting: Powell's method}
     525
     526Powell's method is a type of ``Direction Set'' methods in
     527multi-dimensions for finding a local minimum.  Given a starting point
     528(the ``best guess'' for the minimum) and a set of direction vectors, a
     529direction set method advances in the direction of the vectors,
     530determines a new direction vector by some method, and proceeds in this
     531manner until the advances along the vectors are smaller than some
     532pre-defined tolerance.  Such direction set methods, including Powell's
     533Quadratically Convergent method are discussed in NR\S10.5.
     534
     535We will use for our algorithm the modified version of Powell's
     536Quadratically Convergent Method, which is described below, adapted
     537from NR.
     538
     539\begin{enumerate}
     540\item Given a function in $N$ dimensions to minimize, $f$, and a best
     541  guess for the minimum, point $P$ in $N$ dimensions, take an initial
     542  set of $N$ vectors, $v_i$, to be the unit vectors.
     543\item Set point $Q = P$.
     544\item For each dimension in turn, move $Q$ \textit{only} in the
     545  direction $v_i$ to minimize the function of interest.
     546\item Set vector $u = Q - P$.
     547\item Move $Q$ \textit{only} in the direction $u$
     548\item Replace the vector along which the largest minimization was
     549  made, $v_{i,\rm max}$, with $u$, except under either of the
     550  following circumstances:
     551  \begin{itemize}
     552  \item If $f_QP \ge f_P$, then there is no point in keeping the new
     553    vector, because there is no further minimization to be made in
     554    that direction.
     555  \item If $2 ( f_P - 2f_Q + f_{QP} ) \left[ ( f_P - f_Q ) -
     556  \Delta_{\rm max} \right]^2 \ge ( f_P - f_{QP} )^2 \Delta_{\rm max}$,
     557  then either the decrease in the function was not due to any single
     558  direction, or we are close to the minimum.
     559  \end{itemize}
     560  where $f_P = f(P)$, $f_Q = f(Q)$, $f_{QP} = f(2Q - P)$, and
     561  $\Delta_{\rm max} \ge 0$ is the magnitude of the minimization made
     562  along $v_{i,\rm max}$.
     563\item Set $P$ to $Q$.
     564\item Return to step 3 until the change in this last move is less
     565  than some specified tolerance, or a maximum number of iterations
     566  has been reached.
     567\end{enumerate}
     568
     569In regards to minimizing the function only in a particular direction,
     570we shall adopt, as NR recommends, bracketing the minimum before
     571applying Brent's method, \tbd{which will be specified in detail
     572later}.
     573
     574
    525575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    526576
     
    644694
    645695Correct time representation is critical in astronomical software.
    646 PSLib uses the \code{psTime} structure to represent all time values.
    647 This structure represents a time which is consists of seconds and
    648 fractions of seconds in a time system defined by the \code{psTimeType}
    649 element \code{type}.  Two possible time systems are currently
    650 available: TAI and UTC.  Both are defined in terms of the reference
    651 epoch 1970-01-01T00:00:00Z, but with minor modifications for
    652 leap-seconds as needed.  The first represenatation, TAI (International
    653 Atomic Time), has seconds of uniform length and no leap seconds.  The
    654 exact zero reference is 1970/01/01,00:00:10 UTC.  The second
    655 representations is UTC, which has seconds of uniform length and
    656 leap-seconds as needed to adjust it to remain within 0.9 seconds of
    657 the Earth's rotation.  It has a zero-point of exactly
    658 1970/01/01,00:00:00 UTC.
     696PSLib uses the \code{psTime} structure to represent all time
     697values.  This structure represents a time which is equivalent to TAI
     698(International Atomic Time) and has the following properties:
     699\begin{itemize}
     700\item it represents both seconds and microseconds
     701\item the seconds are continuous (no leap seconds)
     702\item the zero reference point is \tbd{1970/01/01,00:00:10} UTC.
     703\end{itemize}
    659704
    660705Julian Day (JD) and Modified Julian Day (MJD) are both continuous time
     
    713758\end{verbatim}
    714759
    715 The conversion from a time and longitude to local mean sidereal time
    716 is performed using the SLA Lib function \code{sla_GMST}.  This
    717 function requires the value $\Delta$ UT1 = UTC - UT1.  The value of
    718 $\Delta$ UT1 may be determined from the following site in real time:
    719 
    720 \code{ftp://maia.usno.navy.mil/ser7/ser7.dat}
    721 
    722 In addition, the long-term values may be determined from the table
    723 found at: \code{ftp://maia.usno.navy.mil/ser7/finals.all}.  See also
    724 the web page \code{http://maia.usno.navy.mil/}.  The most significant
    725 accuracy requirements are for the current value when calculating the
    726 LST.  For this purpose, the table above (\code{ser7.dat}), which
    727 provides predictions over a 2 month period, must be made available
    728 locally to PSLib and updated regularly.
    729 
    730760%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    731761
     
    862892\subsubsection{Projections}
    863893
    864 We implement three types of projections: {\em zenithal}, {\em
    865 cylindrical} and {\em pseudocylindrical}, each requiring slightly
    866 different handling.  Our representations are based on the treatment of
    867 projections presented by
     894The following information is from
    868895\href{http://www.cv.nrao.edu/fits/documents/wcs/wcs.all.ps}{Greisen \&
    869 Calabretta (1995, ADASS, 4, 233)}.  In all of these projections, we
    870 are converting from a spherical coordinate $\alpha,\delta$ to a linear
    871 (2-D) coordinate $x_p,y_p$.  The projection is defined by the
    872 projection type, the projection center ($\alpha_p, \delta_p$) and the
    873 the plate scales in the $x_p$ and $y_p$ directions ($\rho_x,\rho_y$).
    874 
    875 In the structure, \code{psProjection}, the projection type is defined
    876 by the element \code{type}, the projection center $\alpha_p,\delta_p$
    877 is defined by the elements \code{R,D}, and the plate scales,
    878 $\rho_x,\rho_y$, are defined by the elements \code{Xs,Ys}.  The plate
    879 scales are applied independently to the $x$ and $y$ coordinates to
    880 convert them to the corresponding linear units (ie, pixels):
    881 %
    882 \begin{eqnarray}
    883 x_p & = & \rho_x x \\
    884 y_p & = & \rho_y y \\
    885 \end{eqnarray}
    886 %
    887 In the discussions below, we ignore this last step (or first step,
    888 depending on the direction of the conversion).
    889 
    890 \paragraph{Zenithal Projections}
    891 
    892 The {\em zenithal} projections are defined relative to a set of
    893 spherical coordinates with pole at the center of the projection
    894 ($\alpha_p, \delta_p$), and which thus represents a coordinate system
    895 rotated relative to the coordinate system of $\alpha, \delta$.  In
    896 this spherical coordinate system, the coordinate of longitude is
    897 labeled $\phi$, and has domain of $-\pi < \phi \le \pi$, while the
    898 latitude, measured from the pole, is labeled $\theta$ and has domain
    899 $0 \le \theta \le \pi$.
    900 
    901 For an arbitrary projection center, it is necessary to convert the
    902 spherical coordinates to be projected ($\alpha,\delta$) to the
    903 projection spherical coordinate system coordinates ($\phi, \theta$).
    904 In practice, we construct the following useful trigonometric
    905 relationships between $\phi$ and $\theta$ which may be employed in the
    906 equations of $x,y$ below:
    907 %
    908 \begin{eqnarray}
    909 \sin \theta           & = & \sin \delta \sin \delta_p + \cos \delta \cos \delta_p \cos (\alpha - \alpha_p) \\
    910 \cos \theta \cos \phi & = & \sin \delta \cos \delta_p - \cos \delta \sin \delta_p \cos (\alpha - \alpha_p) \\
    911 \cos \theta \sin \phi & = & - \cos \delta \sin (\alpha - \alpha_p)
    912 \end{eqnarray}
    913 %
    914 For the inverse transformations, the equivalent relationships are:
    915 %
    916 \begin{eqnarray}
    917 \sin \delta                          & = & \sin \theta \sin \delta_p + \cos \theta \cos \delta_p \cos \phi \\
    918 \cos \delta \cos (\alpha - \alpha_p) & = & \sin \theta \cos \delta_p - \cos \theta \sin \delta_p \cos \phi \\
    919 \cos \delta \sin (\alpha - \alpha_p) & = & - \cos \theta \sin (\phi - \phi_p)
    920 \end{eqnarray}
    921 %
    922 For zenithal projections, the linear coordinates are related to
    923 $\phi,\theta$ by:
    924 %
    925 \begin{eqnarray}
    926 x & = & R_\theta \sin \phi \\
    927 y & = & -R_\theta \cos \phi
    928 \end{eqnarray}
    929 %
    930 and the inverse:
    931 %
    932 \begin{eqnarray}
    933 R_\theta & = & \sqrt{x^2 + y^2} \\
    934 \phi     & = & {\rm arg} (-y,x)
    935 \end{eqnarray}
    936 %
    937 The coordinates $x,y$ above are defined to be in angular units (ie,
    938 radians). 
    939 
    940 From these relationships, we can calculate $\alpha, \delta$ as:
    941 %
    942 \begin{eqnarray}
    943 \alpha - \alpha_p & = & \arctan (\sin \alpha, \cos \alpha) \\
    944 \delta            & = & \arcsin (\sin \delta) \\
    945 \end{eqnarray}
    946 %
    947 Note that if $(x,y) = (0,0)$, then $\alpha = \alpha_p, \delta = \delta_p$.
    948 
    949 \subparagraph{Gnomonic}
    950 
    951 The Gnomonic projection (``TAN'') is a zenithal projection with
    952 $R_\theta = \cot \theta$.  The resulting relationships for $(x,y)$ and
    953 for $\sin \theta, \cos \theta$ are:
    954 
    955 \begin{eqnarray}
    956 x           & = & \frac{\cos \theta \sin \phi}{\sin \theta} \\
    957 y           & = & \frac{-\cos \theta \cos \phi}{\sin \theta} \\
    958 \sin \theta & = & \zeta / \sqrt{1 + \zeta^2} \\
    959 \cos \theta & = & 1 / \sqrt{1 + \zeta^2} \\
    960 \end{eqnarray}
    961 
    962 where $\zeta = 1 / R_\theta$.
    963 
    964 \subparagraph{Orthographic}
    965 
    966 The Orthographic projection (``SIN'') is a zenithal projection with
    967 $R_\theta = \cos \theta$.  The resulting relationships for $(x,y)$ and
    968 for $\sin \theta, \cos \theta$ are:
    969 
    970 \begin{eqnarray}
    971 x           & = & \cos \theta \sin \phi \\
    972 y           & = & -\cos \theta \cos \phi \\
    973 \sin \theta & = & \sqrt{1 - R_\theta^2} \\
    974 \cos \theta & = & R_\theta \\
    975 \end{eqnarray}
    976 
    977 \paragraph{Cylindrical and Pseudocylindrical Projections}
    978 
    979 The {\em cylindrical} and {\em pseudocylindrical} projections are
    980 defined relative to a set of cylindrical coordinates whose pole is
    981 coincident with the pole of the spherical coordinates.  These
    982 projections are particularly used for full-sky representations, and
    983 are only defined for projection centers with $\delta_p = 0$.  In this
    984 spherical coordinate system, the coordinate of longitude is labeled
    985 $\phi$, and has domain of $-\pi < \phi \le \pi$, while the latitude,
    986 measured from the pole, is labeled $\theta$ and has domain $0 \le
    987 \theta \le \pi$.  The projection center longitude, $\alpha_p$
    988 corresponds to $\phi = 0$, thus the value of $\phi$ is determined as
    989 $\alpha - \alpha_p$ for all such projections.
    990 
    991 \subparagraph{Cartesian}
    992 
    993 The Cartesian projection (``CAR'') is a very simple cylindrical
    994 projection with the following relationships between $x,y$ and
    995 $\phi,\theta$:
     896Calabretta (1995, ADASS, 4, 233)}.
     897
     898Let the latitude be $\phi$ and the longitude $\theta$.  The domains of
     899these are $-\pi < \phi \le \pi$ and $-\pi/2 \le \theta \le \pi/2$.
     900
     901For zenithal projections (e.g.\ Gnomonic and Orthographic) the
     902following hold:
     903
     904\begin{eqnarray}
     905x & = & R \sin (\phi) \\
     906y & = & -R \cos (\phi)
     907\end{eqnarray}
     908
     909and
     910
     911\begin{eqnarray}
     912R & = & \sqrt{x^2 + y^2} \\
     913\phi & = & {\rm arg} (-y,x)
     914\end{eqnarray}
     915
     916\paragraph{Gnomonic}
     917
     918The Gnomonic projection (``TAN'') is a zenithal projection.
     919
     920\begin{eqnarray}
     921R & = & \cot (\theta) 180^\circ/\pi \\
     922\theta & = & \arctan (180^\circ/(\pi R))
     923\end{eqnarray}
     924
     925\paragraph{Orthographic}
     926
     927The Orthographic projection (``SIN'') is a zenithal projection.
     928
     929\begin{eqnarray}
     930R & = & \cos (\theta) 180^\circ/\pi \\
     931\theta & = & \arccos (\pi R / 180^\circ)
     932\end{eqnarray}
     933
     934\paragraph{Cartesian}
     935
     936The Cartesian projection (``CAR'') is a very simple cylindrical projection.
    996937
    997938\begin{eqnarray}
     
    1000941\end{eqnarray}
    1001942
    1002 \subparagraph{Mercator}
     943\paragraph{Mercator}
    1003944
    1004945The Mercator projection (``MER'') is a cylindrical projection.
     
    1006947\begin{eqnarray}
    1007948x & = & \phi \\
    1008 y & = & \ln \left( \tan (\pi/4 + \theta/2) \right) \\
    1009 {\rm and}\hspace{1cm} \theta & = & 2 \arctan \left( e^y \right) - \pi/2
    1010 \end{eqnarray}
    1011 
    1012 \subparagraph{Hammer-Aitoff}
    1013 
    1014 The Hammer-Aitoff projection(``AIT'') is a pseudocylindrical projection, and is defined:
    1015 
    1016 \begin{eqnarray}
    1017 x & = & 2 \zeta \cos \theta \sin \frac{\phi}{2} \\
    1018 y & = & \zeta \sin \theta \\
    1019 {\rm where}\hspace{1cm} \zeta^{-1} & \equiv & \sqrt{\frac{1}{2}\left(1 + \cos \theta \cos \frac{\phi}{2} \right)}
     949y & = & \ln \left( \tan (45^\circ + \theta/2) \right) 180^\circ/\pi \\
     950{\rm and}\hspace{1cm} \theta & = & 2 \arctan \left( e^{y\pi/180^\circ} \right) - 90^\circ
     951\end{eqnarray}
     952
     953\paragraph{Hammer-Aitoff}
     954
     955The Hammer-Aitoff projection is a general projection, and is defined:
     956
     957\begin{eqnarray}
     958x & = & 2 \alpha \cos (\theta) \sin (\phi/2) \\
     959y & = & \alpha \sin \theta \\
     960{\rm where}\hspace{1cm} \alpha^{-1} & \equiv & (180^\circ/\pi) \sqrt{\left(1 + \cos (\theta) \cos (\phi/2) \right) / 2}
    1020961\end{eqnarray}
    1021962
     
    1023964
    1024965\begin{eqnarray}
    1025 \phi & = & 2 {\rm \arctan} (2z^2 - 1, x z) \\
    1026 \theta & = & \arcsin (yz) \\
    1027 {\rm where}\hspace{1cm} z & \equiv & \sqrt{1 - (x/2)^2 - y^2}
    1028 \end{eqnarray}
    1029 
    1030 \subparagraph{Parabolic}
    1031 
    1032 The Parabolic projection (``PAR'') is a pseudocylindrical projection, and is defined:
    1033 
    1034 \begin{eqnarray}
    1035 x & = & \phi \left( 2 \cos \frac{2 \theta}{3} - 1 \right) \\
    1036 y & = & \pi \sin \frac{\theta}{3} \\
    1037 \end{eqnarray}
    1038 
    1039 And in reverse:
    1040 
    1041 \begin{eqnarray}
    1042 \theta & = & 3 \sin^{-1} \rho \\
    1043 \phi   & = & \frac{x}{1 - 4\rho^2} \\
    1044 {\rm where}\hspace{1cm} \rho & \equiv & y/\pi \\
     966\phi & = & 2 {\rm arg} (2z^2 - 1, xz \pi/360^\circ) \\
     967\theta & = & \arcsin (yz\pi/180^\circ) \\
     968{\rm where}\hspace{1cm} z & \equiv & \sqrt{1 - (x\pi/720^\circ)^2 - (y\pi/360^\circ)^2}
    1045969\end{eqnarray}
    1046970
Note: See TracChangeset for help on using the changeset viewer.