Changeset 21244 for trunk/ppMerge/src/ppMergeCamera.c
- Timestamp:
- Feb 1, 2009, 11:43:05 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/ppMerge/src/ppMergeCamera.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppMerge/src/ppMergeCamera.c
r18967 r21244 1 /** @file ppMergeCamera.c 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #include "ppMerge.h" 2 14 3 // Define an output file, with its own FPA 4 bool outputFile(pmConfig *config, // Configuration 5 const char *name, // Name of output file 6 pmFPAfileType type, // Type of file 7 const char *description, // Description of file 8 psMetadata *format, // Camera format 9 pmFPAview *view // View for PHU 15 /** 16 * Define an output file, with its own FPA 17 */ 18 bool outputFile(pmConfig *config, ///< Configuration 19 const char *name, ///< Name of output file 20 pmFPAfileType type, ///< Type of file 21 const char *description, ///< Description of file 22 psMetadata *format, ///< Camera format 23 pmFPAview *view ///< View for PHU 10 24 ) 11 25 { … … 15 29 16 30 // Output image 17 pmFPA *fpa = pmFPAConstruct(config->camera, config->cameraName); // FPA to contain the output31 pmFPA *fpa = pmFPAConstruct(config->camera, config->cameraName); ///< FPA to contain the output 18 32 if (!fpa) { 19 33 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to construct an FPA from camera configuration."); … … 84 98 bool haveWeights = false; // Do we have weight maps? 85 99 86 ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); // Type of frame87 psMetadata *inputs = psMetadataLookupMetadata(NULL, config->arguments, "INPUTS"); // The inputs info88 psMetadataIterator *iter = psMetadataIteratorAlloc(inputs, PS_LIST_HEAD, NULL); // Iterator89 psMetadataItem *item; // Item from iteration90 int numFiles = 0; // Number of files100 ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); ///< Type of frame 101 psMetadata *inputs = psMetadataLookupMetadata(NULL, config->arguments, "INPUTS"); ///< The inputs info 102 psMetadataIterator *iter = psMetadataIteratorAlloc(inputs, PS_LIST_HEAD, NULL); ///< Iterator 103 psMetadataItem *item; ///< Item from iteration 104 int numFiles = 0; ///< Number of files 91 105 while ((item = psMetadataGetAndIncrement(iter))) { 92 106 if (item->type != PS_DATA_METADATA) { … … 97 111 } 98 112 99 psMetadata *input = item->data.md; // The input metadata of interest100 101 psString image = psMetadataLookupStr(NULL, input, "IMAGE"); // Name of image113 psMetadata *input = item->data.md; ///< The input metadata of interest 114 115 psString image = psMetadataLookupStr(NULL, input, "IMAGE"); ///< Name of image 102 116 if (!image || strlen(image) == 0) { 103 117 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Component %s lacks IMAGE of type STR", item->name); … … 107 121 108 122 bool mdok; 109 psString mask = psMetadataLookupStr(&mdok, input, "MASK"); // Name of mask110 psString weight = psMetadataLookupStr(&mdok, input, "WEIGHT"); // Name of weight map123 psString mask = psMetadataLookupStr(&mdok, input, "MASK"); ///< Name of mask 124 psString weight = psMetadataLookupStr(&mdok, input, "WEIGHT"); ///< Name of weight map 111 125 112 126 // Add the image file 113 psArray *imageFiles = psArrayAlloc(1); // Array of filenames for this FPA127 psArray *imageFiles = psArrayAlloc(1); ///< Array of filenames for this FPA 114 128 imageFiles->data[0] = psMemIncrRefCounter(image); 115 129 psMetadataAddArray(config->arguments, PS_LIST_TAIL, "IMAGE.FILENAMES", PS_META_REPLACE, … … 130 144 // Optionally add the mask file 131 145 if (mask && strlen(mask) > 0) { 132 psArray *maskFiles = psArrayAlloc(1); // Array of filenames for this FPA146 psArray *maskFiles = psArrayAlloc(1); ///< Array of filenames for this FPA 133 147 maskFiles->data[0] = psMemIncrRefCounter(mask); 134 148 psMetadataAddArray(config->arguments, PS_LIST_TAIL, "MASK.FILENAMES", PS_META_REPLACE, … … 153 167 if (weight && strlen(weight) > 0) { 154 168 haveWeights = true; 155 psArray *weightFiles = psArrayAlloc(1); // Array of filenames for this FPA169 psArray *weightFiles = psArrayAlloc(1); ///< Array of filenames for this FPA 156 170 weightFiles->data[0] = psMemIncrRefCounter(weight); 157 171 psMetadataAddArray(config->arguments, PS_LIST_TAIL, "WEIGHT.FILENAMES", PS_META_REPLACE, … … 219 233 } 220 234 221 psMetadata *format = NULL; // Camera format222 pmFPAview *phuView = NULL; // View to PHU235 psMetadata *format = NULL; ///< Camera format 236 pmFPAview *phuView = NULL; ///< View to PHU 223 237 for (int i = 0; i < numFiles; i++) { 224 pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i); // File of interest225 pmFPA *fpa = input->fpa; // FPA of interest238 pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i); ///< File of interest 239 pmFPA *fpa = input->fpa; ///< FPA of interest 226 240 CHECK_LEVEL(fpa->hdu, -1, -1); 227 psArray *chips = fpa->chips; // Array of chips241 psArray *chips = fpa->chips; ///< Array of chips 228 242 for (int j = 0; j < chips->n; j++) { 229 pmChip *chip = chips->data[j]; // Chip of interest243 pmChip *chip = chips->data[j]; ///< Chip of interest 230 244 CHECK_LEVEL(chip->hdu, j, -1); 231 psArray *cells = chip->cells; // Array of cells245 psArray *cells = chip->cells; ///< Array of cells 232 246 for (int k = 0; k < cells->n; k++) { 233 pmCell *cell = cells->data[k]; // Cell of interest247 pmCell *cell = cells->data[k]; ///< Cell of interest 234 248 CHECK_LEVEL(cell->hdu, j, k); 235 249 } … … 245 259 // Otherwise the abundance of metadata in the concepts (esp. for GPC) can overload the memory 246 260 for (int i = 0; i < numFiles; i++) { 247 pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i); // File of interest248 pmFPA *fpa = input->fpa; // FPA of interest249 psArray *chips = fpa->chips; // Array of chips in output261 pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i); ///< File of interest 262 pmFPA *fpa = input->fpa; ///< FPA of interest 263 psArray *chips = fpa->chips; ///< Array of chips in output 250 264 for (int i = 0; i < chips->n; i++) { 251 pmChip *chip = chips->data[i]; // Chip of interest252 psArray *cells = chip->cells; // Array of cells253 int culled = 0; // Number of culled cells265 pmChip *chip = chips->data[i]; ///< Chip of interest 266 psArray *cells = chip->cells; ///< Array of cells 267 int culled = 0; ///< Number of culled cells 254 268 for (int j = 0; j < cells->n; j++) { 255 269 pmCell *cell = cells->data[j]; 256 pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); // HDU for cell270 pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); ///< HDU for cell 257 271 if (!hdu || hdu->blankPHU) { 258 272 cell->data_exists = false; … … 278 292 // Count the cells 279 293 { 280 int numCells = 0; // Number of cells281 pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", 0); // Representative file282 pmFPA *fpa = input->fpa; // FPA for file283 psArray *chips = fpa->chips; // Array of chips294 int numCells = 0; ///< Number of cells 295 pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", 0); ///< Representative file 296 pmFPA *fpa = input->fpa; ///< FPA for file 297 psArray *chips = fpa->chips; ///< Array of chips 284 298 for (int i = 0; i < chips->n; i++) { 285 pmChip *chip = chips->data[i]; // Chip of interest286 psArray *cells = chip->cells; // Array of cells299 pmChip *chip = chips->data[i]; ///< Chip of interest 300 psArray *cells = chip->cells; ///< Array of cells 287 301 for (int j = 0; j < cells->n; j++) { 288 pmCell *cell = cells->data[j]; // Cell of interest289 pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); // HDU that would have data302 pmCell *cell = cells->data[j]; ///< Cell of interest 303 pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); ///< HDU that would have data 290 304 if (hdu && !hdu->blankPHU) { 291 305 numCells++; … … 298 312 } 299 313 300 psString outName = ppMergeOutputFile(config); // Name of output file301 302 pmFPAfileType fileType = PM_FPA_FILE_NONE; // Type of output file314 psString outName = ppMergeOutputFile(config); ///< Name of output file 315 316 pmFPAfileType fileType = PM_FPA_FILE_NONE; ///< Type of output file 303 317 switch (type) { 304 318 case PPMERGE_TYPE_BIAS:
Note:
See TracChangeset
for help on using the changeset viewer.
