IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 20, 2008, 3:27:33 PM (18 years ago)
Author:
Paul Price
Message:

Dual convolution seems to be working. Removed division by 'weight' when generating equation --- seems to bias the fits.

File:
1 edited

Legend:

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

    r18163 r18248  
    44 *  @author GLG, MHPCC
    55 *
    6  *  @version $Revision: 1.94 $ $Name: not supported by cvs2svn $
    7  *  @date $Date: 2008-06-17 22:16:38 $
     6 *  @version $Revision: 1.94.2.1 $ $Name: not supported by cvs2svn $
     7 *  @date $Date: 2008-06-21 01:27:33 $
    88 *
    99 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    512512    PS_ASSERT_IMAGE_TYPE(subMask, PS_TYPE_MASK, -1);
    513513
    514     double totalSquareDev = 0.0;        // Total square deviation from zero
     514    // I used to measure the rms deviation about zero, and use that as the sigma against which to clip, but
     515    // the distribution is actually something like a chi^2 or Student's t, both of which become Gaussian-like
     516    // with large N.  Therefore, let's just treat this as a Gaussian distribution.
     517
     518    double mean = 0.0;                  // Mean deviation
    515519    int numStamps = 0;                  // Number of used stamps
    516520    for (int i = 0; i < stamps->num; i++) {
     
    519523            continue;
    520524        }
    521         totalSquareDev += PS_SQR(deviations->data.F32[i]);
     525        mean += deviations->data.F32[i];
    522526        numStamps++;
    523527    }
    524 
    525     float rms = sqrt(totalSquareDev / (double)numStamps); // Convert to RMS
     528    mean /= numStamps;
     529
     530    double rms = 0.0;                   // Standard deviation
     531    for (int i = 0; i < stamps->num; i++) {
     532        pmSubtractionStamp *stamp = stamps->stamps->data[i]; // Stamp of interest
     533        if (stamp->status != PM_SUBTRACTION_STAMP_USED) {
     534            continue;
     535        }
     536        rms += PS_SQR(deviations->data.F32[i] - mean);
     537    }
     538    rms = sqrt(rms / (numStamps - 1));
    526539
    527540    if (rmsPtr) {
     
    549562    int numRejected = 0;                // Number of stamps rejected
    550563    int numGood = 0;                    // Number of good stamps
    551     double newSquareDev = 0.0;          // New square deviation
     564    double newMean = 0.0;               // New mean
    552565    for (int i = 0; i < stamps->num; i++) {
    553566        pmSubtractionStamp *stamp = stamps->stamps->data[i]; // Stamp of interest
    554567        if (stamp->status == PM_SUBTRACTION_STAMP_USED) {
    555             if (deviations->data.F32[i] > limit) {
     568            // Should we reject stars with low deviation?  Well, if this is really a Gaussian-like
     569            // distribution and they're low, then we have the right to ask why.  Isn't it suspicious that
     570            // they're anomalously low, compared to the rest of the population which (we hope) is indicative
     571            // of normality?  Besides, the standard deviation is going to be blown up by stars that didn't
     572            // subtract well, in which case very few (if any) stars will be legitimately rejected for being
     573            // low.
     574            if (deviations->data.F32[i] - mean > limit) {
    556575                // Mask out the stamp in the image so you it's not found again
    557576                psTrace("psModules.imcombine", 3, "Rejecting stamp %d (%d,%d)\n", i,
     
    587606            } else {
    588607                numGood++;
    589                 newSquareDev += PS_SQR(deviations->data.F32[i]);
     608                newMean += deviations->data.F32[i];
    590609            }
    591610        }
    592611    }
     612    newMean /= numGood;
    593613
    594614    if (numRejected > 0) {
    595615        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));
     616                 "%d good stamps; %d rejected.\nMean deviation: %lf --> %lf\n",
     617                 numGood, numRejected, mean, newMean);
    599618    } else {
    600619        psLogMsg("psModules.imcombine", PS_LOG_INFO,
    601                  "%d good stamps; 0 rejected.\nRMS deviation: %f\n",
    602                  numGood, rms);
     620                 "%d good stamps; 0 rejected.\nMean deviation: %lf\n",
     621                 numGood, mean);
    603622    }
    604623
Note: See TracChangeset for help on using the changeset viewer.