IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20497


Ignore:
Timestamp:
Oct 31, 2008, 5:00:04 PM (18 years ago)
Author:
Paul Price
Message:

Adding relative systematic error for combination when rejecting.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippconfig/recipes/ppStack.config

    r20490 r20497  
    33ITER            S32     1               # Number of rejection iterations
    44COMBINE.REJ     F32     3.0             # Rejection threshold in combination (sigma)
     5COMBINE.SYS     F32     0.08            # Relative systematic error in combination
    56MASK.VAL        STR     MASK.VALUE,BAD.WARP     # Mask value of input bad pixels
    67MASK.BAD        STR     BLANK           # Mask value to give bad pixels
  • trunk/ppStack/src/ppStackArguments.c

    r20494 r20497  
    145145    psMetadataAddF32(arguments, PS_LIST_TAIL, "-combine-rej", 0,
    146146                     "Combination rejection thresold (sigma)", NAN);
     147    psMetadataAddF32(arguments, PS_LIST_TAIL, "-combine-sys", 0,
     148                     "Relative systematic error in combination", NAN);
    147149    psMetadataAddStr(arguments, PS_LIST_TAIL, "-mask-val", 0, "Mask value of input bad pixels", NULL);
    148150    psMetadataAddStr(arguments, PS_LIST_TAIL, "-mask-bad", 0, "Mask value to give bad pixels", NULL);
     
    226228    VALUE_ARG_RECIPE_INT("-iter",             "ITER",           S32, 0);
    227229    VALUE_ARG_RECIPE_FLOAT("-combine-rej",    "COMBINE.REJ",    F32);
     230    VALUE_ARG_RECIPE_FLOAT("-combine-sys",    "COMBINE.SYS",    F32);
    228231    VALUE_ARG_RECIPE_FLOAT("-threshold-mask", "THRESHOLD.MASK", F32);
    229232    VALUE_ARG_RECIPE_FLOAT("-image-rej",      "IMAGE.REJ",      F32);
  • trunk/ppStack/src/ppStackReadout.c

    r19532 r20497  
    9696    int iter = psMetadataLookupS32(NULL, recipe, "ITER"); // Rejection iterations
    9797    float combineRej = psMetadataLookupF32(NULL, recipe, "COMBINE.REJ"); // Combination threshold
     98    float combineSys = psMetadataLookupF32(NULL, recipe, "COMBINE.SYS"); // Combination systematic error
    9899    bool useVariance = psMetadataLookupBool(&mdok, recipe, "VARIANCE"); // Use variance for rejection?
    99100    bool safe = psMetadataLookupBool(&mdok, recipe, "SAFE"); // Be safe when combining small numbers of pixels
     
    133134    }
    134135
    135     if (!pmStackCombine(outRO, stack, maskVal | maskBad, maskBad, kernelSize, iter, combineRej, true,
    136                         useVariance, safe)) {
     136    if (!pmStackCombine(outRO, stack, maskVal | maskBad, maskBad, kernelSize, iter, combineRej, combineSys,
     137                        true, useVariance, safe)) {
    137138        psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts with rejection.");
    138139        psFree(stack);
  • trunk/psModules/src/imcombine/pmStack.c

    r20487 r20497  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2008-10-31 21:50:59 $
     10 *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2008-11-01 02:59:33 $
    1212 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
    1313 *
     
    219219                          int numIter, // Number of rejection iterations
    220220                          float rej, // Number of standard deviations at which to reject
     221                          float sys,    // Relative systematic error
    221222                          bool useVariance, // Use variance for rejection when combining?
    222223                          bool safe,    // Combine safely?
     
    311312          if (useVariance && numIter > 0) {
    312313              // Use variance to check that the two are consistent
    313               float diff = pixelData->data.F32[0] - pixelData->data.F32[1];
     314              float diff = 0.5 * (pixelData->data.F32[0] - pixelData->data.F32[1]); // Mean flux difference
     315              float var1 = pixelVariances->data.F32[0]; // Variance of first
     316              float var2 = pixelVariances->data.F32[1]; // Variance of second
    314317#ifdef VARIANCE_FACTORS
    315               float sigma2 = pixelVariances->data.F32[0] * varFactors->data.F32[pixelSources->data.U16[0]] +
    316                   pixelVariances->data.F32[1] * varFactors->data.F32[pixelSources->data.U16[1]];
    317 #else
    318               float sigma2 = pixelVariances->data.F32[0] + pixelVariances->data.F32[1];
     318              // Variance factor contributes to the rejection level
     319              var1 *= varFactors->data.F32[pixelSources->data.U16[0]];
     320              var2 *= varFactors->data.F32[pixelSources->data.U16[1]];
    319321#endif
     322              // Systematic error contributes to the rejection level
     323              var1 += PS_SQR(sys * pixelData->data.F32[0]);
     324              var2 += PS_SQR(sys * pixelData->data.F32[1]);
     325
     326              float sigma2 = var1 + var2; //
    320327              if (PS_SQR(diff) > PS_SQR(rej) * sigma2) {
    321328                  // Not consistent: mark both for inspection
     
    346353                  float rej2 = PS_SQR(rej); // Rejection level squared
    347354                  for (int i = 0; i < num; i++) {
     355                      pixelVariances->data.F32[i] *= rej2;
    348356#ifdef VARIANCE_FACTORS
    349                       pixelVariances->data.F32[i] *= rej2 * varFactors->data.F32[pixelSources->data.U16[i]];
    350 #else
    351                       pixelVariances->data.F32[i] *= rej2;
     357                      // Variance factor contributes to the rejection level
     358                      pixelVariances->data.F32[i] *= varFactors->data.F32[pixelSources->data.U16[i]];
    352359#endif
     360                      // Systematic error contributes to the rejection level
     361                      pixelVariances->data.F32[i] += PS_SQR(sys * pixelData->data.F32[i]);
    353362                  }
    354363              }
     
    554563/// Stack input images
    555564bool pmStackCombine(pmReadout *combined, psArray *input, psMaskType maskVal, psMaskType bad,
    556                     int kernelSize, int numIter, float rej, bool entire, bool useVariance, bool safe)
     565                    int kernelSize, int numIter, float rej, float sys,
     566                    bool entire, bool useVariance, bool safe)
    557567{
    558568    PS_ASSERT_PTR_NON_NULL(combined, false);
     
    660670                                                     x, y); // Reject these images
    661671                    combinePixels(combinedImage, combinedMask, combinedVariance, input, weights, varFactors,
    662                                   reject, x, y, maskVal, bad, numIter, rej, useVariance, safe, buffer);
     672                                  reject, x, y, maskVal, bad, numIter, rej, sys, useVariance, safe, buffer);
    663673                }
    664674            }
     
    674684                                                 x, y); // Reject these images
    675685                combinePixels(combinedImage, combinedMask, combinedVariance, input, weights, varFactors,
    676                               reject, x, y, maskVal, bad, numIter, rej, useVariance, safe, buffer);
     686                              reject, x, y, maskVal, bad, numIter, rej, sys, useVariance, safe, buffer);
    677687            }
    678688        }
     
    701711            for (int x = minInputCols; x < maxInputCols; x++) {
    702712                combinePixels(combinedImage, combinedMask, combinedVariance, input, weights, varFactors,
    703                               NULL, x, y, maskVal, bad, numIter, rej, useVariance, safe, buffer);
     713                              NULL, x, y, maskVal, bad, numIter, rej, sys, useVariance, safe, buffer);
    704714            }
    705715        }
  • trunk/psModules/src/imcombine/pmStack.h

    r19532 r20497  
    88 * @author GLG, MHPCC
    99 *
    10  * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    11  * @date $Date: 2008-09-12 04:12:42 $
     10 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     11 * @date $Date: 2008-11-01 02:59:33 $
    1212 *
    1313 * Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    4848                    int numIter,        ///< Number of iterations
    4949                    float rej,          ///< Rejection limit (standard deviations)
     50                    float sys,          ///< Relative systematic error
    5051                    bool entire,        ///< Combine entire image even if rejection lists provided?
    5152                    bool useVariance,   ///< Use variance values for rejection?
Note: See TracChangeset for help on using the changeset viewer.