Changeset 27427 for trunk/ppStack/src/ppStackCombineFinal.c
- Timestamp:
- Mar 23, 2010, 9:02:41 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ppStack/src/ppStackCombineFinal.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStackCombineFinal.c
r27403 r27427 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 … … 46 48 } 47 49 48 if (!target->mask) { 49 target->mask = psImageAlloc(target->image->numCols, target->image->numRows, PS_TYPE_IMAGE_MASK); 50 if (!outRO->mask) { 51 outRO->mask = psImageAlloc(numCols, numRows, PS_TYPE_IMAGE_MASK); 52 } 53 if (!expRO->mask) { 54 expRO->mask = psImageAlloc(numCols, numRows, PS_TYPE_IMAGE_MASK); 50 55 } 51 56 … … 65 70 } 66 71 67 // call: ppStackReadoutFinal(config, target, readouts, rejected)72 // call: ppStackReadoutFinal(config, outRO, readouts, rejected) 68 73 psThreadJob *job = psThreadJobAlloc("PPSTACK_FINAL_COMBINE"); // Job to start 69 psArrayAdd(job->args, 1, target);70 74 psArrayAdd(job->args, 1, thread); 71 75 psArrayAdd(job->args, 1, reject); … … 108 112 } 109 113 if (sumWeights > 0.0) { 110 target->covariance = psImageCovarianceSum(covariances);111 psBinaryOp( target->covariance->image, target->covariance->image, "/",114 outRO->covariance = psImageCovarianceSum(covariances); 115 psBinaryOp(outRO->covariance->image, outRO->covariance->image, "/", 112 116 psScalarAlloc(sumWeights, PS_TYPE_F32)); 113 psImageCovarianceTransfer( target->variance, target->covariance);117 psImageCovarianceTransfer(outRO->variance, outRO->covariance); 114 118 } 115 119 } else { 116 target->covariance = psImageCovarianceNone();120 outRO->covariance = psImageCovarianceNone(); 117 121 } 118 122 … … 130 134 wcsDone = true; 131 135 pmHDU *inHDU = pmHDUFromCell(inRO->parent); // Template HDU 132 pmHDU *outHDU = pmHDUFromCell( target->parent); // Output HDU133 pmChip *outChip = target->parent->parent; // Output chip136 pmHDU *outHDU = pmHDUFromCell(outRO->parent); // Output HDU 137 pmChip *outChip = outRO->parent->parent; // Output chip 134 138 pmFPA *outFPA = outChip->parent; // Output FPA 135 139 if (!outHDU || !inHDU) { … … 154 158 } 155 159 160 // Set exposure time correctly 161 { 162 float exptime = 0.0; // Summed exposure time 163 for (int i = 0; i < options->num; i++) { 164 if (options->inputMask) { 165 continue; 166 } 167 exptime += options->exposures->data.F32[i]; 168 } 169 170 { 171 psMetadataItem *item = psMetadataLookup(outRO->parent->concepts, "CELL.EXPOSURE"); 172 item->data.F32 = exptime; 173 } 174 { 175 psMetadataItem *item = psMetadataLookup(outRO->parent->parent->parent->concepts, "FPA.EXPOSURE"); 176 item->data.F32 = exptime; 177 } 178 } 179 156 180 // Put version information into the header 157 pmHDU *hdu = pmHDUFromCell( target->parent);181 pmHDU *hdu = pmHDUFromCell(outRO->parent); 158 182 if (!hdu) { 159 183 psError(PPSTACK_ERR_PROG, false, "Unable to find HDU for output."); … … 171 195 psStringAppend(&name, "combined_image_final_%d.fits", pass); 172 196 pass++; 173 ppStackWriteImage(name, NULL, target->image, config);197 ppStackWriteImage(name, NULL, outRO->image, config); 174 198 psStringSubstitute(&name, "mask", "image"); 175 ppStackWriteImage(name, NULL, target->mask, config);199 ppStackWriteImage(name, NULL, outRO->mask, config); 176 200 psStringSubstitute(&name, "variance", "mask"); 177 ppStackWriteImage(name, NULL, target->variance, config);201 ppStackWriteImage(name, NULL, outRO->variance, config); 178 202 psFree(name); 179 203 180 pmStackVisualPlotTestImage( target->image, "combined_image_final.fits");204 pmStackVisualPlotTestImage(outRO->image, "combined_image_final.fits"); 181 205 #endif 182 206
Note:
See TracChangeset
for help on using the changeset viewer.
