IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14282


Ignore:
Timestamp:
Jul 17, 2007, 5:54:01 PM (19 years ago)
Author:
Paul Price
Message:

Use median as an estimator of the mean for rejection.

File:
1 edited

Legend:

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

    r14277 r14282  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2007-07-18 02:16:46 $
     10 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2007-07-18 03:54:01 $
    1212 *
    1313 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    114114// Generate a standard deviation for the combination
    115115// Not using psVectorStats because it has additional allocations which slow things down
    116 static bool combinationStdev(float *stdev, // Mean value, to return
     116static bool combinationStdev(float *median, // Median value, to return
     117                             float *stdev, // Standard deviation value, to return
    117118                             const psVector *values, // Values to combine
    118119                             const psVector *masks, // Mask to apply
     
    137138        return false;
    138139    }
     140    *median = num % 2 ? (sortBuffer->data.F32[num / 2] + sortBuffer->data.F32[num / 2 + 1]) / 2.0 :
     141        sortBuffer->data.F32[num / 2];
    139142    *stdev = 0.74 * (sortBuffer->data.F32[(int)(0.75 * num)] - sortBuffer->data.F32[(int)(0.25 * num)]);
    140143
     
    269272    psMaskType ignore = maskVal | bad;  // Ignore values with this mask value
    270273    for (int i = 0; i < numIter && numClipped > 0; i++) {
    271         float stdev;                    // Standard deviation of the combination, for rejection
     274        float median, stdev;                    // Median and stdev of the combination, for rejection
    272275        // Only get the mean if it's not the first iteration (because we got the mean earlier)
    273         if ((i != 0 && !combinationMean(&mean, pixelData, weights, pixelMasks, maskVal)) ||
    274             !combinationStdev(&stdev, pixelData, pixelMasks, maskVal, sort)) {
     276        if (!combinationStdev(&median, &stdev, pixelData, pixelMasks, maskVal, sort)) {
    275277            image->data.F32[y][x] = NAN;
    276278            mask->data.PS_TYPE_MASK_DATA[y][x] = bad;
     
    285287                continue;
    286288            }
    287             float diff = pixelData->data.F32[j] - mean;
     289            float diff = pixelData->data.F32[j] - median;
    288290            if (fabsf(diff) > limit) {
    289291                // Add the pixel as one to inspect
Note: See TracChangeset for help on using the changeset viewer.