IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19454


Ignore:
Timestamp:
Sep 10, 2008, 8:17:54 AM (18 years ago)
Author:
Paul Price
Message:

Include variance factors in the variance.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_branch_080908/psModules/src/imcombine/pmStack.c

    r19439 r19454  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.38.2.1 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2008-09-09 20:40:17 $
     10 *  @version $Revision: 1.38.2.2 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2008-09-10 18:17:54 $
    1212 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
    1313 *
     
    265265        pixelData->data.F32[num] = image->data.F32[yIn][xIn];
    266266        if (variance) {
    267             pixelVariances->data.F32[num] = variance->data.F32[yIn][xIn];
     267            pixelVariances->data.F32[num] = variance->data.F32[yIn][xIn] * varFactors->data.F32[i];
    268268        }
    269269        pixelWeights->data.F32[num] = data->weight;
     
    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] * varFactors->data.F32[0] +
    315                   pixelVariances->data.F32[1] * varFactors->data.F32[1];
     314              float sigma2 = pixelVariances->data.F32[0] + pixelVariances->data.F32[1];
    316315              if (PS_SQR(diff) > PS_SQR(rej) * sigma2) {
    317316                  // Not consistent: mark both for inspection
     
    342341                  float rej2 = PS_SQR(rej); // Rejection level squared
    343342                  for (int i = 0; i < num; i++) {
    344                       pixelVariances->data.F32[i] *= rej2 * varFactors->data.F32[i];
     343                      pixelVariances->data.F32[i] *= rej2;
    345344                  }
    346345              }
     
    349348          // The clipping that follows is solely to identify suspect pixels.
    350349          // These suspect pixels will be inspected in more detail by other functions.
    351           int numClipped = INT_MAX;       // Number of pixels clipped per iteration
    352           int totalClipped = 0;           // Total number of pixels clipped
     350          int numClipped = INT_MAX;     // Number of pixels clipped per iteration
     351          int totalClipped = 0;         // Total number of pixels clipped
     352          float rej2 = PS_SQR(rej);     // Rejection level squared
    353353          for (int i = 0; i < numIter && numClipped > 0 && num - totalClipped > 2; i++) {
    354354              numClipped = 0;
     
    361361              }
    362362
    363               float limit = NAN;        // Rejection limit, when rejecting based on data properties
    364               if (!useVariance) {
    365                   limit = rej * stdev;
    366               }
     363              float limit = rej * stdev; // Rejection limit, when rejecting based on data properties
    367364
    368365// Mask a pixel for inspection
     
    380377                  if (useVariance) {
    381378                      // Comparing squares --- cheaper than lots of sqrts
    382                       if (PS_SQR(diff) > pixelVariances->data.F32[j]) {
     379                      if (PS_SQR(diff) > rej2 * pixelVariances->data.F32[j]) {
    383380                          MASK_PIXEL_FOR_INSPECTION();
    384381                      }
Note: See TracChangeset for help on using the changeset viewer.