Changeset 4040
- Timestamp:
- May 26, 2005, 2:38:08 PM (21 years ago)
- Location:
- trunk/doc/pslib
- Files:
-
- 2 edited
-
ChangeLogSDRS.tex (modified) (2 diffs)
-
psLibSDRS.tex (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/pslib/ChangeLogSDRS.tex
r3992 r4040 1 %%% $Id: ChangeLogSDRS.tex,v 1.10 3 2005-05-20 00:43:57 price Exp $1 %%% $Id: ChangeLogSDRS.tex,v 1.104 2005-05-27 00:38:08 eugene Exp $ 2 2 3 3 \subsection{Changes from version 00 to version 01} … … 613 613 \item Renamed \code{psMaskToPixels} to \code{psPixelsFromMask} (bug 414). 614 614 \item \code{psRegionFromString} returns \code{NaN} for any element that doesn't parse correctly (bug 416). 615 \end{itemize} 615 616 \item unified the single and double precision polynomials 617 \item re-ordered the psPolynomial*Alloc arguments 618 \item changed the psPolynomials to be defined in terms of Norder not Nterms 619 \item re-ordered the psVectorFitPoly* arguments 620 \item added mask \& maskValue ot psVectorFitPoly* 621 \item changed the requirements on the input data vectors to psPolynomialFit and Eval 622 \item added the psVectorClipFitPoly* functions 623 624 \end{itemize} -
trunk/doc/pslib/psLibSDRS.tex
r4022 r4040 1 %%% $Id: psLibSDRS.tex,v 1.23 3 2005-05-24 23:56:16 jhoblittExp $1 %%% $Id: psLibSDRS.tex,v 1.234 2005-05-27 00:38:08 eugene Exp $ 2 2 \documentclass[panstarrs,spec]{panstarrs} 3 3 … … 2350 2350 typedef struct { 2351 2351 psPolynomialType type; ///< Polynomial type 2352 psElemType ctype; ///< Polynomial precision 2352 2353 int n; ///< Number of terms 2353 float *coeff; ///< Coefficients 2354 float *coeffErr; ///< Error in coefficients 2354 union { 2355 psF32 *F32; ///< Coefficients 2356 psF64 *F64; ///< Coefficients 2357 } coeff; 2358 union { 2359 psF32 *F32; ///< Error in coefficients 2360 psF64 *F64; ///< Error in coefficients 2361 } coeffErr; 2355 2362 char *mask; ///< Coefficient mask 2356 2363 } psPolynomial1D; … … 2361 2368 typedef struct { 2362 2369 psPolynomialType type; ///< Polynomial type 2370 psElemType ctype; ///< Polynomial precision 2363 2371 int nX, nY; ///< Number of terms in x and y 2364 float **coeff; ///< Coefficients 2365 float **coeffErr; ///< Error in coefficients 2372 union { 2373 psF32 **F32; ///< Coefficients 2374 psF64 **F64; ///< Coefficients 2375 } coeff; 2376 union { 2377 psF32 **F32; ///< Error in coefficients 2378 psF64 **F64; ///< Error in coefficients 2379 } coeffErr; 2380 char *mask; ///< Coefficient mask 2366 2381 char **mask; ///< Coefficients mask 2367 2382 } psPolynomial2D; … … 2379 2394 \end{datatype} 2380 2395 2381 We also define double-precision versions of the polynomials: 2382 2383 \begin{datatype} 2384 /** Double-precision one-dimensional polynomial */ 2385 typedef struct { 2386 psPolynomialType type; ///< Polynomial type 2387 int n; ///< Number of terms 2388 double *coeff; ///< Coefficients 2389 double *coeffErr; ///< Error in coefficients 2390 char *mask; ///< Coefficient mask 2391 } psDPolynomial1D; 2392 \end{datatype} 2393 2394 \begin{datatype} 2395 /** Double-precision two-dimensional polynomial */ 2396 typedef struct { 2397 psPolynomialType type; ///< Polynomial type 2398 int nX, nY; ///< Number of terms in x and y 2399 double **coeff; ///< Coefficients 2400 double **coeffErr; ///< Error in coefficients 2401 char **mask; ///< Coefficients mask 2402 } psDPolynomial2D; 2403 \end{datatype} 2404 2405 etc. In what follows, we only show the version for double-precision 2406 two-dimensionals; the others may be inferred following the standard 2407 naming convention exampled above. 2408 2409 The constructor is: 2410 \begin{prototype} 2411 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY, psPolynomialType type); 2412 \end{prototype} 2413 where \code{nX} and \code{nY} are the number of terms in x and y 2414 respectively. The coefficients, errors and masks are set initially to 2415 zero. 2396 The element \code{ctype} defines the data type for the coefficients 2397 (allowed values of \code{PS_TYPE_F32} and \code{PS_TYPE_F64}). 2398 2399 The constructors are: 2400 \begin{prototype} 2401 psPolynomial1D *psPolynomial1DAlloc(psPolynomialType type, 2402 psElemType ctype, 2403 int nX); 2404 psPolynomial2D *psPolynomial2DAlloc(psPolynomialType type, 2405 psElemType ctype, 2406 int nX, int nY); 2407 psPolynomial3D *psPolynomial3DAlloc(psPolynomialType type, 2408 psElemType ctype, 2409 int nX, int nY, int nZ); 2410 psPolynomial4D *psPolynomial4DAlloc(psPolynomialType type, 2411 psElemType ctype, 2412 int nX, int nY, int nZ, int nT); 2413 \end{prototype} 2414 where \code{nX}, \code{nY}, etc specify the polynomial order in the 2415 given dimension. The coefficients, errors and masks are set initially 2416 to zero. 2416 2417 2417 2418 To evaluate the polynomials at specific coordinates, we define: 2418 2419 \begin{prototype} 2419 double psDPolynomial2DEval(const psDPolynomial2D *myPoly, double x, double y); 2420 psF64 psPolynomial2DEval(const psPolynomial2D *myPoly, 2421 psF64 x); 2422 psF64 psPolynomial2DEval(const psPolynomial2D *myPoly, 2423 psF64 x, 2424 psF64 y); 2425 psF64 psPolynomial2DEval(const psPolynomial2D *myPoly, 2426 psF64 x, 2427 psF64 y, 2428 psF64 z); 2429 psF64 psPolynomial2DEval(const psPolynomial2D *myPoly, 2430 psF64 x, 2431 psF64 y, 2432 psF64 z, 2433 psF64 t); 2420 2434 \end{prototype} 2421 2435 2422 2436 In the event that several evaluations are required, we also define: 2423 2437 \begin{prototype} 2424 psVector *psDPolynomial2DEvalVector(const psDPolynomial2D *myPoly, const psVector *x, const psVector *y); 2425 \end{prototype} 2426 If the \code{x} and \code{y} vectors do not match the precision of the 2427 polynomial, the function shall generate a warning, and convert the 2428 vectors to the appropriate precision. In the event that the \code{x} 2429 and \code{y} vectors are of differing sizes, the function shall 2430 generate a warning, truncate the longer vector to the size of the 2431 shorter, and continue. The precision of the output \code{psVector} 2432 shall match that of the polynomial. In evaluation, those coefficients 2433 that have the corresponding \code{mask} element non-zero shall not be 2434 evaluated. 2438 psVector *psPolynomial2DEvalVector(const psPolynomial2D *myPoly, 2439 const psVector *x); 2440 psVector *psPolynomial2DEvalVector(const psPolynomial2D *myPoly, 2441 const psVector *x, 2442 const psVector *y); 2443 psVector *psPolynomial2DEvalVector(const psPolynomial2D *myPoly, 2444 const psVector *x, 2445 const psVector *y, 2446 const psVector *z); 2447 psVector *psPolynomial2DEvalVector(const psPolynomial2D *myPoly, 2448 const psVector *x, 2449 const psVector *y, 2450 const psVector *z, 2451 const psVector *t); 2452 \end{prototype} 2453 The function shall accept input vectors of any type, converting to 2454 \code{psF64} as needed. In the event that the \code{x} and \code{y} 2455 vectors are of differing sizes, the function shall generate a warning, 2456 truncate the longer vector to the size of the shorter, and continuing. 2457 The precision of the output \code{psVector} shall be \code{psF64}. In 2458 evaluation, those coefficients that have the corresponding \code{mask} 2459 element non-zero shall not be evaluated. 2435 2460 2436 2461 \subsubsection{Splines} … … 2691 2716 2692 2717 \begin{prototype} 2693 psPolynomial1D *psVectorFitPolynomial1D(psPolynomial1D *myPoly, const psVector *x, const psVector *y, 2694 const psVector *yErr); 2695 \end{prototype} 2696 \code{psVectorFitPolynomial1d} returns the polynomial that best fits the 2697 observations. The input parameters are a polynomial that specifies 2698 the fit order, \code{myPoly}, which will be altered and returned with 2699 the best-fit coefficients; and the observations, \code{x}, \code{y} 2700 and \code{yErr}. The independent variable list, \code{x} may be 2701 \code{NULL}, in which case the vector index is used. The dependent 2702 variable error, \code{yErr} may be null, in which case the solution is 2703 determined in the assumption that all data errors are equal. This 2704 function must be valid only for types \code{psF32}, \code{psF64}. 2718 psPolynomial1D *psVectorFitPolynomial1D(psPolynomial1D *myPoly, 2719 const psVector *mask, 2720 unsigned int maskValue 2721 const psVector *f, 2722 const psVector *fErr 2723 const psVector *x); 2724 psPolynomial2D *psVectorFitPolynomial2D(psPolynomial1D *myPoly, 2725 const psVector *mask, 2726 unsigned int maskValue 2727 const psVector *f, 2728 const psVector *fErr 2729 const psVector *x, 2730 const psVector *y); 2731 psPolynomial3D *psVectorFitPolynomial3D(psPolynomial1D *myPoly, 2732 const psVector *mask, 2733 unsigned int maskValue 2734 const psVector *f, 2735 const psVector *fErr 2736 const psVector *x, 2737 const psVector *y, 2738 const psVector *z); 2739 psPolynomial4D *psVectorFitPolynomial4D(psPolynomial1D *myPoly, 2740 const psVector *mask, 2741 unsigned int maskValue 2742 const psVector *f, 2743 const psVector *fErr 2744 const psVector *x, 2745 const psVector *y, 2746 const psVector *z, 2747 const psVector *t); 2748 \end{prototype} 2749 These functions return the polynomial that best fits the input data. 2750 The provided polynomial, \code{myPoly}, specifies the fit order, and 2751 will be returnd with the best-fit coefficients. The dependent 2752 variable and its error (\code{f, fErr}) are provided along with the 2753 appropriate number of independent variables (\code{x}, \code{y}, etc). 2754 In the special case of 1D fitting, the independent variable list, 2755 \code{x} may be \code{NULL}, in which case the vector index is used. 2756 The dependent variable error, \code{yErr} may be null, in which case 2757 the solution is determined in the assumption that all data errors are 2758 equal. This function must be valid only for input data types of 2759 \code{psF32}, \code{psF64}. The \code{mask} and \code{maskValue} 2760 entries may be used to specify an input data set to ignore. All of 2761 the input vectors must be the same length. 2762 2763 \begin{prototype} 2764 psPolynomial1D *psVectorClipFitPolynomial1D(psPolynomial1D *myPoly, 2765 psStats *stats, 2766 const psVector *mask, 2767 unsigned int maskValue 2768 const psVector *f, 2769 const psVector *fErr 2770 const psVector *x); 2771 psPolynomial2D *psVectorClipFitPolynomial2D(psPolynomial1D *myPoly, 2772 psStats *stats, 2773 const psVector *mask, 2774 unsigned int maskValue 2775 const psVector *f, 2776 const psVector *fErr 2777 const psVector *x, 2778 const psVector *y); 2779 psPolynomial3D *psVectorClipFitPolynomial3D(psPolynomial1D *myPoly, 2780 psStats *stats, 2781 const psVector *mask, 2782 unsigned int maskValue 2783 const psVector *f, 2784 const psVector *fErr 2785 const psVector *x, 2786 const psVector *y, 2787 const psVector *z); 2788 psPolynomial4D *psVectorClipFitPolynomial4D(psPolynomial1D *myPoly, 2789 psStats *stats, 2790 const psVector *mask, 2791 unsigned int maskValue 2792 const psVector *f, 2793 const psVector *fErr 2794 const psVector *x, 2795 const psVector *y, 2796 const psVector *z, 2797 const psVector *t); 2798 \end{prototype} 2799 These functions replicate the capability of the vector fitting 2800 functions, but also include an iterative clipping stage. The clipping 2801 parameters are defined by the \code{stats} entry, to which are also 2802 returned the clipped statistics for the final residuals. Thus, if N 2803 clipping iterations are requested, the function performs the fit, 2804 constructs the residuals, measures the residual scatter, and masks the 2805 outlier vector elements. This cycle is repeated N times, though on 2806 the last iteration, no additional masking is performed. The provided 2807 mask must be respected, and any additionally masked elements are also 2808 masked with the same mask vector, which must be provided. The 2809 elements masked by this routine are given the mask value of 1 and may 2810 thus be distinguished from input masked elements if they use a 2811 different mask value. 2705 2812 2706 2813 \begin{prototype}
Note:
See TracChangeset
for help on using the changeset viewer.
