Changeset 1104
- Timestamp:
- Jun 25, 2004, 2:34:15 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/doc/modules/ModulesSDRS.tex (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/modules/ModulesSDRS.tex
r973 r1104 1 %%% $Id: ModulesSDRS.tex,v 1. 2 2004-06-10 01:57:54price Exp $1 %%% $Id: ModulesSDRS.tex,v 1.3 2004-06-26 00:34:15 price Exp $ 2 2 \documentclass[panstarrs]{panstarrs} 3 3 … … 52 52 53 53 This document describes the Pan-STARRS Image Processing Pipeline (IPP) 54 Phase 2 processing modules. Phase 2 is the processing stage wherein54 Phase 2 image processing modules. Phase 2 is the processing stage wherein 55 55 the instrumental signatures are removed from the detector images, in 56 56 preparation for the combination of multiple images in Phase 4. … … 77 77 \item Mask bad pixels; 78 78 \item Mask cosmic rays; 79 \item Mask optical defects;80 \item Measure the PSF;81 \item Find and measure objects;82 \item Correct astrometry; and83 \item Get postage stamps.79 \item \tbd{Mask optical defects;} 80 \item \tbd{Measure the PSF;} 81 \item \tbd{Find and measure objects;} 82 \item \tbd{Correct astrometry; and} 83 \item \tbd{Get postage stamps.} 84 84 \end{itemize} 85 85 86 Each of these shall be discussed in turn, below. 86 Each of these shall be discussed in turn, below. Those modules which 87 are \tbd{TBD} will be deferred until they may be properly defined. 87 88 88 89 These modules are built on top of, and are dependent upon, the \PS{} 89 Library, PSLib. 90 Library, PSLib. Some functions are specified below which should be 91 added to PSLib, since we anticipate that these will also find use in 92 other modules. 90 93 91 94 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% … … 97 100 a kernel derived from the list of OT shifts made during the exposure. 98 101 102 \subsection{Kernel definition} 103 104 In order to perform a convolution, we need to define the convolution 105 kernel. We need a more general object than a \code{psImage} so that 106 we can incorporate the offset from the $(0,0)$ pixel to the $(0,0)$ 107 value of the kernel\footnote{The kernel has both positive and negative 108 indices to convey the positive and negative shifts. One might 109 consider setting the \code{x0} and \code{y0} members of a 110 \code{psImage} to the appropriate offsets, but this is not the purpose 111 of these members, and doing so may affect the behavior of other 112 \code{psImage} operations.}. Hence we define a \code{psKernel}: 113 114 \begin{verbatim} 115 /** A convolution kernel */ 116 typedef struct { 117 int xMin, yMin; ///< Most negative indices 118 int xMax, yMax; ///< Most positive indices 119 float **kernel; ///< The kernel data 120 } psKernel; 121 \end{verbatim} 122 123 The \code{kernel} member shall point to an image that contains the 124 kernel values. The kernel has both positive and negative indices to 125 convey the positive and negative shifts. The maximum extent of these 126 shifts shall be defined by the \code{xMin}, \code{xMax}, \code{yMin} 127 and \code{yMax} members. Note that \code{xMin} and \code{yMin}, under 128 normal circumstances, should be negative numbers. That is, 129 \code{myKernel->kernel[-3][-2]} may be defined if \code{yMin} and 130 \code{xMin} are equal to or more negative than -3 and -2, 131 respectively. 132 133 Of course, we require the appropriate constructor and destructor: 134 \begin{verbatim} 135 psKernel *psKernelAlloc(int xMin, int xMax, int yMin, int yMax); 136 void psKernelFree(psKernel *myKernel); 137 \end{verbatim} 138 139 99 140 \subsection{Calculate the convolution kernel} 100 141 101 142 Given a list of pixel shifts made in the course of OT guiding, 102 \code{psPhase2GetKernel} shall return an image that represents the103 kernel. The API shall bethe following:104 \begin{verbatim} 105 /** Returns the kernel of OT shifts made during the course of the exposure. */ 106 psImage *psPhase2GetKernel(psVector *xShifts, ///< List of OT shifts in x; integers 107 psVector *yShifts ///< List of OT shifts in y; integers; xshifts->n == yShifts->n 108 ); 109 \end{verbatim} 143 \code{psPhase2GetKernel} shall return the kernel. The API shall be 144 the following: 145 \begin{verbatim} 146 psKernel *psPhase2GetKernel(const psVector *xShifts, const psVector *yShifts); 147 \end{verbatim} 148 149 The shift vectors, \code{xShifts} and \code{yShifts}, will be supplied 150 by the user, most probably from the FITS file containing the image. 110 151 111 152 The elements of the shift vectors should be of an integer type, … … 114 155 115 156 The format of the shifts vectors will be a list of the net shift 116 position relative to the starting point for each timestep (there will 117 likely be about 10~Hz $\times$ 30~sec = 300 timesteps). 118 119 If the vectors are not of the same size, then the function shall 120 generate an error. 157 position relative to the starting point for each timestep. In the 158 normal course of \PS{} observations using orthogonal transfer, there 159 will likely be about 10~Hz $\times$ 30~sec $=$ 300 timesteps. 160 161 If the vectors are not of the same number of elements, then the 162 function shall generate a warning shall be generated, following which, 163 the longer vector trimmed to the length of the shorter, and the 164 function shall continue. 121 165 122 166 \subsection{Convolve an image with the kernel} 123 167 124 168 Given an input image and the convolution kernel, 125 \code{psPhase2ConvolveWithKernel} shall convolve the input image with 126 the kernel and return the convolved image. The API shall be the 127 following: 128 \begin{verbatim} 129 /** Returns an image that is the result of convolving the input image with the specified kernel. */ 130 psImage *psPhase2ConvolveWithKernel(psImage *out, ///< Output image, or NULL 131 const psImage *in, ///< Input image to be convolved 132 const psImage *kernel ///< Kernel by which to convolve 133 ); 134 \end{verbatim} 135 136 Two methods shall be used to do the convolution: for small kernels 137 (smaller than 200 total pixels), the convolution shall be performed in 138 real space; for large kernels (larger than 200 total pixels), the 139 convolution shall be performed using Fast Fourier Transforms (FFTs). 140 141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 142 169 \code{psPhase2ConvolveWithKernel} shall convolve the input image, 170 \code{in}, with the kernel, \code{kernel} and return the convolved 171 image, \code{out}. The API shall be the following: 172 \begin{verbatim} 173 psImage *psImageConvolve(psImage *out, const psImage *in, const psKernel *kernel, bool direct); 174 \end{verbatim} 175 176 Two methods shall be available for the convolution: if \code{direct} 177 is \code{true}, then the convolution shall be performed in real space 178 (appropriate for small kernels); otherwise, the convolution shall be 179 performed using Fast Fourier Transforms (FFTs; appropriate for larger 180 kernels). 181 182 In the event that \code{out} is \code{NULL}, a new \code{psImage} 183 shall be allocated and returned. 184 185 \subsection{PSLib Routines} 186 187 \code{psKernel} and \code{psImageConvolve} shall be part of the \PS{} 188 Library, \code{PSLib}, so that they may be re-used for other modules. 189 190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 143 191 144 192 \section{Bias subtraction and trim} … … 162 210 A \code{psImageRegion} specifies the offset from $(0,0)$ on the 163 211 detector\footnote{Note that an image may be smaller than the entire 164 area of the detector if the detector is windowed .} and the size of the165 region.212 area of the detector if the detector is windowed, or if a subimage has 213 been generated.} and the size of the region. 166 214 167 215 We also require a corresponding constructor and destructor: … … 181 229 (\code{psList}) of \code{psImageRegion}s. 182 230 231 \subsection{Splines} 232 233 A spline is a popular choice for fitting 1D data, such as overscans, 234 but we neglected to define them for PSLib. We now define 235 one-dimensional cubic splines, \code{psSpline1D}, which shall be 236 included into PSLib: 237 238 \begin{verbatim} 239 /** A 1D cubic-spline */ 240 typedef struct { 241 int n; ///< Number of spline pieces 242 float *coeff[4]; ///< Coefficients. There are 4 coefficients for each spline piece. 243 float *coeffErr[4]; ///< Errors in the coefficients. 244 bool *mask[4]; ///< Mask for the coefficients. 245 float *domains; ///< The boundaries between each spline piece. Size is n+1. 246 } psSpline1D; 247 \end{verbatim} 248 249 The \code{psSpline1D} structure is very similar to that of the 250 one-dimensional Chebyshev polynomial, \code{psPolynomial1D}, 251 except for the following: 252 \begin{itemize} 253 \item Each spline piece has 4 coefficients (with corresponding error 254 and mask), corresponding to each of the zeroth through third order 255 coefficients of a cubic; and 256 \item It includes an additional member, \code{domains}, which 257 specifies the boundaries between each spline piece (including the two 258 ends). 259 \end{itemize} 260 261 Of course, we require the appropriate constructors and destructor: 262 \begin{verbatim} 263 /** Constructors */ 264 psSpline1D *psSpline1DAlloc(int n, float min, float max); 265 psSpline1D *psSpline1DAllocGeneric(const psVector *bounds); 266 void psSpline1DFree(psSpline1D *mySpline); 267 \end{verbatim} 268 269 \code{psSpline1DAlloc} shall allocate and return a \code{psSpline1D}, 270 setting the \code{domains} on the basis of the input number of spline 271 pieces, \code{n}, and the minimum (\code{min}) and maximum 272 (\code{max}) data values. 273 274 \code{psSpline1DAllocGeneric} shall allocate and return a 275 \code{psSpline1D}, using the \code{bounds} to define the number of 276 spline pieces and the \code{domains}. 277 278 \code{psSpline1DFree} shall free the given spline, and its members. 279 280 Also, as for the polynomials, we require an evaluator. Given a 281 \code{spline} and ordinate at which to evaluate, \code{x}, 282 \code{psSpline1DEval} shall evaluate and return the value of the 283 spline at the ordinate. If the ordinate is outside the bounds, then 284 the function shall generate a warning, and extrapolate the spline to 285 the ordinate and return the value. 286 287 \begin{verbatim} 288 /** Evaluator */ 289 float psSpline1DEval(const psSpline1D *spline, ///< Spline to evaluate 290 float x ///< Normalised (-1,1) coordinates at which to evaluate 291 ); 292 \end{verbatim} 293 294 183 295 \subsection{Bias subtraction} 184 296 … … 187 299 The API shall be the following: 188 300 \begin{verbatim} 189 /** Subtracts an overscan and bias from the input image. */ 190 psReadout *psPhase2SubtractBias(psReadout *in, ///< Input image to be de-biased, and output 191 psPolynomial1D *polySpec, ///< Polynomial specification to use for fit, 192 ///< outputed 193 const psList *regions, ///< Linked list of psImageRegion types. 194 psOverscanAxis overscanAxis, ///< Overscan axis 195 const psStatsOptions *stat, ///< Statistic to use 196 const psImage *bias ///< Bias (or dark) image to subtract 197 ); 198 \end{verbatim} 199 200 The input image shall have the bias subtracted in-place. 201 202 The polynomial specification, \code{polySpec}, specifies the order of 203 a polynomial fit which may be made to the overscan if the 204 \code{overscanAxis} is \code{PS_OVERSCAN_ROWS_FIT} or 205 \code{PS_OVERSCAN_COLUMNS_FIT}. \code{polySpec} shall, upon return, 206 contain the coefficients of the overscan fit, if performed. 207 208 The prescan and/or overscan regions to be used are specified in 209 \code{regions}. 301 psReadout *psPhase2SubtractBias(psReadout *in, void *fitSpec, psOverscanAxis overscanAxis, psBiasFit fit, 302 int nBin, const psList *regions, const psStats *stat, const psImage *bias); 303 \end{verbatim} 304 305 The input image, \code{in}, shall have the bias subtracted in-place. 306 307 The type of the overscan fit specification, \code{fitSpec}, shall be 308 dependent upon the value of \code{fit}, which specifies the type of 309 fit to be employed. \code{fit} is an enumerated type: 310 311 \begin{verbatim} 312 /** Fit type for bias */ 313 typedef enum { 314 PS_OVERSCAN_FIT_NONE, ///< No fit to bias 315 PS_OVERSCAN_FIT_LINEAR, ///< Do linear interpolation on bias 316 PS_OVERSCAN_FIT_POLYNOMIAL, ///< Fit polynomial to bias 317 PS_OVERSCAN_FIT_CHEBYSHEV, ///< Fit chebyshev to bias 318 PS_OVERSCAN_FIT_SPLINE ///< Fit cubic splines to bias 319 } psBiasFit; 320 \end{verbatim} 321 322 If \code{fitSpec} is \code{NULL}, or \code{fit} is 323 \code{PS_OVERSCAN_FIT_NONE}, then no fit shall be performed to the 324 overscan. If \code{fit} is \code{PS_OVERSCAN_FIT_LINEAR}, then the 325 function shall perform simple linear interpolation between points in 326 the overscan. Otherwise, \code{fitSpec} shall be interpreted to be a 327 structure of the appropriate type (\code{psPolynomial1D} for 328 \code{PS_OVERSCAN_FIT_POLYNOMIAL} and 329 \code{PS_OVERSCAN_FIT_CHEBYSHEV}, and \code{psSpline1D} for 330 \code{PS_OVERSCAN_FIT_SPLINE}), and the overscan shall be fit using 331 the specified functional form. Upon return, the \code{fitSpec} shall 332 contain the coefficients of the overscan fit. 210 333 211 334 The \code{overscanAxis} specifies how the prescan/overscan subtraction … … 214 337 /** Overscan axis */ 215 338 typedef enum { 216 PS_OVERSCAN_NONE = 0, ///< No overscan subtraction 217 PS_OVERSCAN_ROWS = 1, ///< Subtract rows 218 PS_OVERSCAN_COLUMNS = 2, ///< Subtract columns 219 PS_OVERSCAN_ROWS_FIT = -1, ///< Subtract a fit to rows 220 PS_OVERSCAN_COLUMNS_FIT = -2, ///< Subtract a fit to columns 221 PS_OVERSCAN_ALL = 3 ///< Subtract the statistic of all pixels in overscan region 339 PS_OVERSCAN_NONE, ///< No overscan subtraction 340 PS_OVERSCAN_ROWS, ///< Subtract rows 341 PS_OVERSCAN_COLUMNS, ///< Subtract columns 342 PS_OVERSCAN_ALL ///< Subtract the statistic of all pixels in overscan region 222 343 } psOverscanAxis; 223 344 \end{verbatim} 224 345 225 No prescan/overscan subtraction shall be performed if the 226 \code{overscanAxis} is \code{PS_OVERSCAN_NONE} or if \code{regions} is 227 \code{NULL}. The subtraction shall be on the basis of rows or columns 228 if the \code{overscanAxis} is \code{PS_OVERSCAN_ROWS} or 229 \code{PS_OVERSCAN_COLUMNS}, respectively. If the \code{overscanAxis} 230 is \code{PS_OVERSCAN_ROWS_FIT} or \code{PS_OVERSCAN_COLUMNS_FIT}, a 231 fit to the prescan/overscan region shall be subtracted from the rows 232 or columns, respectively. Finally, if the \code{overscanAxis} is 233 \code{PS_OVERSCAN_ALL}, then the appropriate statistic (specified by 234 \code{stat}) of all of the pixels in the prescan/overscan region(s) 235 shall be subtracted from the image. 346 If the \code{overscanAxis} is \code{PS_OVERSCAN_NONE}, then the 347 function shall not perform any overscan subtraction. If the 348 \code{overscanAxis} is \code{PS_OVERSCAN_ALL}, then all the overscan 349 regions shall be used to generate a single statistic (specified by 350 \code{stat}) which shall be subtracted from the entire image. A 351 warning shall be generated if the \code{overscanAxis} is 352 \code{PS_OVERSCAN_NONE} or \code{PS_OVERSCAN_ALL} and the \code{fit} 353 is not \code{PS_OVERSCAN_FIT_NONE}. 354 355 If the \code{overscanAxis} is \code{PS_OVERSCAN_ROWS} or 356 \code{PS_OVERSCAN_COLUMNS}, then the overscan shall be reduced to a 357 single vector in the dimension specified using the specified statistic 358 (\code{stat}). If \code{nBin} is positive and less than the dimension 359 of the vector, then the vector shall subsequently be binned down into 360 \code{nBin} bins, again using the specified statistic (\code{stat}). 361 If the overscan is not defined for each row/column, then the function 362 shall generate a warning and then interpolate using the provided 363 functional form if \code{fit} is not \code{PS_OVERSCAN_FIT_NONE}; 364 otherwise, the function shall generate an error. 365 366 The prescan and/or overscan regions to be used are specified in 367 \code{regions}, which is a linked list of \code{psImageRegion}s. If 368 \code{regions} is non-\code{NULL} and \code{overscanAxis} is not 369 \code{PS_OVERSCAN_NONE}, then the function shall generate a warning. 236 370 237 371 The statistic to use in combining multiple pixels in the 238 prescan/overscan regions is specified by \code{stat}. Legal values 239 shall be \code{PS_STAT_SAMPLE_MEAN}, \code{PS_STAT_SAMPLE_MEDIAN}, 240 \code{PS_STAT_ROBUST_MEAN}, \code{PS_STAT_ROBUST_MEDIAN}, 241 \code{PS_STAT_ROBUST_MODE}. \tbd{Note in particular that 242 %\code{PS_STAT_CLIPPED_MEAN} 243 a clipped mean is not supported, because that means we have to supply 244 clipping parameters which isn't very neat.} 245 246 A full-frame bias (or dark) image shall be subtracted if \code{bias} 247 is non-NULL. Note that the input image, \code{in}, and the 248 \code{bias} image need not be the same size, but the function shall 249 use the offsets in the image (\code{in->x0} and \code{in->y0}) to 250 determine the appropriate offsets to obtain the correct pixel on the 251 \code{bias}. In the event that the \code{bias} image is too small 252 (i.e., pixels on the input image refer to pixels outside the range of 253 the \code{bias} image), the function shall generate an error. 372 prescan/overscan regions is specified by \code{stat}. \code{stat} is 373 of type \code{psStats} instead of simply \code{psStatsOptions} so that 374 clipping levels may be specified, if desired. In the event that 375 multiple options are specified by \code{stats}, a warning shall be 376 generated, and the option with the highest priority shall be used, 377 according to the following priority order: \code{PS_STAT_SAMPLE_MEAN}, 378 \code{PS_STAT_SAMPLE_MEDIAN}, \code{PS_STAT_CLIPPED_MEAN}, 379 \code{PS_STAT_ROBUST_MEAN},\ \code{PS_STAT_ROBUST_MEDIAN}, 380 \code{PS_STAT_ROBUST_MODE}. 381 382 A bias (or dark) image shall be subtracted pixel-by-pixel from the 383 input image if \code{bias} is non-NULL. Note that the input image, 384 \code{in}, and the \code{bias} image need not be the same size, but 385 the function shall use the offsets in the image (\code{in->x0} and 386 \code{in->y0}) to determine the appropriate offsets to obtain the 387 correct pixel on the \code{bias}. In the event that the \code{bias} 388 image is too small (i.e., pixels on the input image refer to pixels 389 outside the range of the \code{bias} image), the function shall 390 generate an error. 254 391 255 392
Note:
See TracChangeset
for help on using the changeset viewer.
