Changeset 1437
- Timestamp:
- Aug 9, 2004, 1:22:58 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/doc/pslib/psLibSDRS.tex (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/pslib/psLibSDRS.tex
r1415 r1437 1 %%% $Id: psLibSDRS.tex,v 1.6 3 2004-08-07 04:11:59price Exp $1 %%% $Id: psLibSDRS.tex,v 1.64 2004-08-09 23:22:58 price Exp $ 2 2 \documentclass[panstarrs,spec]{panstarrs} 3 3 … … 32 32 01 & 2004 May 19 & Extensive modifications, see appendix \\ \hline 33 33 02 & 2004 Jun 22 & Incorporation of Bugzilla PRs (up to 69) \\ \hline 34 03 & 2004 Aug 0 6& Adding convolution, splines, chebyshevs \\34 03 & 2004 Aug 09 & Adding convolution, splines, chebyshevs \\ 35 35 & & (modified polynomials), ImageTrim for Phase 2 \\ \hline 36 36 \RevisionsEnd … … 1895 1895 and double-precision (for milli-arcsec precision) versions. We must 1896 1896 also be able to calculate the errors in the fit coefficients, as well 1897 as be able to turn on and off each coefficient. This leads us to 1898 define the following polynomial types: 1897 as be able to turn on and off each coefficient. 1898 1899 In addition to general polynomials ($\sum_{i=0}^n a_i x^i$), we also 1900 use Chebyshev polynomials ($\sum_{i=0}^n a_i T_i(x)$), which have 1901 properties which are useful in the modeling of data over a defined 1902 domain. 1903 1904 This leads us to define the following polynomial types: 1899 1905 1900 1906 \begin{verbatim} 1901 1907 /** One-dimensional polynomial */ 1902 1908 typedef struct { 1909 psPolynomialType type; ///< Polynomial type 1903 1910 int n; ///< Number of terms 1904 1911 float *restrict coeff; ///< Coefficients … … 1911 1918 /** Two-dimensional polynomial */ 1912 1919 typedef struct { 1920 psPolynomialType type; ///< Polynomial type 1913 1921 int nX, nY; ///< Number of terms in x and y 1914 1922 float *restrict *restrict coeff; ///< Coefficients … … 1918 1926 \end{verbatim} 1919 1927 1920 etc., up to four dimensions. We also define double-precision versions: 1928 etc., up to four dimensions. \code{psPolynomialType} is an 1929 enumerated type specifying the type of the polynomial: ordinary 1930 or Chebyshev: 1931 1932 \begin{verbatim} 1933 /** Type of polynomial */ 1934 typedef enum { 1935 PS_POLYNOMIAL_ORD, ///< Ordinary polynomial 1936 PS_POLYNOMIAL_CHEB ///< Chebyshev polynomial 1937 } psPolynomialType; 1938 \end{verbatim} 1939 1940 We also define double-precision versions of the polynomials: 1921 1941 1922 1942 \begin{verbatim} 1923 1943 /** Double-precision one-dimensional polynomial */ 1924 1944 typedef struct { 1945 psPolynomialType type; ///< Polynomial type 1925 1946 int n; ///< Number of terms 1926 1947 double *restrict coeff; ///< Coefficients … … 1933 1954 /** Double-precision two-dimensional polynomial */ 1934 1955 typedef struct { 1956 psPolynomialType type; ///< Polynomial type 1935 1957 int nX, nY; ///< Number of terms in x and y 1936 1958 double *restrict *restrict coeff; ///< Coefficients … … 1946 1968 The constructor and destructor are: 1947 1969 \begin{verbatim} 1948 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY );1970 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY, psPolynomialType type); 1949 1971 void p_psDPolynomial2DFree(psDPolynomial2D *restrict myPoly); 1950 1972 \end{verbatim} … … 1957 1979 \end{verbatim} 1958 1980 1981 In the event that several evaluations are required, we also define: 1982 \begin{verbatim} 1983 psVector *psDPolynomial2DEvalVector(psVector *x, psVector *y, const psDPolynomial2D *restrict myPoly); 1984 \end{verbatim} 1985 If the \code{x} and \code{y} vectors do not match the precision of the 1986 polynomial, the function shall generate a warning, and convert the 1987 vectors to the appropriate precision. In the event that the \code{x} 1988 and \code{y} vectors are of differing sizes, the function shall 1989 generate a warning, truncate the longer vector to the size of the 1990 shorter, and continue. The precision of the output \code{psVector} 1991 shall match that of the polynomial. 1992 1993 \subsubsection{Splines} 1994 1995 A spline is a popular choice for fitting 1D data, such as overscans, 1996 but we neglected to define them for PSLib. We now define 1997 one-dimensional cubic splines, \code{psSpline1D}, which shall be 1998 incorporated into PSLib: 1999 2000 \begin{verbatim} 2001 /** A 1D cubic-spline */ 2002 typedef struct { 2003 int n; ///< Number of spline pieces 2004 psPolynomial1D *spline; ///< Array of n splines 2005 float *domains; ///< The boundaries between each spline piece. Size is n+1. 2006 } psSpline1D; 2007 \end{verbatim} 2008 2009 The \code{psSpline1D} structure consists of an array of \code{n} 2010 polynomials, which are the spline pieces. Note that this means that 2011 the spline pieces may, in general, be of any order. \textbf{For the 2012 present, we shall restrict the order of the polynomials to either 1 2013 (linear) or 3 (cubic).} All the spline pieces shall have the same 2014 order polynomial (the type of polynomial is left to the 2015 implementation). The \code{domains} member specifies the boundaries 2016 between each spline piece (including the two ends). 2017 2018 Of course, we require the appropriate constructors and destructor: 2019 \begin{verbatim} 2020 psSpline1D *psSpline1DAlloc(int n, int order, float min, float max); 2021 psSpline1D *psSpline1DAllocGeneric(const psVector *bounds, int order); 2022 \end{verbatim} 2023 2024 \code{psSpline1DAlloc} shall allocate and return a \code{psSpline1D}, 2025 setting the \code{domains} on the basis of the input number of spline 2026 pieces, \code{n}, and the minimum (\code{min}) and maximum 2027 (\code{max}) data values. The spline pieces shall be of the specified 2028 \code{order}. 2029 2030 \code{psSpline1DAllocGeneric} shall allocate and return a 2031 \code{psSpline1D}, using the \code{bounds} to define the number of 2032 spline pieces and the \code{domains}. The spline pieces shall be of 2033 the specified \code{order}. 2034 2035 Also, as for the polynomials, we require evaluators. Given a 2036 \code{spline} and ordinate at which to evaluate, \code{x}, 2037 \code{psSpline1DEval} shall evaluate and return the value of the 2038 spline at the ordinate. If the ordinate is outside the bounds, then 2039 the function shall generate a warning, and extrapolate the spline to 2040 the ordinate and return the value. Similarly, 2041 \code{psSpline1DEvalVector} shall return a vector of evaluated values 2042 for an input vector of ordinates. 2043 2044 \begin{verbatim} 2045 float psSpline1DEval(const psSpline1D *spline, float x); 2046 psVector *psSpline1DEvalVector(psVector *x, const psSpline1D *spline); 2047 \end{verbatim} 2048 2049 1959 2050 \subsubsection{Gaussians} 1960 2051 1961 2052 Gaussians are used extensively in any data-analysis system, in 1962 particular to represent a real population distribution. We require 1963 afunction to evaluate a Gaussian for a given coordinate and one which2053 particular to represent a real population distribution. We require a 2054 function to evaluate a Gaussian for a given coordinate and one which 1964 2055 generates a Gaussian deviate; a collection of data points whose 1965 distribution obeys a specified Gaussian. 2056 distribution obeys a specified Gaussian. 1966 2057 1967 2058 The Gaussian evaluation is provide by: … … 2044 2135 2045 2136 \begin{verbatim} 2046 psPolynomial1D *psVectorFitPolynomial1D(psPolynomial1D myPoly,2047 const psVector *restrict x,2048 const psVector *restrict y,2049 const psVector *restrict yErr);2137 psPolynomial1D *psVectorFitPolynomial1D(psPolynomial1D *myPoly, 2138 const psVector *restrict x, 2139 const psVector *restrict y, 2140 const psVector *restrict yErr); 2050 2141 \end{verbatim} 2051 2142 \code{psVectorFitPolynomial1d} returns the polynomial that best fits the … … 2058 2149 determined in the assumption that all data errors are equal. This 2059 2150 function must be valid only for types \code{psF32}, \code{psF64}. 2151 2152 \begin{verbatim} 2153 psSpline1D *psVectorFitSpline1D(psSpline1D *mySpline, 2154 const psVector *x, 2155 const psVector *y, 2156 const psVector *yErr); 2157 \end{verbatim} 2158 \code{psVectorFitSpline} shall return the spline that best fits the 2159 given combination of ordinates (\code{x}) and coordinates (\code{y}). 2160 As for \code{psVectorFitPolynomial1D}, if \code{x} is \code{NULL}, 2161 then the vector index shall be used as the ordinate; and if 2162 \code{yErr} is \code{NULL}, then all the data errors shall be assumed 2163 to be equal. This function must be valid only for types \code{psF32}, 2164 \code{psF64}. 2060 2165 2061 2166 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% … … 2096 2201 \code{psS8}, \code{psS16}, \code{psF32}, \code{psF64}, \code{psC32}, 2097 2202 \code{psC64}. 2203 2204 \begin{verbatim} 2205 psImage *psImageTrim(psImage *image, int x0, int x1, int y0, int y1); 2206 \end{verbatim} 2207 Trim the specified \code{image} in-place, which involves shuffling the 2208 pixels around in memory. The pixels in the region 2209 \code{[x0:x1,y0:y1]} (inclusive) shall consist the output image. 2210 2211 The function shall generate an error if the specified region is 2212 outside the bounds of the input image. 2098 2213 2099 2214 \subsubsection{Image Pixel Extractions} … … 2663 2778 int xMax, yMax; ///< Most positive indices 2664 2779 float **kernelRows; ///< Pointer to the rows of the kernel data 2665 float **kernel; ///< Pointer to inthe kernel data2780 float **kernel; ///< Pointer to the kernel data 2666 2781 } psKernel; 2667 2782 \end{verbatim}
Note:
See TracChangeset
for help on using the changeset viewer.
