IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 26, 2009, 1:59:32 PM (17 years ago)
Author:
beaumont
Message:

merged with trunk

Location:
branches/cnb_branches/cnb_branch_20090301
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090301

  • branches/cnb_branches/cnb_branch_20090301/ppMerge/src

    • Property svn:ignore
      •  

        old new  
        77stamp-h1
        88.libs
         9ppMergeVersionDefinitions.h
  • branches/cnb_branches/cnb_branch_20090301/ppMerge/src/ppMergeLoop.c

    r23594 r24244  
    3636    bool mdok;                          ///< Status of MD lookup
    3737    bool haveMasks = psMetadataLookupBool(&mdok, arguments, "INPUTS.MASKS"); // Do we have masks?
     38    bool useMasks = psMetadataLookupBool(&mdok, arguments, "INPUTS.MASKS.USE"); // Do we have masks?
    3839    bool haveVariances = psMetadataLookupBool(&mdok, arguments, "INPUTS.VARIANCES"); // Do we have variances?
    3940
     
    7374
    7475    pmCombineParams *combination = pmCombineParamsAlloc(combineStat); ///< Combination parameters
    75     combination->maskVal = maskVal;
     76    combination->maskVal = useMasks ? maskVal : 0;
    7677    combination->blank = pmConfigMaskGet("BLANK", config);
    7778    combination->nKeep = nKeep;
     
    149150        }
    150151        pmCell *outCell;                ///< Cell of interest
     152
     153        // XXX TEST : force a single loop
     154        // outCell = pmFPAviewNextCell(view, outFPA, 1); {
     155
    151156        while ((outCell = pmFPAviewNextCell(view, outFPA, 1))) {
    152157            if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
     
    164169                pmHDU *hdu = pmHDUGetHighest(outFPA, outChip, outCell); // HDU for file
    165170                if (hdu && hdu != lastHDU) {
     171                    if (!hdu->header) {
     172                        hdu->header = psMetadataAlloc();
     173                    }
    166174                    ppMergeVersionHeader(hdu->header);
    167175                    lastHDU = hdu;
     
    229237                psAssert (fileGroups->n > 0, "no valid file groups defined");
    230238                fileGroup = fileGroups->data[0];
    231                 if (!pmShutterCorrectionGeneratePrepare(outRO, pattern, fileGroup->readouts, maskVal)) {
     239                if (!pmShutterCorrectionGeneratePrepare(outRO, pattern, fileGroup->readouts, combination->maskVal)) {
    232240                    goto ERROR;
    233241                }
     
    411419            }
    412420
    413             // calculate CTEMASK after stats so stats reflect median image
     421            // calculate CTEMASK after stats so stats reflect median image
    414422            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);
    434443                }
     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
    435462            }
    436463
Note: See TracChangeset for help on using the changeset viewer.