Changeset 16842 for trunk/ppMerge/src/ppMergeCombine.c
- Timestamp:
- Mar 6, 2008, 10:49:03 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ppMerge/src/ppMergeCombine.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppMerge/src/ppMergeCombine.c
r16229 r16842 16 16 #include "ppMergeVersion.h" 17 17 18 #define TESTING 19 20 18 21 #if 0 19 static psMemId memId = 0;20 21 22 static FILE *dumpFile = NULL; 22 23 … … 36 37 exit(EXIT_FAILURE); 37 38 } 38 39 39 #endif 40 41 #if 0 42 static psMemId memId = 0; 40 43 static void memDump(void) 41 44 { … … 52 55 psFree(leaks); 53 56 } 54 57 #endif 58 59 #if 0 55 60 static void memCheck(void) 56 61 { … … 73 78 psTrace("ppMerge", 0, "Memory in use: %zd\n", totalSize); 74 79 psTrace("ppMerge", 0, "Largest block: %ld\n", largest); 75 psTrace("ppMerge", 0, "sbrk(): % zd\n", sbrk(0));80 psTrace("ppMerge", 0, "sbrk(): %p\n", sbrk(0)); 76 81 } 77 82 return; … … 119 124 } 120 125 while ((chip = pmFPAviewNextChip(view, fpa, 1))) { 121 if (chip->hdu) { 122 // Data will exist soon 123 pmFPAUpdateNames(data->out, chip, NULL); 124 chip->data_exists = true; 125 } 126 if (!chip->hdu) { 127 continue; 128 } 129 // Data will exist soon 130 pmFPAUpdateNames(data->out, chip, NULL); 131 chip->data_exists = true; 126 132 pmChipWrite(chip, data->outFile, config->database, true, false); // Write header only 127 133 pmCell *cell; // Cell of interest 128 134 while ((cell = pmFPAviewNextCell(view, fpa, 1))) { 129 135 cellNum++; 130 if (cell->hdu) { 131 // Data will exist soon 132 pmFPAUpdateNames(data->out, chip, cell); 133 chip->data_exists = cell->data_exists = true; 134 } 136 if (!cell->hdu) { 137 continue; 138 } 139 // Data will exist soon 140 pmFPAUpdateNames(data->out, chip, cell); 141 chip->data_exists = cell->data_exists = true; 135 142 pmCellWrite(cell, data->outFile, config->database, true); // Write header only 136 143 pmReadout *readout = pmReadoutAlloc(cell); // Output readout of interest … … 197 204 198 205 // If we're combining with weights, we want to generate weights. 199 if (options->combine->weights ) {206 if (options->combine->weights && !options->dark) { 200 207 201 208 // If it's a bias or dark, set the gain to zero: noise only contributed by read 202 if ( (!options->zero && !options->scale) || options->darktime) {209 if (!options->zero && !options->scale) { 203 210 pmReadoutSetWeight(stack->data[i], false); 204 211 } else { … … 209 216 numRead++; 210 217 } else { 211 psTrace("ppMerge", 3, "Finished reading file %d, chip %d, cell %d, scan %d\n", i, view->chip, view->cell, numScan); 218 psTrace("ppMerge", 3, "Finished reading file %d, chip %d, cell %d, scan %d\n", 219 i, view->chip, view->cell, numScan); 212 220 } 213 221 … … 220 228 options->shutterIter, options->shutterRej, 221 229 options->combine->maskVal); 230 } else if (options->dark) { 231 pmDarkCombine(cell, stack, options->darkOrdinates, options->combine->iter, 232 options->combine->rej, options->combine->maskVal); 222 233 } else { 223 234 pmReadoutCombine(readout, stack, cellZeros, cellScales, options->combine); … … 246 257 psFree(stack); 247 258 259 #if 0 248 260 // Set the dark time for the output image, since we normalised 249 261 if (options->darktime) { … … 253 265 expItem->data.F32 = 1.0; 254 266 } 267 #endif 255 268 256 269 // Measure the fringes for this cell … … 334 347 if (cell->hdu && !cell->hdu->blankPHU) { 335 348 psTrace("ppMerge", 5, "Writing out cell HDU.\n"); 336 pmCellWrite(cell, data->outFile, config->database, false); 337 if (options->fringe) { 338 pmCellWriteTable(data->outFile, cell, "FRINGE"); 339 } 340 349 if (options->dark) { 350 pmCellWriteDark(cell, data->outFile, config->database, false); 351 } else { 352 pmCellWrite(cell, data->outFile, config->database, false); 353 if (options->fringe) { 354 pmCellWriteTable(data->outFile, cell, "FRINGE"); 355 } 356 } 341 357 pmCellFreeData(cell); 342 358 } … … 354 370 if (chip->hdu && !chip->hdu->blankPHU) { 355 371 psTrace("ppMerge", 5, "Writing out chip HDU.\n"); 356 pmChipWrite(chip, data->outFile, config->database, false, false); 357 if (options->fringe) { 358 pmChipWriteTable(data->outFile, chip, "FRINGE"); 372 if (options->dark) { 373 pmChipWriteDark(chip, data->outFile, config->database, false, false); 374 } else { 375 pmChipWrite(chip, data->outFile, config->database, false, false); 376 if (options->fringe) { 377 pmChipWriteTable(data->outFile, chip, "FRINGE"); 378 } 359 379 } 360 380 … … 373 393 // Write the pixels 374 394 psTrace("ppMerge", 5, "Writing out FPA HDU.\n"); 375 pmFPAWrite(data->out, data->outFile, config->database, false, false); 376 if (options->fringe) { 377 pmFPAWriteTable(data->outFile, fpa, "FRINGE"); 395 if (options->dark) { 396 pmFPAWriteDark(data->out, data->outFile, config->database, false, false); 397 } else { 398 pmFPAWrite(data->out, data->outFile, config->database, false, false); 399 if (options->fringe) { 400 pmFPAWriteTable(data->outFile, fpa, "FRINGE"); 401 } 378 402 } 379 403 }
Note:
See TracChangeset
for help on using the changeset viewer.
