Changeset 27400 for trunk/ppStack/src/ppStackCombineFinal.c
- Timestamp:
- Mar 22, 2010, 8:34:28 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ppStack/src/ppStackCombineFinal.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStackCombineFinal.c
r27319 r27400 14 14 //#define TESTING // Enable test output 15 15 16 bool ppStackCombineFinal(p mReadout *target, ppStackThreadData *stack, psArray *covariances,17 p pStackOptions *options, pmConfig *config, bool safe, bool normalise, bool grow)16 bool ppStackCombineFinal(ppStackThreadData *stack, psArray *covariances, ppStackOptions *options, 17 pmConfig *config, bool safe, bool normalise, bool grow) 18 18 { 19 19 psAssert(stack, "Require stack"); … … 21 21 psAssert(config, "Require configuration"); 22 22 23 int numCols = target->image->numCols, numRows = target->image->numRows; // Size of image 23 pmReadout *outRO = options->outRO; // Output readout 24 pmReadout *expRO = options->expRO; // Exposure readout 25 int numCols = outRO->image->numCols, numRows = outRO->image->numRows; // Size of image 24 26 25 27 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSTACK_RECIPE); // ppStack recipe … … 43 45 } 44 46 45 if (!target->mask) { 46 target->mask = psImageAlloc(target->image->numCols, target->image->numRows, PS_TYPE_IMAGE_MASK); 47 if (!outRO->mask) { 48 outRO->mask = psImageAlloc(numCols, numRows, PS_TYPE_IMAGE_MASK); 49 } 50 if (!expRO->mask) { 51 expRO->mask = psImageAlloc(numCols, numRows, PS_TYPE_IMAGE_MASK); 47 52 } 48 53 … … 62 67 } 63 68 64 // call: ppStackReadoutFinal(config, target, readouts, rejected)69 // call: ppStackReadoutFinal(config, outRO, readouts, rejected) 65 70 psThreadJob *job = psThreadJobAlloc("PPSTACK_FINAL_COMBINE"); // Job to start 66 psArrayAdd(job->args, 1, target);67 71 psArrayAdd(job->args, 1, thread); 68 72 psArrayAdd(job->args, 1, reject); … … 105 109 } 106 110 if (sumWeights > 0.0) { 107 target->covariance = psImageCovarianceSum(covariances);108 psBinaryOp( target->covariance->image, target->covariance->image, "/",111 outRO->covariance = psImageCovarianceSum(covariances); 112 psBinaryOp(outRO->covariance->image, outRO->covariance->image, "/", 109 113 psScalarAlloc(sumWeights, PS_TYPE_F32)); 110 psImageCovarianceTransfer( target->variance, target->covariance);114 psImageCovarianceTransfer(outRO->variance, outRO->covariance); 111 115 } 112 116 } else { 113 target->covariance = psImageCovarianceNone();117 outRO->covariance = psImageCovarianceNone(); 114 118 } 115 119 … … 127 131 wcsDone = true; 128 132 pmHDU *inHDU = pmHDUFromCell(inRO->parent); // Template HDU 129 pmHDU *outHDU = pmHDUFromCell( target->parent); // Output HDU130 pmChip *outChip = target->parent->parent; // Output chip133 pmHDU *outHDU = pmHDUFromCell(outRO->parent); // Output HDU 134 pmChip *outChip = outRO->parent->parent; // Output chip 131 135 pmFPA *outFPA = outChip->parent; // Output FPA 132 136 if (!outHDU || !inHDU) { … … 151 155 } 152 156 157 // Set exposure time correctly 158 { 159 float exptime = 0.0; // Summed exposure time 160 for (int i = 0; i < options->num; i++) { 161 if (options->inputMask) { 162 continue; 163 } 164 exptime += options->exposures->data.F32[i]; 165 } 166 167 { 168 psMetadataItem *item = psMetadataLookup(outRO->parent->concepts, "CELL.EXPOSURE"); 169 item->data.F32 = exptime; 170 } 171 { 172 psMetadataItem *item = psMetadataLookup(outRO->parent->parent->parent->concepts, "FPA.EXPOSURE"); 173 item->data.F32 = exptime; 174 } 175 } 176 153 177 // Put version information into the header 154 pmHDU *hdu = pmHDUFromCell( target->parent);178 pmHDU *hdu = pmHDUFromCell(outRO->parent); 155 179 if (!hdu) { 156 180 psError(PPSTACK_ERR_PROG, false, "Unable to find HDU for output."); … … 168 192 psStringAppend(&name, "combined_image_final_%d.fits", pass); 169 193 pass++; 170 ppStackWriteImage(name, NULL, target->image, config);194 ppStackWriteImage(name, NULL, outRO->image, config); 171 195 psStringSubstitute(&name, "mask", "image"); 172 ppStackWriteImage(name, NULL, target->mask, config);196 ppStackWriteImage(name, NULL, outRO->mask, config); 173 197 psStringSubstitute(&name, "variance", "mask"); 174 ppStackWriteImage(name, NULL, target->variance, config);198 ppStackWriteImage(name, NULL, outRO->variance, config); 175 199 psFree(name); 176 200 177 pmStackVisualPlotTestImage( target->image, "combined_image_final.fits");201 pmStackVisualPlotTestImage(outRO->image, "combined_image_final.fits"); 178 202 #endif 179 203
Note:
See TracChangeset
for help on using the changeset viewer.
