IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 10, 2004, 6:03:24 PM (22 years ago)
Author:
Paul Price
Message:

Changed return type of psTraceReset, psLogSetFormat,
psMetadataSetIterator, psMetadataItemPrint to return type bool, so
that errors won't be lost (bug 161). psImageRebin input types
restricted; bug 198. Fixed up the LM minimization specification; bug
203.

File:
1 edited

Legend:

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

    r2314 r2337  
    1 %%% $Id: psLibSDRS.tex,v 1.147 2004-11-09 03:45:07 price Exp $
     1%%% $Id: psLibSDRS.tex,v 1.148 2004-11-11 04:03:24 price Exp $
    22\documentclass[panstarrs,spec]{panstarrs}
    33
     
    849849of the code is compiled.  This can be implemented via macro front-ends
    850850to private versions of the user APIs.  In addition, a function
    851 \code{void psTraceReset(void)} will set all trace levels to 0.
     851\code{bool psTraceReset(void)} will set all trace levels to 0.
    852852
    853853
     
    931931%
    932932\begin{verbatim}
    933 void psLogSetFormat(const char *fmt);
     933bool psLogSetFormat(const char *fmt);
    934934\end{verbatim}
    935935%
     
    14521452   psListElem *tail;                   ///< last element on list (may be NULL)
    14531453   unsigned int nIter;                 ///< number of iterators
    1454    psListIterator **iter;              ///< iteration cursors
     1454   psArray *iter;                      ///< array of psListIterator: iteration cursors
    14551455   pthread_mutex_t lock;               ///< mutex to lock a node during changes
    14561456} psList;
     
    23192319\subsubsection{Levenberg-Marquardt}
    23202320
    2321 Consider a function of a collection of parameters, \code{params}, and
    2322 (possibly several) coordinate vectors (which we represent as an array
    2323 of vectors), \code{coord}, which returns a single floating point value
    2324 which is the value of the function given the parameters and coordinate
    2325 vectors, along with the derivatives of the function with respect to
    2326 each of the parameters:
    2327 \begin{verbatim}
    2328 typedef float (*psMinimizeLMFunc)(psVector *deriv, const psVector *params, const psArray *coords);
    2329 \end{verbatim}
    2330 An example may help here.  We say that the coordinate vectors may be
    2331 several (and hence use a \code{psArray} for \code{coords}), since
    2332 often one will want to minimize $\chi^2$, given a data set consisting
    2333 of vectors for $x$, $y$ and $\sigma_y$.
    2334 
    2335 Then \code{psMinimizeLM} shall mimimize the specified function,
    2336 \code{func}, using the Levenberg-Marquardt method:
    2337 
    2338 \begin{verbatim}
    2339 bool psMinimizeLM(psMinimization *min, psImage *covar, psVector *params, const psVector *paramMask,
    2340                   const psArray *coords, psMinimizeLMFunc func);
     2321Consider a function of a collection of parameters, \code{params},
     2322which is evaluated at a position, \code{x}, which returns a single
     2323floating point value which is the value of the function given the
     2324parameters and coordinate vectors, along with the derivatives of the
     2325function with respect to each of the parameters, \code{deriv}:
     2326\begin{verbatim}
     2327typedef float (*psMinimizeLMChi2Func)(psVector *deriv, const psVector *params, const psVector *x);
     2328\end{verbatim}
     2329
     2330Then \code{psMinimizeLMChi2} shall fit the specified function,
     2331\code{func}, to a set of measurements, \code{x,y,yErr}, using the
     2332Levenberg-Marquardt method:
     2333
     2334\begin{verbatim}
     2335bool psMinimizeLMChi2(psMinimization *min, psImage *covar, psVector *params,
     2336                      const psVector *paramMask, const psArray *x, const psVector *y,
     2337                      const psVector *yErr, psMinimizeLMChi2Func func);
    23412338\end{verbatim}
    23422339
     
    23482345the values appropriate from the minimization.
    23492346
    2350 On calling the minimizer, \code{params} shall consist of a ``best
    2351 guess'' for the parameters that minimize the input function,
     2347On calling the minimizer, the \code{params} vector shall consist of a
     2348``best guess'' for the parameters that minimize the model function,
    23522349\code{func}.  On successful completion, the input parameters,
    23532350\code{params}, shall be updated with the values that minimize the
    23542351input function.  The function shall also update the covariance matrix,
    23552352\code{covar}, in the event that it is non-\code{NULL}.  The function
    2356 shall generate in error in the event that \code{covar} is not a square
    2357 matrix with size matching that of \code{params}.
     2353shall generate in error in the event that \code{covar} is
     2354non-\code{NULL} and is not a square matrix with size matching that of
     2355\code{params}.
    23582356
    23592357Parameters that have a corresponding \code{paramMask} entry of
     
    23612359for \code{paramMask} not to be of the same dimension as \code{params}.
    23622360
    2363 The \code{coords} are not handled by the minimizer, except to be
    2364 passed to the function as additional input, and it is the
    2365 responsibility of the function to interpret these.
     2361The measurement ordinates, \code{x}, shall consist of multiple
     2362vectors, each of which may be passed to the model \code{func}.  If the
     2363measurement coordinates, \code{y}, and errors, \code{yErr}, are not of
     2364the same length as the ordinates array, \code{x}, then the function
     2365shall generate a warning, and truncate the longest of the
     2366array/vectors to match the length of the shortest.  The vectors
     2367contained within the \code{x} array, and the \code{y} and \code{yErr}
     2368vectors must be of type \code{psF32}.  The \code{yErr} vector may be
     2369\code{NULL}, in which case the errors shall be assumed to be
     2370identical.
    23662371
    23672372\code{paramMask} must be of type \code{psU8}, while \code{params} must
     
    23752380
    23762381\begin{verbatim}
    2377 psMinimizeLMFunc psMinimizeLMChi2Gauss1D;
    2378 psMinimizeLMFunc psMinimizeLMChi2Gauss2D;
    2379 \end{verbatim}
    2380 
    2381 \code{psMinimizeChi2LMGauss1D} shall take, as \code{params}, the
    2382 normalization, center, and standard deviation of a Gaussian to be fit
    2383 to the data.  The data in the \code{coords} shall consist of vectors
    2384 for each of \code{x}, \code{y}, and \code{yErr}.  If the \code{yErr}
    2385 is missing, or \code{NULL}, then the errors shall be taken to be
    2386 unity, for the purpose of fitting where the errors are all identical
    2387 (and possibly unknown).  If the \code{x}, \code{y} or \code{yErr} (if
    2388 supplied) vectors are of differing lengths, the function shall
    2389 generate a warning and truncate the lengths to match the shortest.
    2390 
    2391 \code{psMinimizeLMChi2Gauss1D} shall return the $\chi^2$ value for the
    2392 specified Gaussian as a model for the supplied data, along with the
    2393 derivatives of the $\chi^2$ with respect to each of the parameters.
     2382psMinimizeLMChi2Func psMinimizeLMChi2Gauss1D;
     2383psMinimizeLMChi2Func psMinimizeLMChi2Gauss2D;
     2384\end{verbatim}
     2385
     2386\code{psMinimizeChi2LMGauss1D} shall take as \code{params}, the
     2387normalization, center, and standard deviation of a Gaussian to be fit,
     2388and as \code{x}, a vector containing a single value.  It shall return
     2389the value of the Gaussian at the value, and the derivatives
     2390(\code{deriv}) with respect to each of the parameters.
    23942391
    23952392\code{psMinimizeChi2LMGauss2D} shall take, as \code{params}, the
    23962393normalization, center (two values), standard deviation (two values)
    2397 and position angle of a 2-dimensional Gaussian to be fit to the data.
    2398 The data in the \code{coords} shall consist of vectors for each of
    2399 \code{x}, \code{y}, \code{z} and \code{zErr}.  If the \code{zErr} is
    2400 missing, or \code{NULL}, then the errors shall be taken to be unity,
    2401 for the purpose of fitting where the errors are all identical (and
    2402 possibly unknown).  If the \code{x}, \code{y}, \code{z} or \code{zErr}
    2403 (if supplied) vectors are of differing lengths, the function shall
    2404 generate a warning and truncate the lengths to match the shortest.
    2405 
    2406 \code{psMinimizeLMChi2Gauss2D} shall return the $\chi^2$ value for the
    2407 specified Gaussian as a model for the supplied data, along with the
    2408 derivatives of the $\chi^2$ with respect to each of the parameters.
     2394and position angle of a 2-dimensional Gaussian, and as \code{x}, a
     2395vector containing a position, $(x,y)$.  It shall return the value of
     2396the 2-dimensional Gaussian at the specified point, along with the
     2397derivatives with respect to each of the parameters.
    24092398
    24102399\subsubsection{Powell}
     
    26882677\code{mask} is non-\code{NULL}, pixels for which the corresponding
    26892678\code{mask} pixel matches \code{maskVal} are excluded from operations.
    2690 This function must be defined for the following types: \code{psU8},
    2691 \code{psU16}, \code{psS8}, \code{psS16}, \code{psF32}, \code{psF64},
    2692 \code{psC32}, \code{psC64}.
     2679This function must be defined for the following types: \code{psS8},
     2680\code{psU16}, \code{psF32} and \code{psF64}.
    26932681
    26942682\begin{verbatim}
     
    31543142\end{verbatim}
    31553143
    3156 The output from a FFT and power spectrum must be of the same size as
    3157 the input.  In the future, if this adversely affects performance, this
    3158 will be revised so that the redundant information will be neglected.
     3144The output from a FFT must be of the same size as the input, and the
     3145size of the power spectrum equal to $N/2 + 1$, where $N$ is the number
     3146of elements in the input.  In the future, if this adversely affects
     3147performance, this will be revised so that the redundant information
     3148will be neglected.
    31593149
    31603150In analogy with the vector FFT operations, we also define matching
     
    32513241
    32523242If the vectors are not all of the same number of elements, then the
    3253 function shall generate a warning shall be generated, following which,
    3254 the longer vector trimmed to the length of the shorter, and the
    3255 function shall continue.
     3243function shall generate an error and return \code{NULL}.
    32563244
    32573245\subsubsection{Convolve an image with the kernel}
     
    38893877which follows the conventions of the \code{psList} iterators.
    38903878\begin{verbatim}
    3891 void psMetadataSetIterator(psMetadata *md, int iterator, int location);
     3879bool psMetadataSetIterator(psMetadata *md, int iterator, int location);
    38923880psMetadataItem *psMetadataGetNext(psMetadata *md, const char *match, int iterator);
    38933881psMetadataItem *psMetadataGetPrevious(psMetadata *md, const char *match, int iterator);
     
    39033891data type, printing is not allowed.
    39043892\begin{verbatim}
    3905 void psMetadataItemPrint(FILE *fd, const char *format, const psMetadataItem *md);
     3893bool psMetadataItemPrint(FILE *fd, const char *format, const psMetadataItem *md);
    39063894\end{verbatim}
    39073895
Note: See TracChangeset for help on using the changeset viewer.