Changeset 9907
- Timestamp:
- Nov 7, 2006, 5:34:39 PM (20 years ago)
- Location:
- trunk/ppMerge/src
- Files:
-
- 2 edited
-
ppMergeCombine.c (modified) (6 diffs)
-
ppMergeScaleZero.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppMerge/src/ppMergeCombine.c
r9832 r9907 78 78 #endif 79 79 80 // Write fringe extensions 81 static void writeFringes(psMetadata *fringes, // Table of extensions with fringe statistics to write 82 psFits *fits // FITS file to which to write 83 ) 84 { 85 assert(fringes); 86 87 // Write the fringe extensions 88 psMetadataIterator *fringesIter = psMetadataIteratorAlloc(fringes, PS_LIST_HEAD, false); // Iterator 89 psMetadataItem *fringeItem; // Item from iteration 90 while ((fringeItem = psMetadataGetAndIncrement(fringesIter))) { 91 const char *extname = fringeItem->name; // Extension name 92 psArray *fringe = fringeItem->data.V; // Fringe data (array of fringe components) 93 if (!pmFringesWriteFits(fits, NULL, fringe, extname)) { 94 psWarning("Unable to write fringe data to extension %s\n", extname); 95 } 96 } 97 98 // Clear the list 99 while (psListLength(fringes->list) > 0) { 100 psMetadataRemoveIndex(fringes, PS_LIST_TAIL); 101 } 102 103 return; 104 } 105 106 80 107 // Combine the inputs 81 108 bool ppMergeCombine(psImage *scales, // Scales for each cell of each integration, or NULL … … 101 128 // Iterate over the FPA 102 129 pmFPA *fpa = data->out; // Output FPA 130 psMetadata *fringeExtns = psMetadataAlloc(); // List of fringe extensions to write 103 131 pmFPAview *view = pmFPAviewAlloc(0);// View of FPA, for iteration 104 132 int cellNum = -1; // Cell number in the whole FPA … … 296 324 psStringAppend(&extname, "FRINGE_%s_%s", chipName, cellName); 297 325 298 if (!pmFringesWriteFits(data->outFile, NULL, fringes, extname)) { 299 psWarning("Unable to write fringe data to extension %s\n", extname); 300 } 301 326 psMetadataAdd(fringeExtns, PS_LIST_TAIL, extname, PS_DATA_UNKNOWN, 327 "Fringe data to write", fringes); 302 328 psFree(fringes); 303 329 psFree(extname); … … 329 355 pmCellWrite(cell, data->outFile, config->database, false); 330 356 pmCellFreeData(cell); 357 358 if (options->fringe) { 359 writeFringes(fringeExtns, data->outFile); 360 } 331 361 } 332 362 } … … 344 374 pmChipWrite(chip, data->outFile, config->database, false, false); 345 375 pmChipFreeData(chip); 376 377 if (options->fringe) { 378 writeFringes(fringeExtns, data->outFile); 379 } 346 380 } 347 381 } … … 357 391 pmFPA *fpaIn = data->in->data[i]; // Input FPA 358 392 pmFPAFreeData(fpaIn); 393 394 if (options->fringe) { 395 writeFringes(fringeExtns, data->outFile); 396 } 359 397 } 360 398 pmFPAFreeData(data->out); -
trunk/ppMerge/src/ppMergeScaleZero.c
r9824 r9907 11 11 #include "ppMerge.h" 12 12 #include "ppMergeScaleZero.h" 13 14 // Extract a particular statistic from the stats15 static inline double getStat(const psStats *stats, // Statistics structure16 psStatsOptions option // Statistic option to return17 )18 {19 switch (option) {20 case PS_STAT_SAMPLE_MEAN:21 return stats->sampleMean;22 case PS_STAT_SAMPLE_MEDIAN:23 return stats->sampleMedian;24 case PS_STAT_ROBUST_MEDIAN:25 return stats->robustMedian;26 case PS_STAT_FITTED_MEAN:27 return stats->fittedMean;28 case PS_STAT_CLIPPED_MEAN:29 return stats->clippedMean;30 default:31 psAbort(__func__, "Invalid statistics option: %x\n", option);32 }33 return NAN; // Token return34 }35 36 13 37 14 // Get the scale and zero for each chip of each input … … 262 239 psFree(sample); 263 240 psFree(sampleMask); 264 background->data.F32[i][cellNum] = getStat(bgStats, options->mean);241 background->data.F32[i][cellNum] = psStatsGetValue(bgStats, options->mean); 265 242 psTrace("ppMerge", 3, "Background for %s, cell %d is %f\n", name, cellNum, 266 243 background->data.F32[i][cellNum]);
Note:
See TracChangeset
for help on using the changeset viewer.
