Changeset 4982 for trunk/doc/pslib/psLibSDRS.tex
- Timestamp:
- Sep 9, 2005, 8:30:32 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/doc/pslib/psLibSDRS.tex (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/pslib/psLibSDRS.tex
r4945 r4982 1 %%% $Id: psLibSDRS.tex,v 1.33 3 2005-09-02 22:29:08 price Exp $1 %%% $Id: psLibSDRS.tex,v 1.334 2005-09-09 18:30:23 eugene Exp $ 2 2 \documentclass[panstarrs,spec]{panstarrs} 3 3 … … 3405 3405 3406 3406 \begin{prototype} 3407 bool psVectorInit(psVector * image, ...);3407 bool psVectorInit(psVector *vector, ...); 3408 3408 \end{prototype} 3409 3409 … … 3423 3423 value of the \code{input} vector at the specified \code{position}. A 3424 3424 negative \code{position} means index from the end. 3425 3426 \begin{prototype} 3427 psVector psVectorCreate(psVector *input, double lower, double upper, double delta, psElemType type); 3428 \end{prototype} 3429 3430 This function creates a new vector, or reallocates the provided vector 3431 if \code{input} is not \code{NULL}. The created vector consists of 3432 the data range starting at \code{lower}, running to \code{upper}, in 3433 steps of \code{delta}. The upper-end value is {\em exclusive}; the 3434 sequence is equivalent to \code{for (x = lower; x < upper; x += 3435 delta)}. 3425 3436 3426 3437 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% … … 4378 4389 \end{prototype} 4379 4390 4391 \begin{prototype} 4392 long psVectorCountPixelMask (psVector *mask, psMaskValue value); 4393 \end{prototype} 4394 This function returns the number of pixels in the \code{vector} which 4395 satisfy any of the mask bits. An error (eg, invalid vector) results 4396 in a return value of -1. The vector must be of the same type as 4397 psMaskValue. 4398 4380 4399 \subsubsection{Histograms} 4381 4400 \label{sec:histograms} … … 4640 4659 We specify two minimization engines, Levenberg-Marquardt and Powell, 4641 4660 since 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}). 4661 known, while the latter does not require derivatives to be known, but 4662 since it needs to calculate the derivatives on the fly, is more 4663 computationally intensive. 4664 4665 We define the structure \code{psMinimization} to carry in user-defined 4666 limits on the minimization process, and to carry out information about 4667 the minimization analysis. The maximum number of iterations is 4668 specified by \code{maxIter}, while the maximum tolerance for 4669 convergence is \code{tol}. Four parameter vectors describe the 4670 behavior of individual parameters. The \code{paramMask} vector 4671 defines the free (0) or frozen (not 0) parameters. The 4672 \code{paramMin} defines the minimum allowed value for each parameter, 4673 while \code{paramMax} defines the maximum allowed value for each 4674 parameter. During the analysis, parameters which would trend beyond 4675 these limits saturate to the limit. The \code{paramDelta} specifies 4676 the maximum allowed absolute value of the swing of a given parameter. 4677 If the delta for a specific parameter would be larger than this, the 4678 swing is saturated to the limit (with the correct sign). Any of these 4679 parameter vectors may be set to \code{NULL}, in which case the concept 4680 is ignored in the analysis. The output information carried by the 4681 structure consists of the value of the function at the minimum 4682 (\code{value}), the number of iterations performed (\code{iter}) and 4683 last change in tolerance before returning (\code{lastDelta}). 4652 4684 4653 4685 \begin{datatype} … … 4658 4690 int iter; ///< Actual number of iterations performed 4659 4691 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 4660 4696 } psMinimization; 4661 4697 \end{datatype} … … 4665 4701 psMinimization *psMinimizationAlloc(int maxIter, float tol); 4666 4702 \end{prototype} 4703 and the parameter vectors are initially set to \code{NULL}. 4667 4704 4668 4705 \subsubsection{Levenberg-Marquardt} … … 4685 4722 psImage *covar, 4686 4723 psVector *params, 4687 const psVector *paramMask,4688 4724 const psArray *x, 4689 4725 const psVector *y, … … 4694 4730 The function shall return \code{false} in the event that there was an 4695 4731 error (bad input, too many iterations), and also call \code{psError}. 4732 It is not an error for the minimization to reach one of the parameter 4733 limits. 4696 4734 4697 4735 The minimization specification, \code{min}, shall be modified with the … … 4741 4779 the goodness of a fit. This function returns the distances of the 4742 4780 current parameter set from the minimization parameters expected from 4743 Gauss-Newton minimization. The arguments are identical to those of4744 \code{psMinimizeLMChi2} , except only the single vector \code{delta},4745 consisting of the distances, is returned. This vector must be4746 pre-allocated to thedimenstions of \code{params}.4781 Gauss-Newton minimization. The arguments have the same meaning as for 4782 \code{psMinimizeLMChi2}. The returned vector, \code{delta}, consists 4783 of the distances. This vector must be pre-allocated to the 4784 dimenstions of \code{params}. 4747 4785 4748 4786 %% \subsubsubsection{Pre-defined Functions for LM} … … 4785 4823 4786 4824 \begin{prototype} 4787 bool psMinimizePowell(psMinimization *min, psVector *params, const psVector *paramMask, 4788 const psArray *coords, psMinimizePowellFunc func); 4825 bool psMinimizePowell(psMinimization *min, 4826 psVector *params, 4827 const psVector *paramMask, 4828 const psArray *coords, 4829 psMinimizePowellFunc func); 4789 4830 \end{prototype} 4790 4831 4791 4832 The inputs and general behavior of this function is the same as for 4792 4833 \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?} 4794 4835 4795 4836 \subsubsubsection{Minimizing $\chi^2$ with Powell} … … 4803 4844 4804 4845 \begin{prototype} 4805 bool psMinimizeChi2Powell(psMinimization *min, psVector *params, const psVector *paramMask, 4806 const psArray *coords, const psVector *value, const psVector *error, 4846 bool psMinimizeChi2Powell(psMinimization *min, 4847 psVector *params, 4848 const psVector *paramMask, 4849 const psArray *coords, 4850 const psVector *value, 4851 const psVector *error, 4807 4852 psMinimizeChi2PowellFunc model); 4808 4853 \end{prototype} … … 4812 4857 instead of being provided the function to be minimized, it is provided 4813 4858 a 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?} 4814 4863 4815 4864 For this purpose, \code{value} shall contain measured values at the … … 5009 5058 5010 5059 \begin{prototype} 5060 psVector *psImageRow(psVector *out, 5061 const psImage *input, 5062 psU32 row); 5063 psVector *psImageCol(psVector *out, 5064 const psImage *input, 5065 psU32 column); 5066 \end{prototype} 5067 5068 These 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 5071 as fast, simple implementations of data extraction. For more 5072 sophisticated operations, the following two functions should be used. 5073 5074 \begin{prototype} 5011 5075 psVector *psImageSlice(psVector *out, 5012 5076 psPixels *coords, … … 5257 5321 following types: \code{psS8}, \code{psU16}, \code{psF32}, 5258 5322 \code{psF64}. 5323 5324 \begin{prototype} 5325 long psImageCountPixelMask (psImage *mask, psRegion region, psMaskValue value); 5326 \end{prototype} 5327 This function returns the number of pixels in the image region which 5328 satisfy any of the mask bits. An error (eg, invalid image, invalid 5329 region) results in a return value of -1. 5259 5330 5260 5331 \begin{prototype} … … 6230 6301 bool psTimerStart(char *name); 6231 6302 psF64 psTimerMark(char *name); 6303 psF64 psTimerClear(char *name); 6232 6304 psF64 psTimerStop(void); 6233 6305 \end{prototype} … … 6236 6308 timers, under the supplied \code{name}. \code{psTimerMark} shall 6237 6309 return 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, 6312 so that no memory is leaked, and return the maximum time expended. 6242 6313 6243 6314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note:
See TracChangeset
for help on using the changeset viewer.
