IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 9, 2005, 8:30:32 AM (21 years ago)
Author:
eugene
Message:

added updates based on psphot work

File:
1 edited

Legend:

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

    r4945 r4982  
    1 %%% $Id: psLibSDRS.tex,v 1.333 2005-09-02 22:29:08 price Exp $
     1%%% $Id: psLibSDRS.tex,v 1.334 2005-09-09 18:30:23 eugene Exp $
    22\documentclass[panstarrs,spec]{panstarrs}
    33
     
    34053405
    34063406\begin{prototype}
    3407 bool psVectorInit(psVector *image, ...);
     3407bool psVectorInit(psVector *vector, ...);
    34083408\end{prototype}
    34093409
     
    34233423value of the \code{input} vector at the specified \code{position}.  A
    34243424negative \code{position} means index from the end.
     3425
     3426\begin{prototype}
     3427psVector psVectorCreate(psVector *input, double lower, double upper, double delta, psElemType type);
     3428\end{prototype}
     3429
     3430This function creates a new vector, or reallocates the provided vector
     3431if \code{input} is not \code{NULL}.  The created vector consists of
     3432the data range starting at \code{lower}, running to \code{upper}, in
     3433steps of \code{delta}.  The upper-end value is {\em exclusive}; the
     3434sequence is equivalent to \code{for (x = lower; x < upper; x +=
     3435  delta)}. 
    34253436
    34263437%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     
    43784389\end{prototype}
    43794390
     4391\begin{prototype}
     4392long psVectorCountPixelMask (psVector *mask, psMaskValue value);
     4393\end{prototype}
     4394This function returns the number of pixels in the \code{vector} which
     4395satisfy any of the mask bits.  An error (eg, invalid vector) results
     4396in a return value of -1.  The vector must be of the same type as
     4397psMaskValue.
     4398
    43804399\subsubsection{Histograms}
    43814400\label{sec:histograms}
     
    46404659We specify two minimization engines, Levenberg-Marquardt and Powell,
    46414660since the former is relatively robust, but requires derivatives to be
    4642 known, while the latter does not always obtain the best fit but does
    4643 not require derivatives to be known.
    4644 
    4645 In both cases, we need to be able to set the maximum number of
    4646 iterations (\code{maxIter}) and the maximum tolerance (\code{tol}) for
    4647 convergence, in addition to having some basic information on the
    4648 results and quality of the minimization: the value of the function at
    4649 the minimum (\code{value}), the number of iterations performed
    4650 (\code{iter}) and last change in tolerance before returning
    4651 (\code{lastDelta}).
     4661known, while the latter does not require derivatives to be known, but
     4662since it needs to calculate the derivatives on the fly, is more
     4663computationally intensive. 
     4664
     4665We define the structure \code{psMinimization} to carry in user-defined
     4666limits on the minimization process, and to carry out information about
     4667the minimization analysis.  The maximum number of iterations is
     4668specified by \code{maxIter}, while the maximum tolerance for
     4669convergence is \code{tol}.  Four parameter vectors describe the
     4670behavior of individual parameters.  The \code{paramMask} vector
     4671defines the free (0) or frozen (not 0) parameters.  The
     4672\code{paramMin} defines the minimum allowed value for each parameter,
     4673while \code{paramMax} defines the maximum allowed value for each
     4674parameter.  During the analysis, parameters which would trend beyond
     4675these limits saturate to the limit.  The \code{paramDelta} specifies
     4676the maximum allowed absolute value of the swing of a given parameter.
     4677If the delta for a specific parameter would be larger than this, the
     4678swing is saturated to the limit (with the correct sign).  Any of these
     4679parameter vectors may be set to \code{NULL}, in which case the concept
     4680is ignored in the analysis.  The output information carried by the
     4681structure consists of the value of the function at the minimum
     4682(\code{value}), the number of iterations performed (\code{iter}) and
     4683last change in tolerance before returning (\code{lastDelta}).
    46524684
    46534685\begin{datatype}
     
    46584690    int iter;                           ///< Actual number of iterations performed
    46594691    float lastDelta;                    ///< Last change before quitting
     4692    psVector *paramMask;                ///< valid / invalid parameters
     4693    psVector *paramMax;                 ///< max allowed parameters
     4694    psVector *paramMin;                 ///< min allowed parameters
     4695    psVector *paramDelta;               ///< max allowed param swing
    46604696} psMinimization;
    46614697\end{datatype}
     
    46654701psMinimization *psMinimizationAlloc(int maxIter, float tol);
    46664702\end{prototype}
     4703and the parameter vectors are initially set to \code{NULL}. 
    46674704
    46684705\subsubsection{Levenberg-Marquardt}
     
    46854722                      psImage *covar,
    46864723                      psVector *params,
    4687                       const psVector *paramMask,
    46884724                      const psArray  *x,
    46894725                      const psVector *y,
     
    46944730The function shall return \code{false} in the event that there was an
    46954731error (bad input, too many iterations), and also call \code{psError}.
     4732It is not an error for the minimization to reach one of the parameter
     4733limits. 
    46964734
    46974735The minimization specification, \code{min}, shall be modified with the
     
    47414779the goodness of a fit.  This function returns the distances of the
    47424780current parameter set from the minimization parameters expected from
    4743 Gauss-Newton minimization.  The arguments are identical to those of
    4744 \code{psMinimizeLMChi2}, except only the single vector \code{delta},
    4745 consisting of the distances, is returned.  This vector must be
    4746 pre-allocated to the dimenstions of \code{params}.
     4781Gauss-Newton minimization.  The arguments have the same meaning as for
     4782\code{psMinimizeLMChi2}.  The returned vector, \code{delta}, consists
     4783of the distances.  This vector must be pre-allocated to the
     4784dimenstions of \code{params}.
    47474785
    47484786%% \subsubsubsection{Pre-defined Functions for LM}
     
    47854823
    47864824\begin{prototype}
    4787 bool psMinimizePowell(psMinimization *min, psVector *params, const psVector *paramMask,
    4788                       const psArray *coords, psMinimizePowellFunc func);
     4825bool psMinimizePowell(psMinimization *min,
     4826                      psVector *params,
     4827                      const psVector *paramMask,
     4828                      const psArray *coords,
     4829                      psMinimizePowellFunc func);
    47894830\end{prototype}
    47904831
    47914832The inputs and general behavior of this function is the same as for
    47924833\code{psMinimizeLM}, except for the absence of the covariance matrix,
    4793 \code{covar}.
     4834\code{covar} \note{why does this not have a covar matrix?}
    47944835
    47954836\subsubsubsection{Minimizing $\chi^2$ with Powell}
     
    48034844
    48044845\begin{prototype}
    4805 bool psMinimizeChi2Powell(psMinimization *min, psVector *params, const psVector *paramMask,
    4806                           const psArray *coords, const psVector *value, const psVector *error,
     4846bool psMinimizeChi2Powell(psMinimization *min,
     4847                          psVector *params,
     4848                          const psVector *paramMask,
     4849                          const psArray *coords,
     4850                          const psVector *value,
     4851                          const psVector *error,
    48074852                          psMinimizeChi2PowellFunc model);
    48084853\end{prototype}
     
    48124857instead of being provided the function to be minimized, it is provided
    48134858a model to fit and must calculate the $\chi^2$ to be minimized itself.
     4859
     4860\note{why does this not have a covar matrix?}
     4861
     4862\note{unify the param names with psMinimizeLMChi2Func?}
    48144863
    48154864For this purpose, \code{value} shall contain measured values at the
     
    50095058
    50105059\begin{prototype}
     5060psVector *psImageRow(psVector *out,
     5061                     const psImage *input,
     5062                     psU32 row);
     5063psVector *psImageCol(psVector *out,
     5064                     const psImage *input,
     5065                     psU32 column);
     5066\end{prototype}
     5067
     5068These two functions extract a single complete \code{row} or
     5069\code{column} from the \code{image} and return it to the provided
     5070\code{vector}, allocating it if it is \code{NULL}.  These are provided
     5071as fast, simple implementations of data extraction.  For more
     5072sophisticated operations, the following two functions should be used.
     5073
     5074\begin{prototype}
    50115075psVector *psImageSlice(psVector *out,
    50125076                       psPixels *coords,
     
    52575321following types: \code{psS8}, \code{psU16}, \code{psF32},
    52585322\code{psF64}.
     5323
     5324\begin{prototype}
     5325long psImageCountPixelMask (psImage *mask, psRegion region, psMaskValue value);
     5326\end{prototype}
     5327This function returns the number of pixels in the image region which
     5328satisfy any of the mask bits.  An error (eg, invalid image, invalid
     5329region) results in a return value of -1.
    52595330
    52605331\begin{prototype}
     
    62306301bool psTimerStart(char *name);
    62316302psF64 psTimerMark(char *name);
     6303psF64 psTimerClear(char *name);
    62326304psF64 psTimerStop(void);
    62336305\end{prototype}
     
    62366308timers, under the supplied \code{name}.  \code{psTimerMark} shall
    62376309return the elapsed time, in seconds, for the timer specified by
    6238 \code{name}.  \code{psTimerStop} shall free all memory associated with
    6239 the timers, so that no memory is leaked, and return the maximum time
    6240 expended.
    6241 
     6310\code{name}.  \code{psTimerClear} resets the named timer.
     6311\code{psTimerStop} shall free all memory associated with all timers,
     6312so that no memory is leaked, and return the maximum time expended.
    62426313
    62436314%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracChangeset for help on using the changeset viewer.