Changeset 288
- Timestamp:
- Mar 23, 2004, 3:54:57 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/doc/pslib/psLibSDRS.tex (modified) (84 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/pslib/psLibSDRS.tex
r285 r288 418 418 \end{verbatim} 419 419 \caption{An example of reference counting} 420 \label{tabReferenceCounting} 420 421 \end{table} 421 422 … … 470 471 int psGetTraceLevel(const char *name); // facilty of interest 471 472 472 void psTraceReset(void); // turn off all tracing, and free trace's allocated memory473 void psTraceReset(void); // turn off all tracing, and free trace's allocated memory 473 474 474 475 void psPrintTraceLevels(void); // print trace levels … … 815 816 816 817 This type and functions may be declared and defined using two macros 817 from \file{psArray.h} (table \ref{tabPsArray}), 818 \code{PS_DECLARE_ARRAY_TYPE(psType)} and 819 \code{PS_CREATE_ARRAY_TYPE(psType)}. The former defines the \code{typedef} 820 and declares the prototypes (and is thus suitable for use in a 821 header file); the latter generates the code for the three functions 822 \code{psType(Alloc|Realloc|Free)} (and should thus appear in exactly one 823 source file for a given type). 818 from \file{psArray.h}, \code{PS_DECLARE_ARRAY_TYPE(psType)} and 819 \code{PS_CREATE_ARRAY_TYPE(psType)}. The former defines the 820 \code{typedef} and declares the prototypes (and is thus suitable for 821 use in a header file); the latter generates the code for the three 822 functions \code{psType(Alloc|Realloc|Free)} (and should thus appear in 823 exactly one source file for a given type). 824 824 825 825 The \code{psType} should be a single word (e.g. \code{psXY}); in particular, … … 837 837 If you wish to use arrays of pointers, use the macros 838 838 \code{PS_DECLARE_ARRAY_PTR_TYPE(psType)} and 839 \code{PS_CREATE_ARRAY_PTR_TYPE(psType)} (table \ref{tabPsArray}). These839 \code{PS_CREATE_ARRAY_PTR_TYPE(psType)}. These 840 840 create types \code{typedef psType *psTypePtr} and \code{psTypePtrArray}: 841 841 \begin{verbatim} … … 931 931 932 932 for (int i = 0; i < t->n; i++) { 933 t->arr[i].x = i;934 pt->arr[i]->y = 10*i;933 t->arr[i].x = i; 934 pt->arr[i]->y = 10*i; 935 935 } 936 936 … … 939 939 940 940 for (int i = 0; i < t->n; i++) { 941 printf("%d %d ", t->arr[i].x, pt->arr[i]->y);941 printf("%d %d ", t->arr[i].x, pt->arr[i]->y); 942 942 } 943 943 printf("\n"); … … 1100 1100 /** Set a bit mask */ 1101 1101 psBitMask * 1102 psBitMaskSet(psBitMask *outMask, //!< Output bit mask or NULL1103 const psBitMask *myMask,//!< Input bit mask1104 int bit//!< Bit to set1102 psBitMaskSet(psBitMask *outMask, //!< Output bit mask or NULL 1103 const psBitMask *myMask, //!< Input bit mask 1104 int bit //!< Bit to set 1105 1105 ); 1106 1106 \end{verbatim} … … 1110 1110 int 1111 1111 psBitMaskTest(const psBitMask *checkMask, //!< Bit mask to check 1112 int bit//!< Bit to check1112 int bit //!< Bit to check 1113 1113 ); 1114 1114 \end{verbatim} … … 1117 1117 /** apply the given operator to two bit masks */ 1118 1118 psBitMask * 1119 psBitMaskOp(psBitMask *outMask, //!< Output bit mask or NULL1120 const psBitMask *restrict inMask1, //!< Input bit mask 11121 char *operator,//!< bit mask operator (AND, OR, XOR)1122 const psBitMask *restrict inMask2 //!< Input bit mask 21119 psBitMaskOp(psBitMask *outMask, //!< Output bit mask or NULL 1120 const psBitMask *restrict inMask1, //!< Input bit mask 1 1121 char *operator, //!< bit mask operator (AND, OR, XOR) 1122 const psBitMask *restrict inMask2 //!< Input bit mask 2 1123 1123 ); 1124 1124 \end{verbatim} … … 1176 1176 /** create a psType-ed structure from a specified type */ 1177 1177 p_ps_Scalar * 1178 psScalarType (char *mode, ///< type description1179 ...///< value (or values) of specified types1178 psScalarType (char *mode, ///< type description 1179 ... ///< value (or values) of specified types 1180 1180 ); 1181 1181 \end{verbatim} … … 1185 1185 psType type; 1186 1186 union { 1187 int i;1188 float f;1189 double d;1190 complex float c;1187 int i; 1188 float f; 1189 double d; 1190 complex float c; 1191 1191 } 1192 1192 } p_psScalar; … … 1213 1213 /** Sort an array. Inputs not restrict-ed to allow sort in place */ 1214 1214 psFloatArray * 1215 psSort(psFloatArray *out, //!< Sorted array to return. May be NULL1216 const psFloatArray *myArray //!< Array to sort1215 psSort(psFloatArray *out, //!< Sorted array to return. May be NULL 1216 const psFloatArray *myArray //!< Array to sort 1217 1217 ); 1218 1218 \end{verbatim} … … 1226 1226 /** Sort an array, along with some other stuff. Returns an index array */ 1227 1227 psIntArray * 1228 psSortIndex(psIntArray *restrict out; //!< Output index array (may be NULL)1229 const psFloatArray *restrict myArray //!< Array to sort1228 psSortIndex(psIntArray *restrict out; //!< Output index array (may be NULL) 1229 const psFloatArray *restrict myArray //!< Array to sort 1230 1230 ); 1231 1231 \end{verbatim} … … 1267 1267 psStats * 1268 1268 psArrayStats(const psFloatArray *restrict myArray, //!< Array to be analysed 1269 const psIntArray *restrict maskArray, //!< Ignore elements where (maskArray & maskVal) != 01270 //!< May be NULL1271 unsigned int maskVal,//!< Only mask elements with one of these bits set in maskArray1272 psStats *stats//!< stats structure defines stats to be calculated and how1273 );1269 const psIntArray *restrict maskArray, //!< Ignore elements where (maskArray & maskVal) != 0 1270 //!< May be NULL 1271 unsigned int maskVal, //!< Only mask elements with one of these bits set in maskArray 1272 psStats *stats //!< stats structure defines stats to be calculated and how 1273 ); 1274 1274 \end{verbatim} 1275 1275 … … 1280 1280 /** generic statistics structure */ 1281 1281 typedef struct { 1282 double sampleMean; //<! formal mean of sample1283 double sampleMedian; //<! formal median of sample1284 double sampleMode; //!< Formal mode of sample1285 double sampleStdev; //<! standard deviation of sample1286 double sampleUQ; //<! upper quartile of sample1287 double sampleLQ; //<! lower quartile of sample1288 double robustMean; //<! robust mean of array1289 double robustMeanError; //<! error on robust mean1290 int robustMeanNvalues; //<! number of measurements used for robust mean1291 double robustMedian; //<! robust median of array1292 double robustMedianError; //<! error on robust median1293 int robustMedianNvalues; //<! number of measurements used for robust median1294 double robustMode; //!< Robust mode of array1295 double robustModeErr; //!< Error in robust mode1296 int robustModeNvalues; //!< Number of measurements used for robust mode1297 double robustStdev; //<! robust standard deviation of array1298 double robustUQ; //<! robust upper quartile1299 double robustLQ; //<! robust lower quartile1300 double clippedMean; //<! Nsigma clipped mean1301 double clippedMeanError; //<! error on clipped mean1302 int clippedMeanNvalues; //<! number of data points used for clipped mean1303 double clippedStdev; //!< standard deviation after clipping1304 double clipSigma; //<! Nsigma used for clipping; user input1305 int clipIter; //!< Number of clipping iterations; user input1306 double min; //<! minimum data value in array1307 double max; //<! maximum data value in array1308 int nValues; //<! number of data values in array1309 psStatsOptions options; //<! bitmask of calculated values1282 double sampleMean; //<! formal mean of sample 1283 double sampleMedian; //<! formal median of sample 1284 double sampleMode; //!< Formal mode of sample 1285 double sampleStdev; //<! standard deviation of sample 1286 double sampleUQ; //<! upper quartile of sample 1287 double sampleLQ; //<! lower quartile of sample 1288 double robustMean; //<! robust mean of array 1289 double robustMeanError; //<! error on robust mean 1290 int robustMeanNvalues; //<! number of measurements used for robust mean 1291 double robustMedian; //<! robust median of array 1292 double robustMedianError; //<! error on robust median 1293 int robustMedianNvalues; //<! number of measurements used for robust median 1294 double robustMode; //!< Robust mode of array 1295 double robustModeErr; //!< Error in robust mode 1296 int robustModeNvalues; //!< Number of measurements used for robust mode 1297 double robustStdev; //<! robust standard deviation of array 1298 double robustUQ; //<! robust upper quartile 1299 double robustLQ; //<! robust lower quartile 1300 double clippedMean; //<! Nsigma clipped mean 1301 double clippedMeanError; //<! error on clipped mean 1302 int clippedMeanNvalues; //<! number of data points used for clipped mean 1303 double clippedStdev; //!< standard deviation after clipping 1304 double clipSigma; //<! Nsigma used for clipping; user input 1305 int clipIter; //!< Number of clipping iterations; user input 1306 double min; //<! minimum data value in array 1307 double max; //<! maximum data value in array 1308 int nValues; //<! number of data values in array 1309 psStatsOptions options; //<! bitmask of calculated values 1310 1310 } psStats; 1311 1311 \end{verbatim} … … 1320 1320 /** Histograms */ 1321 1321 typedef struct { 1322 const psFloatArray *restrict lower; //!< Lower bounds for the bins1322 const psFloatArray *restrict lower; //!< Lower bounds for the bins 1323 1323 const psFloatArray *restrict upper; //!< Upper bounds for the bins 1324 psIntArray *nums; //!< Number in each of the bins1325 const float minVal, maxVal; //!< Minimum and maximum values1326 int minNum, maxNum; //!< Number below the minimum and above the maximum1324 psIntArray *nums; //!< Number in each of the bins 1325 const float minVal, maxVal; //!< Minimum and maximum values 1326 int minNum, maxNum; //!< Number below the minimum and above the maximum 1327 1327 } psHistogram; 1328 1328 \end{verbatim} … … 1336 1336 /** Constructor */ 1337 1337 psHistogram * 1338 psHistogramAlloc(float lower, //!< Lower limit for the bins1339 float upper,//!< Upper limit for the bins1340 float size//!< Size of the bins1338 psHistogramAlloc(float lower, //!< Lower limit for the bins 1339 float upper, //!< Upper limit for the bins 1340 float size //!< Size of the bins 1341 1341 ); 1342 1342 \end{verbatim} … … 1346 1346 psHistogram * 1347 1347 psHistogramAllocGeneric(const psFloatArray *restrict lower, //!< Lower bounds for the bins 1348 const psFloatArray *restrict upper, //!< Upper bounds for the bins1349 float minVal,//!< Minimum value1350 float maxVal//!< Maximum value1348 const psFloatArray *restrict upper, //!< Upper bounds for the bins 1349 float minVal, //!< Minimum value 1350 float maxVal //!< Maximum value 1351 1351 ); 1352 1352 \end{verbatim} … … 1369 1369 /** A matrix */ 1370 1370 typedef struct { 1371 int xSize, ySize; //!< Dimensions in x and y1372 float *restrict *restrict value; //!< Values in matrix1371 int xSize, ySize; //!< Dimensions in x and y 1372 float *restrict *restrict value; //!< Values in matrix 1373 1373 } psMatrix; 1374 1374 \end{verbatim} … … 1379 1379 /** Constructor */ 1380 1380 psMatrix * 1381 psMatrixAlloc(int Xdimen, //!< x dimension of new matrix1382 int Ydimen//!< y dimension of new matrix1383 );1381 psMatrixAlloc(int Xdimen, //!< x dimension of new matrix 1382 int Ydimen //!< y dimension of new matrix 1383 ); 1384 1384 \end{verbatim} 1385 1385 … … 1387 1387 /** Destructor */ 1388 1388 void 1389 psMatrixFree(psMatrix *restrict myMatrix //!< Matrix to destroy1390 );1389 psMatrixFree(psMatrix *restrict myMatrix //!< Matrix to destroy 1390 ); 1391 1391 \end{verbatim} 1392 1392 … … 1404 1404 /** Invert matrix. Not using restrict, to allow inversion to be done in-place */ 1405 1405 psMatrix * 1406 psMatrixInvert(psMatrix *out, //!< Matrix to return, or NULL1407 const psMatrix *myMatrix, //!< Matrix to be inverted1408 float *restrict determinant //!< Determinant to return, or NULL1406 psMatrixInvert(psMatrix *out, //!< Matrix to return, or NULL 1407 const psMatrix *myMatrix, //!< Matrix to be inverted 1408 float *restrict determinant //!< Determinant to return, or NULL 1409 1409 ); 1410 1410 \end{verbatim} … … 1414 1414 float 1415 1415 psMatrixDeterminant(const psMatrix *restrict myMatrix //!< Matrix to get determinant for 1416 );1416 ); 1417 1417 \end{verbatim} 1418 1418 … … 1420 1420 /** Matrix operations */ 1421 1421 psMatrix * 1422 psMatrixOp(psMatrix *out, //!< Matrix to return, or NULL1423 const psMatrix *matrix1,//!< Matrix 11424 const char *op,//!< Operation to perform1425 const psMatrix *matrix2//!< Matrix 21426 );1422 psMatrixOp(psMatrix *out, //!< Matrix to return, or NULL 1423 const psMatrix *matrix1, //!< Matrix 1 1424 const char *op, //!< Operation to perform 1425 const psMatrix *matrix2 //!< Matrix 2 1426 ); 1427 1427 \end{verbatim} 1428 1428 … … 1430 1430 /** Transpose Matrix */ 1431 1431 psMatrix * 1432 psMatrixTranspose(psMatrix *out, //!< Matrix to return, or NULL1433 const psMatrix *myMatrix //!< Matrix to transpose1434 );1432 psMatrixTranspose(psMatrix *out, //!< Matrix to return, or NULL 1433 const psMatrix *myMatrix //!< Matrix to transpose 1434 ); 1435 1435 \end{verbatim} 1436 1436 … … 1438 1438 /** Convert matrix to vector. Intended for a 1-d matrix. */ 1439 1439 psVector * 1440 psMatrixToVector(psMatrix *myMatrix //!< Matrix to convert1440 psMatrixToVector(psMatrix *myMatrix //!< Matrix to convert 1441 1441 ); 1442 1442 \end{verbatim} … … 1458 1458 /** Return Fourier Transform of an array */ 1459 1459 psComplexArray * 1460 psRealFFT(psComplexArray *restrict out, //!< Output array to be returned; may be NULL1461 const psFloatArray *restrict myArray //!< Input array1462 );1460 psRealFFT(psComplexArray *restrict out, //!< Output array to be returned; may be NULL 1461 const psFloatArray *restrict myArray //!< Input array 1462 ); 1463 1463 \end{verbatim} 1464 1464 … … 1467 1467 psComplexArray * 1468 1468 psComplexFFT(psComplexArray *restrict out, //!< Output array to be returned; may be NULL 1469 const psComplexArray *restrict myArray, //!< Input array1470 int sign//!< +1 or -1 to indicate direction of FT1471 );1469 const psComplexArray *restrict myArray, //!< Input array 1470 int sign //!< +1 or -1 to indicate direction of FT 1471 ); 1472 1472 \end{verbatim} 1473 1473 … … 1475 1475 /** Return Power spectrum of a array */ 1476 1476 psFloatArray * 1477 psPowerSpec(psFloatArray *restrict out, //!< Output array to be returned1478 const psFloatArray *restrict myArray //!< Input array1479 );1477 psPowerSpec(psFloatArray *restrict out, //!< Output array to be returned 1478 const psFloatArray *restrict myArray //!< Input array 1479 ); 1480 1480 \end{verbatim} 1481 1481 … … 1491 1491 is not a Gaussian deviate. The evaluated Gaussian is: \f[ exp(-\frac{(x-mean)^2}{2\sigma^2}) \f] */ 1492 1492 float 1493 psGaussian(float x, //!< Value at which to evaluate1494 float mean,//!< Mean for the Gaussian1495 float stddev//!< Standard deviation for the Gaussian1496 );1493 psGaussian(float x, //!< Value at which to evaluate 1494 float mean, //!< Mean for the Gaussian 1495 float stddev //!< Standard deviation for the Gaussian 1496 ); 1497 1497 \end{verbatim} 1498 1498 … … 1509 1509 /** One-dimensional polynomial */ 1510 1510 typedef struct { 1511 int n; //!< Number of terms1512 float *restrict coeff; //!< Coefficients1513 float *restrict coeffErr; //!< Error in coefficients1514 char *restrict mask; //!< Coefficient mask1511 int n; //!< Number of terms 1512 float *restrict coeff; //!< Coefficients 1513 float *restrict coeffErr; //!< Error in coefficients 1514 char *restrict mask; //!< Coefficient mask 1515 1515 } psPolynomial1D; 1516 1516 \end{verbatim} … … 1519 1519 /** Two-dimensional polynomial */ 1520 1520 typedef struct { 1521 int nX, nY; //!< Number of terms in x and y1522 float *restrict *restrict coeff; //!< Coefficients1523 float *restrict *restrict coeffErr; //!< Error in coefficients1524 char *restrict *restrict mask; //!< Coefficients mask1521 int nX, nY; //!< Number of terms in x and y 1522 float *restrict *restrict coeff; //!< Coefficients 1523 float *restrict *restrict coeffErr; //!< Error in coefficients 1524 char *restrict *restrict mask; //!< Coefficients mask 1525 1525 } psPolynomial2D; 1526 1526 \end{verbatim} … … 1531 1531 /** Double-precision one-dimensional polynomial */ 1532 1532 typedef struct { 1533 int n; //!< Number of terms1534 double *restrict coeff; //!< Coefficients1535 double *restrict coeffErr; //!< Error in coefficients1536 char *restrict mask; //!< Coefficient mask1533 int n; //!< Number of terms 1534 double *restrict coeff; //!< Coefficients 1535 double *restrict coeffErr; //!< Error in coefficients 1536 char *restrict mask; //!< Coefficient mask 1537 1537 } psDPolynomial1D; 1538 1538 \end{verbatim} … … 1541 1541 /** Double-precision two-dimensional polynomial */ 1542 1542 typedef struct { 1543 int nX, nY; //!< Number of terms in x and y1544 double *restrict *restrict coeff; //!< Coefficients1543 int nX, nY; //!< Number of terms in x and y 1544 double *restrict *restrict coeff; //!< Coefficients 1545 1545 double *restrict *restrict coeffErr; //!< Error in coefficients 1546 char *restrict *restrict mask; //!< Coefficients mask1546 char *restrict *restrict mask; //!< Coefficients mask 1547 1547 } psDPolynomial2D; 1548 1548 \end{verbatim} … … 1565 1565 /** Evaluate 2D polynomial (double precision) */ 1566 1566 double 1567 psEvalDPolynomial2D(double x, //!< Value x at which to evaluate1568 double y,//!< Value y at which to evaluate1569 const psDPolynomial2D *restrict myPoly //!< Coefficients for the polynomial1570 );1567 psEvalDPolynomial2D(double x, //!< Value x at which to evaluate 1568 double y, //!< Value y at which to evaluate 1569 const psDPolynomial2D *restrict myPoly //!< Coefficients for the polynomial 1570 ); 1571 1571 \end{verbatim} 1572 1572 … … 1583 1583 /** Minimize a particular function */ 1584 1584 psFloatArray * 1585 psMinimize(float (*myFunction)(const psFloatArray *restrict), //!< Function to minimize1586 psFloatArray *restrict initialGuess //!< Initial guess1587 );1585 psMinimize(float (*myFunction)(const psFloatArray *restrict), //!< Function to minimize 1586 psFloatArray *restrict initialGuess //!< Initial guess 1587 ); 1588 1588 \end{verbatim} 1589 1589 … … 1592 1592 psFloatArray * 1593 1593 psMinimizeChi2(float (*evalModel)(const psFloatArray *restrict, 1594 const psFloatArray *restrict), //!< Model to fit; receives domain and1595 //!< parameters1596 const psFloatArray *restrict domain, //!< The domain values for the corresponding measurements1597 const psFloatArray *restrict data, //!< Data to fit1598 const psFloatArray *restrict errors, //!< Errors in the data1599 psFloatArray *restrict initialGuess, //!< Initial guess1600 const psIntArray *restrict guessMask //!< 1 = fit for parameter, 0 = hold parameter constant1601 );1594 const psFloatArray *restrict), //!< Model to fit; receives domain and 1595 //!< parameters 1596 const psFloatArray *restrict domain, //!< The domain values for the corresponding measurements 1597 const psFloatArray *restrict data, //!< Data to fit 1598 const psFloatArray *restrict errors, //!< Errors in the data 1599 psFloatArray *restrict initialGuess, //!< Initial guess 1600 const psIntArray *restrict guessMask //!< 1 = fit for parameter, 0 = hold parameter constant 1601 ); 1602 1602 \end{verbatim} 1603 1603 … … 1606 1606 psFloatArray * 1607 1607 psGetArrayPolynomial(const psFloatArray *restrict ord, //!< Ordinates (or NULL to just use the indices) 1608 const psFloatArray *restrict coord //!< Coordinates1608 const psFloatArray *restrict coord //!< Coordinates 1609 1609 ); 1610 1610 \end{verbatim} … … 1707 1707 \begin{verbatim} 1708 1708 void 1709 psImageFree(psImage *restrict image ///< free this image1709 psImageFree(psImage *restrict image ///< free this image 1710 1710 ); 1711 1711 \end{verbatim} … … 2037 2037 definitions do not influence the understanding of this document. 2038 2038 2039 A `` frame'' is a read of the detector.2039 A ``readout'' is a read of the detector. 2040 2040 2041 2041 A ``cell'' is defined as the smallest element of the detector readout; 2042 2042 usually associated with an amplifier. Correspondingly, each cell has 2043 its own overscan region. There may be multiple frames in a cell if2043 its own overscan region. There may be multiple readouts in a cell if 2044 2044 the cell was used to provide fast guiding. 2045 2045 … … 2055 2055 2k$. There would be eight chips, each consisting of two cells, and 2056 2056 the focal plane consists of these eight chips. 2057 2058 As another example, consider an observation by PS1. The focal plane 2059 would consist of 60 chips, each of which consist of 64 cells (or less; 2060 a few cells may be dead). Some cells (those containing guide stars 2061 for the orthogonal transfer) will contain multiple readouts. 2057 2062 2058 2063 \subsubsection{Coordinate frames} … … 2094 2099 well as the pixel data. 2095 2100 2096 \subsubsection{A Frame}2097 2098 A frameis the result of a single read of a cell (or a portion2101 \subsubsection{A Readout} 2102 2103 A readout is the result of a single read of a cell (or a portion 2099 2104 thereof). It contains a pointer to the pixel data, a separate pointer 2100 2105 to the overscan pixels, and additional pointers to the objects found 2101 in the frame, and the framemetadata. It also contains the offset2106 in the readout, and the readout metadata. It also contains the offset 2102 2107 from the lower-left corner of the chip, in the case that the CCD was 2103 2108 windowed. 2104 2109 2105 2110 \begin{verbatim} 2106 /** a Frame: a collection of pixels */2111 /** a Readout: a collection of pixels */ 2107 2112 typedef struct { 2108 int x0, y0; //!< Offset from the lower-left corner2113 int x0, y0; //!< Offset from the lower-left corner 2109 2114 psImage *image; ///< imaging area of cell 2110 psDlist *objects; ///< objects derived from cell2115 psDlist *objects; ///< objects derived from cell 2111 2116 psImage *overscan; ///< bias region (subimage) of cell 2112 psMetaDataSet *md; //!< Frame-level metadata2113 } ps Frame;2117 psMetaDataSet *md; //!< Readout-level metadata 2118 } psReadout; 2114 2119 \end{verbatim} 2115 2120 … … 2117 2122 \subsubsection{A Cell} 2118 2123 2119 A cell consists of one or more frames (usually only one except in the2124 A cell consists of one or more readouts (usually only one except in the 2120 2125 case that the cell has been used for fast guiding). It also contains 2121 2126 a pointer to the cell metadata, and a pointer to its parent chip. On … … 2133 2138 2134 2139 \begin{verbatim} 2135 /** a Cell: a collection of frames.2140 /** a Cell: a collection of readouts. 2136 2141 */ 2137 2142 typedef struct { 2138 int n Frames; ///< number of frames in this cell realization; each may have its own2139 ///< image, objects and overscan.2140 struct ps Frame *frames; //!< Frames from the cell2141 psMetaDataSet *md; ///< Cell-level metadata2142 2143 psCoordXform *cellToChip; ///< Transformations from cell coordinates to chip coordinates2144 psCoordXform *cellToFPA; ///< Transformations from cell coordinates to FPA coordinates2145 psCoordXform *cellToSky; ///< Quick and Dirty transformations from cell coordinates to sky2146 2147 struct psChip *parentChip; ///< chip which contains this cell2143 int nReadouts; ///< number of readouts in this cell realization; each may have its own 2144 ///< image, objects and overscan. 2145 struct psReadout *readouts; //!< Readouts from the cell 2146 psMetaDataSet *md; ///< Cell-level metadata 2147 2148 psCoordXform *cellToChip; ///< Transformations from cell coordinates to chip coordinates 2149 psCoordXform *cellToFPA; ///< Transformations from cell coordinates to FPA coordinates 2150 psCoordXform *cellToSky; ///< Quick and Dirty transformations from cell coordinates to sky 2151 2152 struct psChip *parentChip; ///< chip which contains this cell 2148 2153 } psCell; 2149 2154 \end{verbatim} … … 2169 2174 struct psCell *cells; ///< Cells in the Chip 2170 2175 2171 psMetaDataSet *md; ///< Chip-level metadata2176 psMetaDataSet *md; ///< Chip-level metadata 2172 2177 psCoordXform *chipToFPA; ///< Transformations from chip coordinates to FPA coordinates 2173 2178 2174 struct psFPA *parentFPA; ///< FPA which contains this chip2179 struct psFPA *parentFPA; ///< FPA which contains this chip 2175 2180 } psChip; 2176 2181 \end{verbatim} … … 2202 2207 int nChips; ///< Number of Cells assigned 2203 2208 int nAlloc; ///< Number of Cells available 2204 struct psChip *chips; ///< Chips in the Focal Plane Array2205 2206 psMetaDataSet *md; ///< FPA-level metadata2207 psDistortion *TPtoFP; ///< Transformation term from2208 psDistortion *FPtoTP; ///< Transformation term from2209 psFixedPattern *pattern; //!< Fixed pattern residual offsets2209 struct psChip *chips; ///< Chips in the Focal Plane Array 2210 2211 psMetaDataSet *md; ///< FPA-level metadata 2212 psDistortion *TPtoFP; ///< Transformation term from 2213 psDistortion *FPtoTP; ///< Transformation term from 2214 psFixedPattern *pattern; //!< Fixed pattern residual offsets 2210 2215 psExposure *exp; ///< information about this exposure 2211 2216 psPhotSystem colorPlus, colorMinus; ///< Colour reference … … 2289 2294 /** The fixed pattern residual offsets. These are specified via a coarse grid of x and y offsets. */ 2290 2295 typedef struct { 2291 int nX, nY; //!< Number of elements in x and y2292 double x0, y0; //!< Position of the lower-left corner of the grid on the focal plane2293 double xScale, yScale; //!< Scale of the grid2294 double **x, **y; //!< The grid of offsets in x and y2296 int nX, nY; //!< Number of elements in x and y 2297 double x0, y0; //!< Position of the lower-left corner of the grid on the focal plane 2298 double xScale, yScale; //!< Scale of the grid 2299 double **x, **y; //!< The grid of offsets in x and y 2295 2300 } psFixedPattern; 2296 2301 \end{verbatim} … … 2319 2324 float humidity, //!< Relative humidity 2320 2325 float exptime //!< Exposure time 2321 );2326 ); 2322 2327 \end{verbatim} 2323 2328 … … 2325 2330 \subsubsection{Finding} 2326 2331 2327 We require functions to return the structure containing given coordinates. 2328 For example, we want the chip that corresponds to the focal plane coordinates 2329 $(p,q) = (-1.234,+5.678)$. 2332 We require functions to return the structure containing given 2333 coordinates. For example, we want the chip that corresponds to the 2334 focal plane coordinates $(p,q) = (-1.234,+5.678)$. These routines 2335 handle the one-to-many problem --- i.e., for one given focal plane 2336 coordinate, there are many chips that this coordinate may be 2337 correspond to; these functions will select the correct one. 2330 2338 2331 2339 … … 2333 2341 /** returns Chip in FPA which contains the given FPA coordinate */ 2334 2342 psChip * 2335 psChipInFPA (psFPA *fpa, ///< FPA description2336 psCoord *coord///< coordinate in FPA2337 );2343 psChipInFPA (psFPA *fpa, ///< FPA description 2344 psCoord *coord ///< coordinate in FPA 2345 ); 2338 2346 \end{verbatim} 2339 2347 … … 2341 2349 /** returns Cell in Chip which contains the given chip coordinate */ 2342 2350 psCell * 2343 psCellInChip (psChip *chip, ///< chip description2344 psCoord *coord///< coordinate in chip2345 );2351 psCellInChip (psChip *chip, ///< chip description 2352 psCoord *coord ///< coordinate in chip 2353 ); 2346 2354 \end{verbatim} 2347 2355 … … 2353 2361 /** Return the cell in FPA which contains the given FPA coordinates */ 2354 2362 psCell * 2355 psCellInFPA(psCell *out, //!< Cell to return, or NULL2356 psFPA *fpa,//!< FPA description2357 psCoord *coord//!< Coordinate in FPA2358 );2363 psCellInFPA(psCell *out, //!< Cell to return, or NULL 2364 psFPA *fpa, //!< FPA description 2365 psCoord *coord //!< Coordinate in FPA 2366 ); 2359 2367 \end{verbatim} 2360 2368 … … 2392 2400 /** returns Chip in FPA which contains the given FPA coordinate */ 2393 2401 psChip * 2394 psChipInFPA (psChip *out, //!< Chip to return, or NULL2395 psFPA *fpa,///< FPA description2396 psCoord *coord///< coordinate in FPA2397 );2402 psChipInFPA (psChip *out, //!< Chip to return, or NULL 2403 psFPA *fpa, ///< FPA description 2404 psCoord *coord ///< coordinate in FPA 2405 ); 2398 2406 \end{verbatim} 2399 2407 … … 2401 2409 /** returns Cell in Chip which contains the given chip coordinate */ 2402 2410 psCell * 2403 psCellInChip(psCell *out, //!< Cell to return, or NULL2404 psChip *chip,///< chip description2405 psCoord *coord///< coordinate in chip2406 );2411 psCellInChip(psCell *out, //!< Cell to return, or NULL 2412 psChip *chip, ///< chip description 2413 psCoord *coord ///< coordinate in chip 2414 ); 2407 2415 \end{verbatim} 2408 2416 … … 2410 2418 /** Return the cell in FPA which contains the given FPA coordinates */ 2411 2419 psCell * 2412 psCellInFPA(psCell *out, //!< Cell to return, or NULL2413 psFPA *fpa,//!< FPA description2414 psCoord *coord//!< Coordinate in FPA2415 );2420 psCellInFPA(psCell *out, //!< Cell to return, or NULL 2421 psFPA *fpa, //!< FPA description 2422 psCoord *coord //!< Coordinate in FPA 2423 ); 2416 2424 \end{verbatim} 2417 2425 … … 2419 2427 /** Convert (RA,Dec) to cell and cell coordinates */ 2420 2428 psCoord * 2421 psCoordSkyToCell(psCoord *out, //!< Coordinates to return, or NULL2422 psCell *cell,//!< Cell to return2423 const psFPA *fpa//!< FPA description2424 );2429 psCoordSkyToCell(psCoord *out, //!< Coordinates to return, or NULL 2430 psCell *cell, //!< Cell to return 2431 const psFPA *fpa //!< FPA description 2432 ); 2425 2433 \end{verbatim} 2426 2434 … … 2428 2436 /** Convert cell and cell coordinate to (RA,Dec) */ 2429 2437 psCoord * 2430 psCoordCellToSky(psCoord *out, //!< Coordinates to return, or NULL2431 const psCell *cell,//!< Cell to get coordinates for2432 psCoord *coord//!< cell coordinates to transform2433 );2438 psCoordCellToSky(psCoord *out, //!< Coordinates to return, or NULL 2439 const psCell *cell, //!< Cell to get coordinates for 2440 psCoord *coord //!< cell coordinates to transform 2441 ); 2434 2442 \end{verbatim} 2435 2443 … … 2437 2445 /** Quick and dirty cell to (RA,Dec) --- employs cellToSky transformation */ 2438 2446 psCoord * 2439 psCoordCellToSkyQuick(psCoord *out, //!< Coordinates to return, or NULL2440 const psCell *cell, //!< Cell description2441 psCoord *coord//!< cell coordinates to transform2442 );2447 psCoordCellToSkyQuick(psCoord *out, //!< Coordinates to return, or NULL 2448 const psCell *cell, //!< Cell description 2449 psCoord *coord //!< cell coordinates to transform 2450 ); 2443 2451 \end{verbatim} 2444 2452 … … 2446 2454 /** Convert (RA,Dec) to tangent plane coords */ 2447 2455 psCoord * 2448 psCoordSkyToTP(psCoord *out, //!< Coordinates to return, or NULL2449 psexposure *exp,//!< Exposure description2450 psCoord *coord//!< input Sky coordinate2451 );2456 psCoordSkyToTP(psCoord *out, //!< Coordinates to return, or NULL 2457 psexposure *exp, //!< Exposure description 2458 psCoord *coord //!< input Sky coordinate 2459 ); 2452 2460 \end{verbatim} 2453 2461 … … 2455 2463 /** Convert tangent plane coords to focal plane coordinates */ 2456 2464 psCoord * 2457 psCoordTPtoFPA(psCoord *out, //!< Coordinates to return, or NULL2458 const psFPA *fpa,//!< FPA description2459 psCoord *coord//!< input TP coordinate2460 );2465 psCoordTPtoFPA(psCoord *out, //!< Coordinates to return, or NULL 2466 const psFPA *fpa, //!< FPA description 2467 psCoord *coord //!< input TP coordinate 2468 ); 2461 2469 \end{verbatim} 2462 2470 … … 2464 2472 /** converts the specified FPA coord to the coord on the given Chip */ 2465 2473 psCoord * 2466 psCoordFPAtoChip (psCoord *out, //!< Coordinates to return, or NULL2467 psFPA *fpa,///< FPA description2468 psChip *chip,///< Chip of interest2469 psCoord *coord///< input FPA coordinate2470 );2474 psCoordFPAtoChip (psCoord *out, //!< Coordinates to return, or NULL 2475 psFPA *fpa, ///< FPA description 2476 psChip *chip, ///< Chip of interest 2477 psCoord *coord ///< input FPA coordinate 2478 ); 2471 2479 \end{verbatim} 2472 2480 … … 2474 2482 /** converts the specified Chip coord to the coord on the given Cell */ 2475 2483 psCoord * 2476 psCoordChiptoCell (psCoord *out, //!< Coordinates to return, or NULL2477 psChip *chip,///< Chip description2478 psCell *cell,///< Cell of interest2479 psCoord *coord///< input Chip coordinate2480 );2484 psCoordChiptoCell (psCoord *out, //!< Coordinates to return, or NULL 2485 psChip *chip, ///< Chip description 2486 psCell *cell, ///< Cell of interest 2487 psCoord *coord ///< input Chip coordinate 2488 ); 2481 2489 \end{verbatim} 2482 2490 … … 2484 2492 /** converts the specified Cell coord to the coord on the parent Chip */ 2485 2493 psCoord * 2486 psCoordCelltoChip (psCoord *out, //!< Coordinates to return, or NULL2487 psCell *cell,///< Cell description2488 psCoord *coord///< input Cell coordinate2489 );2494 psCoordCelltoChip (psCoord *out, //!< Coordinates to return, or NULL 2495 psCell *cell, ///< Cell description 2496 psCoord *coord ///< input Cell coordinate 2497 ); 2490 2498 \end{verbatim} 2491 2499 … … 2493 2501 /** converts the specified Chip coord to the coord on the parent FPA */ 2494 2502 psCoord * 2495 psCoordChiptoFPA (psCoord *out, //!< Coordinates to return, or NULL2496 psChip *chip,///< Chip description2497 psCoord *coord///< input Chip coordinate2498 );2503 psCoordChiptoFPA (psCoord *out, //!< Coordinates to return, or NULL 2504 psChip *chip, ///< Chip description 2505 psCoord *coord ///< input Chip coordinate 2506 ); 2499 2507 \end{verbatim} 2500 2508 … … 2502 2510 /** Convert focal plane coords to tangent plane coordinates */ 2503 2511 psCoord * 2504 psCoordFPAToTP(psCoord *out, //!< Coordinates to return, or NULL2505 psFPA *fpa,//!< FPA description2506 psCoord *coord//!< input FPA coordinate2507 );2512 psCoordFPAToTP(psCoord *out, //!< Coordinates to return, or NULL 2513 psFPA *fpa, //!< FPA description 2514 psCoord *coord //!< input FPA coordinate 2515 ); 2508 2516 \end{verbatim} 2509 2517 … … 2511 2519 /** Convert tangent plane coords to (RA,Dec) */ 2512 2520 psCoord * 2513 psCoordTPtoSky(psCoord *out, //!< Coordinates to return, or NULL2514 psExposure *exp,//!< Exposure description2515 psCoord *coord//!< input TP coordinate2516 );2521 psCoordTPtoSky(psCoord *out, //!< Coordinates to return, or NULL 2522 psExposure *exp, //!< Exposure description 2523 psCoord *coord //!< input TP coordinate 2524 ); 2517 2525 \end{verbatim} 2518 2526 … … 2520 2528 /** Convert Cell coords to FPA coordinates */ 2521 2529 psCoord * 2522 psCoordCellToFPA(psCoord *out, //!< Coordinates to return, or NULL2523 psCell *cell,//!< Cell description2524 psCoord *coord//!< Input cell coordinates2525 );2530 psCoordCellToFPA(psCoord *out, //!< Coordinates to return, or NULL 2531 psCell *cell, //!< Cell description 2532 psCoord *coord //!< Input cell coordinates 2533 ); 2526 2534 \end{verbatim} 2527 2535 … … 2536 2544 /** Get the airmass for a given position and sidereal time */ 2537 2545 float 2538 psGetAirmass(const psCoord *coord, //!< Position on the sky2539 double siderealTime, //!< Sidereal time2540 float height//!< Height above sea level2546 psGetAirmass(const psCoord *coord, //!< Position on the sky 2547 double siderealTime, //!< Sidereal time 2548 float height //!< Height above sea level 2541 2549 ); 2542 2550 \end{verbatim} … … 2545 2553 /** Get the parallactic angle for a given position and sidereal time */ 2546 2554 float 2547 psGetParallactic(const psCoord *coord, //!< Position on the sky2555 psGetParallactic(const psCoord *coord, //!< Position on the sky 2548 2556 double siderealTime //!< Sidereal time 2549 2557 ); … … 2554 2562 float 2555 2563 psGetRefraction(float colour, //!< Colour of object 2556 psPhotSystem colorPlus, ///< Colour reference 2557 psPhotSystem colorMinus, ///< Colour reference 2558 const psExposure *exp //!< Telescope pointing information, for airmass, temp and pressure 2559 ); 2560 \end{verbatim} 2561 2564 psPhotSystem colorPlus, ///< Colour reference 2565 psPhotSystem colorMinus, ///< Colour reference 2566 const psExposure *exp //!< Telescope pointing information, for airmass, temp and pressure 2567 ); 2568 \end{verbatim} 2569 2570 \begin{verbatim} 2571 /** Calculate the parallax factor */ 2572 double 2573 psGetParallaxFactor(const psExposure *exp //!< Exposure details 2574 ); 2575 \end{verbatim} 2562 2576 2563 2577 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% … … 2649 2663 \begin{verbatim} 2650 2664 typedef struct { 2651 psDlist *list; // list of psMetaDataItem2652 psHash *table; // hash table of the same metadata2665 psDlist *list; // list of psMetaDataItem 2666 psHash *table; // hash table of the same metadata 2653 2667 } psMetaDataSet; 2654 2668 \end{verbatim} … … 2732 2746 \begin{verbatim} 2733 2747 psMetaDataItem *psMetaDataItemAlloc( 2734 psMetaDataType type, // type of this piece of metadata2735 const void *val, // value of new item2736 // N.b. a pointer even if the item2737 // is of type e.g. int2738 const char *comment, // comment associated with item2739 const char *name, // name of new item of metadata (may be an sprintf format)2740 ...); // possible arguments for name format2748 psMetaDataType type, // type of this piece of metadata 2749 const void *val, // value of new item 2750 // N.b. a pointer even if the item 2751 // is of type e.g. int 2752 const char *comment, // comment associated with item 2753 const char *name, // name of new item of metadata (may be an sprintf format) 2754 ...); // possible arguments for name format 2741 2755 2742 2756 void psMetaDataItemFree(psMetaDataItem *ms); // piece of metadata to destroy 2743 2757 2744 psMetaDataSet *psMetaDataSetAlloc(void); // make a new set of metadata2758 psMetaDataSet *psMetaDataSetAlloc(void); // make a new set of metadata 2745 2759 void psMetaDataSetDel(psMetaDataSet *ms); // destroy a set of metadata 2746 2760 … … 2756 2770 psMetaDataItem *psMetaDataLookup(const psMetaDataSet *ms, const char *key); 2757 2771 2758 void psMetaDataItemPrint(FILE *fd, // file descriptor to write to2759 const psMetaDataItem *ms); // item of metadata to print2772 void psMetaDataItemPrint(FILE *fd, // file descriptor to write to 2773 const psMetaDataItem *ms); // item of metadata to print 2760 2774 \end{verbatim} 2761 2775 … … 2772 2786 typedef union { 2773 2787 struct { 2774 double x;//!< x position2775 double y;//!< y position2776 double xErr;//!< Error in x position2777 double yErr;//!< Error in y position2788 double x; //!< x position 2789 double y; //!< y position 2790 double xErr; //!< Error in x position 2791 double yErr; //!< Error in y position 2778 2792 } xy; 2779 2793 struct { 2780 double r;//!< RA2781 double d;//!< Dec2782 double rErr;//!< Error in RA2783 double dErr;//!< Error in Dec2794 double r; //!< RA 2795 double d; //!< Dec 2796 double rErr; //!< Error in RA 2797 double dErr; //!< Error in Dec 2784 2798 } rd; 2785 2799 } psCoord; … … 2821 2835 /** apply the coordinate transformation to the given coordinate */ 2822 2836 psCoord *psCoordXformApply (psCoordXform *frame, ///< coordinate transformation 2823 psCoord *coords) ///< input coordiate2837 psCoord *coords) ///< input coordiate 2824 2838 ; 2825 2839 \end{verbatim} … … 2828 2842 /** apply the optical distortion to the given coordinate, magnitude, color */ 2829 2843 psCoord *psDistortionApply (psDistortion *pattern, ///< optical distortion pattern 2830 psCoord *coords, ///< input coordinate2831 float mag, ///< magnitude of object2832 float color) ///< color of object2844 psCoord *coords, ///< input coordinate 2845 float mag, ///< magnitude of object 2846 float color) ///< color of object 2833 2847 ; 2834 2848 \end{verbatim} … … 2844 2858 psCoord * 2845 2859 psGetOffset(const psCoord *restrict position1, //!< Position 1 2846 const psCoord *restrict position2, //!< Position 22847 const char *type//!< Type of offset: Linear, Spherical/Arcsec, Spherical/Degreees etc2860 const psCoord *restrict position2, //!< Position 2 2861 const char *type //!< Type of offset: Linear, Spherical/Arcsec, Spherical/Degreees etc 2848 2862 ); 2849 2863 \end{verbatim} … … 2853 2867 psCoord * 2854 2868 psApplyOffset(const psCoord *restrict position, //!< Position 2855 const psCoord *restrict offset, //!< Offset2856 const char *type//!< Type of offset: Linear, Spherical/Arcsec, Spherical/Degreees etc2869 const psCoord *restrict offset, //!< Offset 2870 const char *type //!< Type of offset: Linear, Spherical/Arcsec, Spherical/Degreees etc 2857 2871 ); 2858 2872 \end{verbatim} … … 2867 2881 /** Get Sun Position */ 2868 2882 psCoord * 2869 psGetSunPos(float mjd) //!< MJD to get position for2883 psGetSunPos(float mjd) //!< MJD to get position for 2870 2884 ; 2871 2885 \end{verbatim} … … 2874 2888 /** Get Moon position */ 2875 2889 psCoord * 2876 psGetMoonPos(float mjd, //!< MJD to get position for2877 double latitude,//!< Latitude for apparent position2878 double longitude)//!< Longitude for apparent position2890 psGetMoonPos(float mjd, //!< MJD to get position for 2891 double latitude, //!< Latitude for apparent position 2892 double longitude) //!< Longitude for apparent position 2879 2893 ; 2880 2894 \end{verbatim} … … 2883 2897 /** Get Moon phase */ 2884 2898 float 2885 psGetMoonPhase(float mjd) //!< MJD to get phase for2899 psGetMoonPhase(float mjd) //!< MJD to get phase for 2886 2900 ; 2887 2901 \end{verbatim} … … 2891 2905 psCoord * 2892 2906 psGetSolarSystemPos(char *solarSystemObject, //!< Named S.S. object 2893 float mjd)//!< MJD to get position for2907 float mjd) //!< MJD to get position for 2894 2908 ; 2895 2909 \end{verbatim} … … 2955 2969 \begin{verbatim} 2956 2970 typedef struct { 2957 int ID; //!< ID number for this photometric system2958 char *name; //!< Name of photometric system2959 char *camera; //!< Camera for photometric system2960 char *filter; //!< Filter used for photometric system2961 char *detector; //!< Detector used for photometric system2971 int ID; //!< ID number for this photometric system 2972 char *name; //!< Name of photometric system 2973 char *camera; //!< Camera for photometric system 2974 char *filter; //!< Filter used for photometric system 2975 char *detector; //!< Detector used for photometric system 2962 2976 } psPhotSystem; 2963 2977 \end{verbatim} … … 2967 2981 \begin{verbatim} 2968 2982 typedef struct { 2969 psPhotSystem src; //!< Source photometric system2970 psPhotSystem dst; //!< Destination photometric system2971 psPhotSystem pP, pM; ///< Primary colour reference2972 psPhotSystem sP, sM; ///< Secondary colour reference2973 float pA, sA; ///< Colour offset for primary and secondary references2974 psPolynomial3D transform; //!< Transformation from source to destination2983 psPhotSystem src; //!< Source photometric system 2984 psPhotSystem dst; //!< Destination photometric system 2985 psPhotSystem pP, pM; ///< Primary colour reference 2986 psPhotSystem sP, sM; ///< Secondary colour reference 2987 float pA, sA; ///< Colour offset for primary and secondary references 2988 psPolynomial3D transform; //!< Transformation from source to destination 2975 2989 } psPhotTransform; 2976 2990 \end{verbatim}
Note:
See TracChangeset
for help on using the changeset viewer.
