Changeset 5367 for trunk/doc/modules/ModulesSDRS.tex
- Timestamp:
- Oct 18, 2005, 10:15:05 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/doc/modules/ModulesSDRS.tex (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/modules/ModulesSDRS.tex
r5361 r5367 1 %%% $Id: ModulesSDRS.tex,v 1.6 1 2005-10-18 14:32:25 eugene Exp $1 %%% $Id: ModulesSDRS.tex,v 1.62 2005-10-18 20:15:05 eugene Exp $ 2 2 \documentclass[panstarrs,spec]{panstarrs} 3 3 … … 1205 1205 \end{itemize} 1206 1206 1207 \subsection{Fringes} 1207 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1208 1209 \section{Detrend Creation} 1210 1211 In the detrend creation process, a collection of raw images are 1212 combined to produce a clean, high-quality master image for correcting 1213 the effect of interest. The input images may potentially be processed 1214 and scaled in some way. The resulting output images may be to be 1215 re-scaled to have a consistent signal for all chips in the mosaic. 1216 The simplest example is the construction of a bias image, in the case 1217 where there is signficant 2-D bias structure. In this case, the input 1218 raw bias images are probably combined without any additional 1219 processing. In another example, flat-field image must be 1220 bias-corrected and scaled to a consistent normalization before being 1221 combined, and the flat-field images from the different chips must be 1222 normalized so that each chip will be flattened consistently across the 1223 mosaic. A complex example is the fringe pattern, in which the input 1224 images must be bias-corrected and flattened, and the resulting images 1225 must be scaled by the amplitude of the fringe pattern on each image, 1226 rather than by the average flux level. In this section, we define the 1227 tools necessary to perform the detrend creation process. 1228 1229 \subsection{Image Stacking} 1230 1231 A basic operation in generating the master detrend images is using a 1232 stack of many input images of a particular type and combining them, 1233 with perhaps some additional scaling, in order to build up 1234 signal-to-noise and to reject deviant pixel. For this, we require a 1235 general purpose image combination module. We forsee this module as 1236 only acting upon data from the same detector, and so each input image 1237 will have the same noise characteristics. 1238 1239 \begin{datatype} 1240 typedef struct { 1241 psStats *stats; // Statistics to use in combining pixels 1242 unsigned int maskVal, // Mask pixels where mask & maskVal == 1 1243 float fracHigh; // Fraction of high pixels to throw 1244 float fracLow; // Fraction of low pixels to throw 1245 int nKeep; // Number of pixels to be sure to keep 1246 } pmCombineParams; 1247 \end{datatype} 1248 1249 \begin{prototype} 1250 psImage * 1251 pmReadoutCombine(psImage *output, // Output image, or NULL 1252 const psList *inputs, // List of input readouts 1253 pmCombineParams *params, // Combination parameters 1254 const psVector *zero, // Offsets to apply for each image 1255 const psVector *scale, // Scales to apply for each image 1256 bool applyZeroScale, // Are zero and scale for application, or only noise properties? 1257 float gain, // Gain in e/ADU 1258 float readnoise // Read noise in e 1259 ); 1260 \end{prototype} 1261 1262 \code{pmReadoutCombine} combines input images pixel by pixel --- for 1263 each pixel of the output image, a stack of contributing input pixels 1264 is formed and combined. Several of its input parameters are lists or 1265 vectors, and if these are not all of the same length (or \code{NULL}), 1266 the module shall generate an error and return \code{NULL}. 1267 1268 If the provided \code{output} is \code{NULL}, then the module shall 1269 allocate a new image of sufficient size for the input images. If the 1270 \code{output} image is non-\code{NULL} and is not of sufficient size 1271 for the combined image, the module shall generate an error and return 1272 \code{NULL}. 1273 1274 If the \code{inputs} is \code{NULL}, the module shall generate an 1275 error and return \code{NULL}. Otherwise, the \code{inputs} shall be a 1276 list of \code{pmReadout}s. The images contained within the 1277 \code{pmReadout}s need not all be of the same size, but the module 1278 shall take into account the offsets (\code{col0,row0}) from the corner 1279 of the detector when comparing pixels, so that it is the same 1280 \textit{physical} pixels that are combined. 1281 1282 The parameters used in the combination, including how the pixels are 1283 to be combined, and how the rejection is performed is contained within 1284 the \code{params}, which may not be \code{NULL} (otherwise the module 1285 shall generate an error and return \code{NULL}). We choose to use 1286 this structure instead of supplying the values separately in order to 1287 keep down the number of parameters to \code{pmReadoutCombine}; the 1288 \code{pmCombineParams} may be recycled for subsequent calls to 1289 \code{pmReadoutCombine} since the values are not dependent upon the 1290 choice of inputs, but merely specify how the combination is to be 1291 performed. 1292 1293 The particular statistic specified by \code{stats} shall be used to 1294 combine each stack of pixels from the input images. Only one of the 1295 statistics choices may be specified, otherwise the module shall 1296 generate an error and return \code{NULL}. 1297 1298 If the \code{maskVal} is non-zero, then pixels in the \code{mask} of 1299 each \code{pmReadout} in the \code{inputs} which satisfy the 1300 \code{maskVal} shall not have the corresponding pixels placed in the 1301 stack for combination. 1302 1303 After masking, but before performing the combination, the highest 1304 \code{fracHigh} fraction and lowest \code{fracLow} fraction of pixels 1305 in the stack are immediately rejected, unless this would leave less 1306 than \code{nKeep} pixels in the stack, in which case no immediate 1307 rejection is performed. 1308 1309 If the \code{zero} vector is non-\code{NULL} and \code{applyZeroScale} 1310 is \code{true}, then the appropriate values shall be added to the 1311 \code{inputs} before rejection is performed. If \code{zero} is 1312 non-\code{NULL} and \code{applyZeroScale} is false, then the values 1313 shall only be used in calculating the Poisson variances. 1314 1315 If the \code{scale} vector is non-\code{NULL} and 1316 \code{applyZeroScale} is \code{true}, then the appropriate values 1317 shall multiply the \code{inputs} before rejection is performed. If 1318 \code{scale} is non-\code{NULL} and \code{applyZeroScale} is false, 1319 then the values shall only be used in calculating the Poisson 1320 variances. 1321 1322 The purpose of \code{applyZeroScale} is to allow combination of fringe 1323 frames, where the frames have been deliberately sky-subtracted and 1324 rescaled (to get the fringes amplitudes running from -1 to 1), which 1325 actions should not be undone when combining, but yet it is desirable 1326 to provide the \code{zero} and \code{scale} values so that the correct 1327 noise properties are used in the combination. 1328 1329 If the \code{gain} and \code{readnoise} are positive and non-negative 1330 (respectively), then these shall be used to provide weights for the 1331 combination using Poisson statistics ($\sigma_i$ below). 1332 1333 In summary, pixels corresponding to the same physical pixel are 1334 combined, having values $x_i \pm \sigma_i$. In the case that 1335 \code{applyZeroScale} is \code{true}, then: 1336 \begin{eqnarray} 1337 x_i & = & s_i f_i + z_i \\ 1338 \sigma_i & = & [g x_i + r^2]^{1/2} / g 1339 \end{eqnarray} 1340 Where $f_i$ is the value of the pixel in image $i$, $s_i$ is the scale 1341 applied to image $i$, $z_i$ is the zero offset applied to image $i$, 1342 $g$ is the gain, and $r$ is the read noise. If scales are not 1343 provided, they are set to unity; if zero offsets are not provided, 1344 they are set to zero. 1345 1346 If \code{applyZeroScale} is \code{false}, then the values are: 1347 \begin{eqnarray} 1348 x_i & = & f_i \\ 1349 \sigma_i & = & [g (s_i f_i + z_i) + r^2]^{1/2} / g 1350 \end{eqnarray} 1351 where the same symbols are used as above. 1352 1353 The \code{inputs, zero} and \code{scale} may be of U16, S32 and F32 1354 types, and must all be of the same type. The \code{output} shall be 1355 of the same type. 1356 1357 \subsection{Fringe Amplitude} 1208 1358 1209 1359 Some images contain a signal caused by thin-film interference in the … … 1225 1375 1226 1376 A simple approach to the fringe pattern is to subtract a master fringe 1227 frame scaled by the amplitude of the fringe pattern. We thus need a 1228 method of measuring the fringe amplitude which is robust in the 1229 presence of stars and which is fast. We implement a method used at 1230 CFHT in which the fringe pattern is mapped by a series of points pairs 1231 which correspond to peaks and valleys of the fringe pattern. We 1232 define the following function to measure the global fringe amplitude 1233 of an image given a collection of fringe point pairs. 1377 frame scaled by the amplitude of the fringe pattern. The amplitude of 1378 the fringe pattern is used both in the process of constructing the 1379 master image and in scaling the master image when it is applied to 1380 science image. We thus need a method of measuring the fringe 1381 amplitude which is robust in the presence of stars and which is fast. 1382 We implement a method used at CFHT in which the fringe pattern is 1383 mapped by a series of points pairs which correspond to peaks and 1384 valleys of the fringe pattern. We define the following function to 1385 measure the global fringe amplitude of an image given a collection of 1386 fringe point pairs. 1234 1387 \begin{prototype} 1235 1388 stats *pmFringeStats (psArray *fringePoints, psImage *image, psMetadata *config); … … 1256 1409 \end{datatype} 1257 1410 1258 1259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1260 1261 \section{Calibration} 1262 1263 The calibration module essentially consists of combining multiple 1264 images of a particular type in order to build up signal-to-noise. For 1265 this, we require a general purpose image combination module. We 1266 forsee this module as only acting upon data from the same detector, 1267 and so each input image will have the same noise characteristics. 1268 1269 \begin{datatype} 1270 typedef struct { 1271 psStats *stats; // Statistics to use in combining pixels 1272 unsigned int maskVal, // Mask pixels where mask & maskVal == 1 1273 float fracHigh; // Fraction of high pixels to throw 1274 float fracLow; // Fraction of low pixels to throw 1275 int nKeep; // Number of pixels to be sure to keep 1276 } pmCombineParams; 1277 \end{datatype} 1278 1279 \begin{prototype} 1280 psImage * 1281 pmReadoutCombine(psImage *output, // Output image, or NULL 1282 const psList *inputs, // List of input readouts 1283 pmCombineParams *params, // Combination parameters 1284 const psVector *zero, // Offsets to apply for each image 1285 const psVector *scale, // Scales to apply for each image 1286 bool applyZeroScale, // Are zero and scale for application, or only noise properties? 1287 float gain, // Gain in e/ADU 1288 float readnoise // Read noise in e 1289 ); 1290 \end{prototype} 1291 1292 \code{pmReadoutCombine} combines input images pixel by pixel --- for 1293 each pixel of the output image, a stack of contributing input pixels 1294 is formed and combined. Several of its input parameters are lists or 1295 vectors, and if these are not all of the same length (or \code{NULL}), 1296 the module shall generate an error and return \code{NULL}. 1297 1298 If the provided \code{output} is \code{NULL}, then the module shall 1299 allocate a new image of sufficient size for the input images. If the 1300 \code{output} image is non-\code{NULL} and is not of sufficient size 1301 for the combined image, the module shall generate an error and return 1302 \code{NULL}. 1303 1304 If the \code{inputs} is \code{NULL}, the module shall generate an 1305 error and return \code{NULL}. Otherwise, the \code{inputs} shall be a 1306 list of \code{pmReadout}s. The images contained within the 1307 \code{pmReadout}s need not all be of the same size, but the module 1308 shall take into account the offsets (\code{col0,row0}) from the corner 1309 of the detector when comparing pixels, so that it is the same 1310 \textit{physical} pixels that are combined. 1311 1312 The parameters used in the combination, including how the pixels are 1313 to be combined, and how the rejection is performed is contained within 1314 the \code{params}, which may not be \code{NULL} (otherwise the module 1315 shall generate an error and return \code{NULL}). We choose to use 1316 this structure instead of supplying the values separately in order to 1317 keep down the number of parameters to \code{pmReadoutCombine}; the 1318 \code{pmCombineParams} may be recycled for subsequent calls to 1319 \code{pmReadoutCombine} since the values are not dependent upon the 1320 choice of inputs, but merely specify how the combination is to be 1321 performed. 1322 1323 The particular statistic specified by \code{stats} shall be used to 1324 combine each stack of pixels from the input images. Only one of the 1325 statistics choices may be specified, otherwise the module shall 1326 generate an error and return \code{NULL}. 1327 1328 If the \code{maskVal} is non-zero, then pixels in the \code{mask} of 1329 each \code{pmReadout} in the \code{inputs} which satisfy the 1330 \code{maskVal} shall not have the corresponding pixels placed in the 1331 stack for combination. 1332 1333 After masking, but before performing the combination, the highest 1334 \code{fracHigh} fraction and lowest \code{fracLow} fraction of pixels 1335 in the stack are immediately rejected, unless this would leave less 1336 than \code{nKeep} pixels in the stack, in which case no immediate 1337 rejection is performed. 1338 1339 If the \code{zero} vector is non-\code{NULL} and \code{applyZeroScale} 1340 is \code{true}, then the appropriate values shall be added to the 1341 \code{inputs} before rejection is performed. If \code{zero} is 1342 non-\code{NULL} and \code{applyZeroScale} is false, then the values 1343 shall only be used in calculating the Poisson variances. 1344 1345 If the \code{scale} vector is non-\code{NULL} and 1346 \code{applyZeroScale} is \code{true}, then the appropriate values 1347 shall multiply the \code{inputs} before rejection is performed. If 1348 \code{scale} is non-\code{NULL} and \code{applyZeroScale} is false, 1349 then the values shall only be used in calculating the Poisson 1350 variances. 1351 1352 The purpose of \code{applyZeroScale} is to allow combination of fringe 1353 frames, where the frames have been deliberately sky-subtracted and 1354 rescaled (to get the fringes amplitudes running from -1 to 1), which 1355 actions should not be undone when combining, but yet it is desirable 1356 to provide the \code{zero} and \code{scale} values so that the correct 1357 noise properties are used in the combination. 1358 1359 If the \code{gain} and \code{readnoise} are positive and non-negative 1360 (respectively), then these shall be used to provide weights for the 1361 combination using Poisson statistics ($\sigma_i$ below). 1362 1363 In summary, pixels corresponding to the same physical pixel are 1364 combined, having values $x_i \pm \sigma_i$. In the case that 1365 \code{applyZeroScale} is \code{true}, then: 1366 \begin{eqnarray} 1367 x_i & = & s_i f_i + z_i \\ 1368 \sigma_i & = & [g x_i + r^2]^{1/2} / g 1369 \end{eqnarray} 1370 Where $f_i$ is the value of the pixel in image $i$, $s_i$ is the scale 1371 applied to image $i$, $z_i$ is the zero offset applied to image $i$, 1372 $g$ is the gain, and $r$ is the read noise. If scales are not 1373 provided, they are set to unity; if zero offsets are not provided, 1374 they are set to zero. 1375 1376 If \code{applyZeroScale} is \code{false}, then the values are: 1377 \begin{eqnarray} 1378 x_i & = & f_i \\ 1379 \sigma_i & = & [g (s_i f_i + z_i) + r^2]^{1/2} / g 1380 \end{eqnarray} 1381 where the same symbols are used as above. 1382 1383 The \code{inputs, zero} and \code{scale} may be of U16, S32 and F32 1384 types, and must all be of the same type. The \code{output} shall be 1385 of the same type. 1411 \subsection{Flat-field Re-Normalization} 1412 1413 Consider a collection of $N_i$ flat-field images obtained with a 1414 mosaic camera consisting of $N_j$ chips. Each image is exposed to an 1415 illumination source which should be a uniform surface 1416 brightness\footnote{This is likely a false assumption: the 1417 illumination source likely has spatial variations. However, for the 1418 purposes of this discussion, it only matters that such spatial 1419 variations scale consistently as a function of illumination intensity. 1420 The spatial errors are corrected by the photometric flat-field 1421 correction technique (eg., Magnier \& Cuillandre 2004).} Two factors 1422 determine the actual measured flux level (in Digital Numbers) on each 1423 of the chips in each image: the gain of each chip ($\mbox{gain}_j$) 1424 and the flux level from the illumination source ($\mbox{source}_i$). 1425 When the images are combined, the input images must be scaled so that 1426 the flux levels can be consistently compared. After combining the 1427 collection of images, it is necessary to determine an appropriate 1428 re-normalization for the resulting flat-field images. In effect, the 1429 individual chips must be adjusted so that the master flat-field image 1430 has a flux level which varies from chip to chip in proportion to the 1431 actual chip gain. In this case, if a uniform illumination source 1432 illuminates the mosaic, the resulting flux levels will be corrected by 1433 the flat-field to a single, consistent flux level. 1434 1435 In order to determine the correct relative scaling between the 1436 devices, it is thus necessary to know the individual chip gains, or at 1437 least the gain ratios. A typical technique scaled all chips relative 1438 to a reference chip, or by a statistic measured for the complete 1439 collection. These techniques fail if the input collection of images 1440 does not always consist of the same set of chips; for the GPC on 1441 Pan-STARRS, we must expect that individual cells or even chips may be 1442 disabled on a frequent basis, so our algorithms must not be limited by 1443 the assumption that all chips are available in all images. We 1444 therefore define the following algorithm to measure the relative chip 1445 gains for a collection of input flat-field images, each with a 1446 measured flux $\mbox{flux}_{i,j}$. We want to solve for the chip 1447 gains and the source illumination fluxes which would make the best 1448 prediction of the measured input image fluxes: 1449 \[ 1450 \mbox{flux}^{\rm pred}_{i,j} = \mbox{gain}_j \times \mbox{source}_i 1451 \] 1452 This relationship is easiest to determine if we take the logarithm of 1453 both sides of the equation: 1454 \[ 1455 M^{\rm pred}_{i,j} = G_j + S_i 1456 \] 1457 where $M^{\rm pred}_{i,j} = \log \mbox{flux}^{\rm pred}_{i,j}$, $G_j = 1458 \log \mbox{gain}_j$, and $\log \mbox{source}_i = S_i$. We can then 1459 write the chi-square which we want to minimize as: 1460 \[ 1461 \chi^2 = \sum_{i,j} (M^{\rm obs}_{i,j} - G_j - S_i)^2 1462 \] 1463 where we ignore the weights of the different measured flux levels. 1464 Taking the derivatives with respect to the parameters of interest 1465 ($G_j, S_i$), and setting them to 0, we determine the following set of 1466 equations which must be solved: 1467 \[ 1468 G_j \times N_i = \sum_i M^{\rm obs}_{i,j} - \sum_i S_i 1469 \] 1470 \[ 1471 S_j \times N_j = \sum_j M^{\rm obs}_{i,j} - \sum_j G_j \\ 1472 \] 1473 This set of equations can be solved iteratively, starting from the 1474 assumption that all chip gains are 1.0, ($G_j = 0$), or by supplying 1475 a guess for the chip gains. The result of this analysis is the 1476 measured chip gains and the measured source illumination levels for 1477 each of the input flat-field images. The chip gains can then be used 1478 to modify the flux levels on the master flat-field images. 1479 1480 We define the following function to perform the analysis discussed 1481 above: 1482 \begin{prototype} 1483 bool pmFlatNormalization (psVector *sourceFlux, psVector *chipGains, psArray *fluxLevels); 1484 \end{prototype} 1485 The input array \code{fluxLevels} consists of $N_i$ vectors, one per 1486 mosaic image. Each vector consists of $N_j$ elements, each a 1487 measurement of the input flat-field image flux levels. All of these 1488 vectors must be constructed with the same number of elements, or the 1489 function will return an error. If a chip is missing from a particular 1490 image, that element should be set to \code{NaN}. The vector 1491 \code{chipGains} supplies initial guesses for the chip gains. If the 1492 vector contains the values 0.0 or \code{NaN} for any of the elements, 1493 the gain is set to the mean of the valid values. If the vector length 1494 does not match the number of chips, an warning is raised, all chip 1495 gain guesses will be set to 1.0, and the vector length modified to 1496 match the number of chips defined by the supplied \code{fluxLevels}. 1497 The \code{sourceFlux} input vector must be allocated (not 1498 \code{NULL}), but the routine will set the vector length to the number 1499 of source images regardless of the initial state of the vector. All 1500 vectors used by this function must be of type \code{PS_DATA_F64}. 1501 1502 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1386 1503 1387 1504 \section{Objects on Images}
Note:
See TracChangeset
for help on using the changeset viewer.
