IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 27, 2008, 1:56:41 PM (18 years ago)
Author:
eugene
Message:

accepting updates from HEAD

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080620/psModules/src/imcombine/pmSubtraction.c

    r18190 r18350  
    33 *  @author Paul Price, IfA
    44 *  @author GLG, MHPCC
    5  *
    6  *  @version $Revision: 1.95 $ $Name: not supported by cvs2svn $
    7  *  @date $Date: 2008-06-19 03:03:53 $
    85 *
    96 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    512509    PS_ASSERT_IMAGE_TYPE(subMask, PS_TYPE_MASK, -1);
    513510
    514     double totalSquareDev = 0.0;        // Total square deviation from zero
     511    // I used to measure the rms deviation about zero, and use that as the sigma against which to clip, but
     512    // the distribution is actually something like a chi^2 or Student's t, both of which become Gaussian-like
     513    // with large N.  Therefore, let's just treat this as a Gaussian distribution.
     514
     515    double mean = 0.0;                  // Mean deviation
    515516    int numStamps = 0;                  // Number of used stamps
    516517    for (int i = 0; i < stamps->num; i++) {
     
    519520            continue;
    520521        }
    521         totalSquareDev += PS_SQR(deviations->data.F32[i]);
     522        mean += deviations->data.F32[i];
    522523        numStamps++;
    523524    }
    524 
    525     float rms = sqrt(totalSquareDev / (double)numStamps); // Convert to RMS
     525    mean /= numStamps;
     526
     527    double rms = 0.0;                   // Standard deviation
     528    for (int i = 0; i < stamps->num; i++) {
     529        pmSubtractionStamp *stamp = stamps->stamps->data[i]; // Stamp of interest
     530        if (stamp->status != PM_SUBTRACTION_STAMP_USED) {
     531            continue;
     532        }
     533        rms += PS_SQR(deviations->data.F32[i] - mean);
     534    }
     535    rms = sqrt(rms / (numStamps - 1));
    526536
    527537    if (rmsPtr) {
     
    549559    int numRejected = 0;                // Number of stamps rejected
    550560    int numGood = 0;                    // Number of good stamps
    551     double newSquareDev = 0.0;          // New square deviation
     561    double newMean = 0.0;               // New mean
    552562    for (int i = 0; i < stamps->num; i++) {
    553563        pmSubtractionStamp *stamp = stamps->stamps->data[i]; // Stamp of interest
    554564        if (stamp->status == PM_SUBTRACTION_STAMP_USED) {
    555             if (deviations->data.F32[i] > limit) {
     565            // Should we reject stars with low deviation?  Well, if this is really a Gaussian-like
     566            // distribution and they're low, then we have the right to ask why.  Isn't it suspicious that
     567            // they're anomalously low, compared to the rest of the population which (we hope) is indicative
     568            // of normality?  Besides, the standard deviation is going to be blown up by stars that didn't
     569            // subtract well, in which case very few (if any) stars will be legitimately rejected for being
     570            // low.
     571            if (deviations->data.F32[i] - mean > limit) {
    556572                // Mask out the stamp in the image so you it's not found again
    557573                psTrace("psModules.imcombine", 3, "Rejecting stamp %d (%d,%d)\n", i,
     
    587603            } else {
    588604                numGood++;
    589                 newSquareDev += PS_SQR(deviations->data.F32[i]);
     605                newMean += deviations->data.F32[i];
    590606            }
    591607        }
    592608    }
     609    newMean /= numGood;
    593610
    594611    if (numRejected > 0) {
    595612        psLogMsg("psModules.imcombine", PS_LOG_INFO,
    596                  "%d good stamps; %d rejected.\nRMS deviation: %f --> %f\n",
    597                  numGood, numRejected, rms,
    598                  sqrt(newSquareDev / (double)numGood));
     613                 "%d good stamps; %d rejected.\nMean deviation: %lf --> %lf\n",
     614                 numGood, numRejected, mean, newMean);
    599615    } else {
    600616        psLogMsg("psModules.imcombine", PS_LOG_INFO,
    601                  "%d good stamps; 0 rejected.\nRMS deviation: %f\n",
    602                  numGood, rms);
     617                 "%d good stamps; 0 rejected.\nMean deviation: %lf\n",
     618                 numGood, mean);
    603619    }
    604620
Note: See TracChangeset for help on using the changeset viewer.