Changeset 7260 for trunk/ppMerge/src/ppMergeCombine.c
- Timestamp:
- Jun 1, 2006, 10:16:15 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/ppMerge/src/ppMergeCombine.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppMerge/src/ppMergeCombine.c
r7067 r7260 7 7 #include "ppMergeData.h" 8 8 #include "ppMergeCombine.h" 9 9 10 10 11 // Combine the inputs … … 22 23 // Sanity checks 23 24 assert(!options->scale || scales); 24 assert(!scales || (scales->type.type == PS_TYPE_F 64&&25 assert(!scales || (scales->type.type == PS_TYPE_F32 && 25 26 scales->numCols == data->numCells && 26 27 scales->numRows == filenames->n)); 27 28 assert(!options->zero || zeros); 28 assert(!zeros || (zeros->type.type == PS_TYPE_F 64&&29 assert(!zeros || (zeros->type.type == PS_TYPE_F32 && 29 30 zeros->numCols == data->numCells && 30 31 zeros->numRows == filenames->n)); … … 32 33 // Iterate over the FPA 33 34 int cellNum = -1; // Cell number 34 pmFPAWrite(data->out, data->outFile, config->database, false );35 pmFPAWrite(data->out, data->outFile, config->database, false, false); // Write header only 35 36 psArray *chips = data->out->chips; // Array of output chips 36 37 for (int i = 0; i < chips->n; i++) { … … 39 40 continue; 40 41 } 41 pmChipWrite(chip, data->outFile, config->database, false );42 pmChipWrite(chip, data->outFile, config->database, false, false); // Write header only 42 43 psArray *cells = chip->cells; // Array of output cells 43 44 for (int j = 0; j < cells->n; j++) { … … 47 48 } 48 49 cellNum++; 49 pmCellWrite(cell, data->outFile, config->database, false); 50 pmCellWrite(cell, data->outFile, config->database, false); // Write header only 50 51 pmReadout *readout = pmReadoutAlloc(cell); // Output readout of interest 51 52 psArray *stack = psArrayAlloc(filenames->n); // Stack of readouts to combine 53 stack->n = filenames->n; 52 54 psVector *cellScales = NULL; // Scales for this cell 53 55 if (scales) { … … 59 61 } 60 62 61 bool stillReadingRows = false; // Still reading rows from any of the files? 62 63 int numRead; // Number of inputs read 63 64 do { 65 numRead = 0; 64 66 for (int k = 0; k < filenames->n; k++) { 65 67 if (! filenames->data[k] || strlen(filenames->data[k]) == 0) { … … 82 84 83 85 // Only reading and writing the first readout in each cell (plane 0) 84 stillReadingRows |= pmReadoutReadNext(stack->data[k], fits, 0, options->rows); 86 if (pmReadoutReadNext(stack->data[k], fits, 0, options->rows)) { 87 numRead++; 88 } 85 89 psFitsClose(fits); 86 90 } 87 91 88 pmReadoutCombine(readout, stack, cellZeros, cellScales, options->combine); 89 pmReadoutWriteNext(readout, data->outFile, 0); 92 if (numRead > 0) { 93 pmReadoutCombine(readout, stack, cellZeros, cellScales, options->combine); 94 psTrace(__func__, 5, "Chip %d, cell %d, readout size %dx%d\n", i, j, 95 readout->image->numCols, readout->image->numRows); 96 } 90 97 91 } while (stillReadingRows); 92 93 // Write the pixels 94 pmCellWrite(cell, data->outFile, config->database, true); 98 } while (numRead > 0); 95 99 96 100 // Blow away the cell data … … 101 105 pmCellFreeData(cellIn); 102 106 } 103 pmCellFreeData(cell); 107 108 // Write the pixels 109 if (cell->hdu) { 110 psTrace(__func__, 5, "Writing out cell HDU.\n"); 111 pmCellWrite(cell, data->outFile, config->database, true); 112 pmCellFreeData(cell); 113 } 104 114 } 105 106 // Write the pixels107 pmChipWrite(chip, data->outFile, config->database, true);108 115 109 116 // Blow away the chip data … … 113 120 pmChipFreeData(chipIn); 114 121 } 115 pmChipFreeData(chip);116 122 123 // Write the pixels 124 if (chip->hdu) { 125 psTrace(__func__, 5, "Writing out chip HDU.\n"); 126 pmChipWrite(chip, data->outFile, config->database, true, false); 127 pmChipFreeData(chip); 128 } 117 129 } 118 130 119 // Write the pixels 120 pmFPAWrite(data->out, data->outFile, config->database, true); 131 if (data->out->hdu) { 132 // Write the pixels 133 psTrace(__func__, 5, "Writing out FPA HDU.\n"); 134 pmFPAWrite(data->out, data->outFile, config->database, true, false); 135 } 121 136 122 137 // Blow away the FPA data
Note:
See TracChangeset
for help on using the changeset viewer.
