IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 10, 2008, 5:37:58 PM (18 years ago)
Author:
Paul Price
Message:

Merging in pap_branch_080908. Was originally going to use it for making stamps tolerant of masked pixels, but that's no longer necessary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imcombine/pmStack.c

    r19336 r19482  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2008-09-03 19:42:54 $
     10 *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2008-09-11 03:37:58 $
    1212 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
    1313 *
     
    309309              }
    310310          }
    311           if (useVariance && safe && numIter > 0) {
     311          if (useVariance && numIter > 0) {
    312312              // Use variance to check that the two are consistent
    313313              float diff = pixelData->data.F32[0] - pixelData->data.F32[1];
    314               float sigma2 = pixelVariances->data.F32[0] + pixelVariances->data.F32[1];
     314              float sigma2 = pixelVariances->data.F32[0] * varFactors->data.F32[pixelSources->data.U16[0]] +
     315                  pixelVariances->data.F32[1] * varFactors->data.F32[pixelSources->data.U16[1]];
    315316              if (PS_SQR(diff) > PS_SQR(rej) * sigma2) {
    316317                  // Not consistent: mark both for inspection
     
    341342                  float rej2 = PS_SQR(rej); // Rejection level squared
    342343                  for (int i = 0; i < num; i++) {
    343                       pixelVariances->data.F32[i] *= rej2 * varFactors->data.F32[i];
     344                      pixelVariances->data.F32[i] *= rej2 * varFactors->data.F32[pixelSources->data.U16[i]];
    344345                  }
    345346              }
     
    348349          // The clipping that follows is solely to identify suspect pixels.
    349350          // These suspect pixels will be inspected in more detail by other functions.
    350           int numClipped = INT_MAX;       // Number of pixels clipped per iteration
    351           int totalClipped = 0;           // Total number of pixels clipped
     351          int numClipped = INT_MAX;     // Number of pixels clipped per iteration
     352          int totalClipped = 0;         // Total number of pixels clipped
    352353          for (int i = 0; i < numIter && numClipped > 0 && num - totalClipped > 2; i++) {
    353354              numClipped = 0;
    354355              float median, stdev;    // Median and stdev of the combination, for rejection
    355356
    356               if (!combinationMedianStdev(&median, useVariance ? NULL : &stdev, pixelData, pixelMasks, sort)) {
     357              if (!combinationMedianStdev(&median, useVariance ? NULL : &stdev,
     358                                          pixelData, pixelMasks, sort)) {
    357359                  psWarning("Bad median/stdev at %d,%d", x, y);
    358360                  break;
    359361              }
    360362
    361               float limit = NAN;        // Rejection limit, when rejecting based on data properties
    362               if (!useVariance) {
    363                   limit = rej * stdev;
    364               }
     363              float limit = rej * stdev; // Rejection limit, when rejecting based on data properties
    365364
    366365// Mask a pixel for inspection
     
    378377                  if (useVariance) {
    379378                      // Comparing squares --- cheaper than lots of sqrts
     379                      // pixelVariances includes the variance factor and the rejection limit, from above
    380380                      if (PS_SQR(diff) > pixelVariances->data.F32[j]) {
    381381                          MASK_PIXEL_FOR_INSPECTION();
Note: See TracChangeset for help on using the changeset viewer.