- Timestamp:
- May 26, 2009, 1:59:32 PM (17 years ago)
- Location:
- branches/cnb_branches/cnb_branch_20090301
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ppMerge/src (modified) (1 prop)
-
ppMerge/src/ppMergeLoop.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090301
- Property svn:mergeinfo changed
-
branches/cnb_branches/cnb_branch_20090301/ppMerge/src
- Property svn:ignore
-
old new 7 7 stamp-h1 8 8 .libs 9 ppMergeVersionDefinitions.h
-
- Property svn:ignore
-
branches/cnb_branches/cnb_branch_20090301/ppMerge/src/ppMergeLoop.c
r23594 r24244 36 36 bool mdok; ///< Status of MD lookup 37 37 bool haveMasks = psMetadataLookupBool(&mdok, arguments, "INPUTS.MASKS"); // Do we have masks? 38 bool useMasks = psMetadataLookupBool(&mdok, arguments, "INPUTS.MASKS.USE"); // Do we have masks? 38 39 bool haveVariances = psMetadataLookupBool(&mdok, arguments, "INPUTS.VARIANCES"); // Do we have variances? 39 40 … … 73 74 74 75 pmCombineParams *combination = pmCombineParamsAlloc(combineStat); ///< Combination parameters 75 combination->maskVal = maskVal;76 combination->maskVal = useMasks ? maskVal : 0; 76 77 combination->blank = pmConfigMaskGet("BLANK", config); 77 78 combination->nKeep = nKeep; … … 149 150 } 150 151 pmCell *outCell; ///< Cell of interest 152 153 // XXX TEST : force a single loop 154 // outCell = pmFPAviewNextCell(view, outFPA, 1); { 155 151 156 while ((outCell = pmFPAviewNextCell(view, outFPA, 1))) { 152 157 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { … … 164 169 pmHDU *hdu = pmHDUGetHighest(outFPA, outChip, outCell); // HDU for file 165 170 if (hdu && hdu != lastHDU) { 171 if (!hdu->header) { 172 hdu->header = psMetadataAlloc(); 173 } 166 174 ppMergeVersionHeader(hdu->header); 167 175 lastHDU = hdu; … … 229 237 psAssert (fileGroups->n > 0, "no valid file groups defined"); 230 238 fileGroup = fileGroups->data[0]; 231 if (!pmShutterCorrectionGeneratePrepare(outRO, pattern, fileGroup->readouts, maskVal)) {239 if (!pmShutterCorrectionGeneratePrepare(outRO, pattern, fileGroup->readouts, combination->maskVal)) { 232 240 goto ERROR; 233 241 } … … 411 419 } 412 420 413 // calculate CTEMASK after stats so stats reflect median image421 // calculate CTEMASK after stats so stats reflect median image 414 422 if (type == PPMERGE_TYPE_CTEMASK && outRO) { 415 // need to apply range cuts on the output image 416 psAssert (outRO->mask, "mask is not defined"); 417 psAssert (outRO->mask->numCols == outRO->image->numCols, "mismatch between image and mask"); 418 psAssert (outRO->mask->numRows == outRO->image->numRows, "mismatch between image and mask"); 419 420 // CTEMASK parameters 421 float cteMin = psMetadataLookupF32(NULL, arguments, "CTE.MIN"); // Number of fringe points 422 423 char *cteMaskName = psMetadataLookupStr (&mdok, config->arguments, "MASK.SET.VALUE"); 424 psImageMaskType cteMaskValue = pmConfigMaskGet(cteMaskName, config); 425 426 psF32 **outputImage = outRO->image->data.F32; 427 psImageMaskType **outputMask = outRO->mask->data.PS_TYPE_IMAGE_MASK_DATA; 428 for (int iy = 0; iy < outRO->image->numRows; iy++) { 429 for (int ix = 0; ix < outRO->image->numCols; ix++) { 430 if (outputImage[iy][ix] < cteMin) { 431 outputMask[iy][ix] |= cteMaskValue; 432 } 433 } 423 // need to apply range cuts on the output image 424 psAssert (outRO->mask, "mask is not defined"); 425 psAssert (outRO->mask->numCols == outRO->image->numCols, "mismatch between image and mask"); 426 psAssert (outRO->mask->numRows == outRO->image->numRows, "mismatch between image and mask"); 427 428 // CTEMASK parameters 429 float cteMin = psMetadataLookupF32(NULL, arguments, "CTE.MIN"); // Number of fringe points 430 431 char *cteMaskName = psMetadataLookupStr (&mdok, config->arguments, "MASK.SET.VALUE"); 432 psImageMaskType cteMaskValue = pmConfigMaskGet(cteMaskName, config); 433 434 if (0) { 435 psFits *fits = NULL; 436 fits = psFitsOpen ("combine.fits", "w"); 437 psFitsWriteImage (fits, NULL, outRO->image, 0, NULL); 438 psFitsClose (fits); 439 440 fits = psFitsOpen ("inmask.fits", "w"); 441 psFitsWriteImage (fits, NULL, outRO->mask, 0, NULL); 442 psFitsClose (fits); 434 443 } 444 445 psF32 **outputImage = outRO->image->data.F32; 446 psImageMaskType **outputMask = outRO->mask->data.PS_TYPE_IMAGE_MASK_DATA; 447 for (int iy = 0; iy < outRO->image->numRows; iy++) { 448 for (int ix = 0; ix < outRO->image->numCols; ix++) { 449 if (outputImage[iy][ix] < cteMin) { 450 outputMask[iy][ix] |= cteMaskValue; 451 } 452 } 453 } 454 455 if (0) { 456 psFits *fits = NULL; 457 fits = psFitsOpen ("otmask.fits", "w"); 458 psFitsWriteImage (fits, NULL, outRO->mask, 0, NULL); 459 psFitsClose (fits); 460 } 461 435 462 } 436 463
Note:
See TracChangeset
for help on using the changeset viewer.
