IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14733


Ignore:
Timestamp:
Sep 4, 2007, 10:11:06 AM (19 years ago)
Author:
Paul Price
Message:

Only perform calculations on good stamps.

File:
1 edited

Legend:

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

    r14719 r14733  
    212212    for (int i = 0; i < numStamps; i++) {
    213213        pmSubtractionStamp *stamp = stamps->data[i]; // Stamp of interest
     214        if (stamp->status == PM_SUBTRACTION_STAMP_REJECTED || stamp->status == PM_SUBTRACTION_STAMP_NONE) {
     215            continue;
     216        }
    214217        psKernel *input = stamp->input; // Input image of interest
    215218        psImage *copy = psImageCopy(NULL, input->image, PS_TYPE_F32); // Copy of the image
     
    221224    for (int i = 0; i < numStamps; i++) {
    222225        pmSubtractionStamp *stamp = stamps->data[i]; // Stamp of interest
     226        if (stamp->status == PM_SUBTRACTION_STAMP_REJECTED || stamp->status == PM_SUBTRACTION_STAMP_NONE) {
     227            continue;
     228        }
    223229        if (!stamp->convolutions) {
    224230            stamp->convolutions = psArrayAlloc(numKernels);
     
    235241    for (int i = 0; i < numStamps; i++) {
    236242        pmSubtractionStamp *stamp = stamps->data[i]; // Stamp of interest
     243        if (stamp->status == PM_SUBTRACTION_STAMP_REJECTED || stamp->status == PM_SUBTRACTION_STAMP_NONE) {
     244            continue;
     245        }
    237246        psKernel *weight = stamp->weight; // Weight map for stamp
    238247
     
    250259    for (int i = 0; i < numKernels; i++) {
    251260        for (int j = 0; j < numStamps; j++) {
    252             accumulateConvolutions(&sumC->data.F64[i], &sumCC->data.F64[i], stamps->data[j], i, footprint);
     261            pmSubtractionStamp *stamp = stamps->data[j]; // Stamp of interest
     262            if (stamp->status == PM_SUBTRACTION_STAMP_REJECTED ||
     263                stamp->status == PM_SUBTRACTION_STAMP_NONE) {
     264                continue;
     265            }
     266            accumulateConvolutions(&sumC->data.F64[i], &sumCC->data.F64[i], stamp, i, footprint);
    253267        }
    254268    }
     
    256270    // Initial chi^2
    257271    double lastChi2 = 0.0;              // Chi^2 from last iteration
    258     int numPixels = numStamps * PS_SQR(2 * footprint + 1); // Number of pixels contributing to chi^2
     272    int numPixels = 0;                  // Number of pixels contributing to chi^2
    259273    for (int i = 0; i < numStamps; i++) {
    260         lastChi2 += initialChi2(inputs->data[i], stamps->data[i], footprint);
     274        pmSubtractionStamp *stamp = stamps->data[i]; // Stamp of interest
     275        if (stamp->status == PM_SUBTRACTION_STAMP_REJECTED || stamp->status == PM_SUBTRACTION_STAMP_NONE) {
     276            continue;
     277        }
     278        lastChi2 += initialChi2(inputs->data[i], stamp, footprint);
     279        numPixels += PS_SQR(2 * footprint + 1);
    261280    }
    262281    lastChi2 /= numPixels;
     
    282301
    283302            for (int j = 0; j < numStamps; j++) {
    284                 accumulateCross(&sumI, &sumII, &sumIC, stamps->data[j], inputs->data[j], i, footprint);
     303                pmSubtractionStamp *stamp = stamps->data[j]; // Stamp of interest
     304                if (stamp->status == PM_SUBTRACTION_STAMP_REJECTED ||
     305                    stamp->status == PM_SUBTRACTION_STAMP_NONE) {
     306                    continue;
     307                }
     308                accumulateCross(&sumI, &sumII, &sumIC, stamp, inputs->data[j], i, footprint);
    285309            }
    286310
     
    291315            double chi2 = 0.0;          // Chi^2
    292316            for (int j = 0; j < numStamps; j++) {
    293                 chi2 += accumulateChi2(inputs->data[j], stamps->data[j], i, coeff, bg, footprint);
     317                pmSubtractionStamp *stamp = stamps->data[j]; // Stamp of interest
     318                if (stamp->status == PM_SUBTRACTION_STAMP_REJECTED ||
     319                    stamp->status == PM_SUBTRACTION_STAMP_NONE) {
     320                    continue;
     321                }
     322                chi2 += accumulateChi2(inputs->data[j], stamp, i, coeff, bg, footprint);
    294323            }
    295324
     
    321350        // Remove its contribution, and don't include it in the future.
    322351        for (int j = 0; j < numStamps; j++) {
    323             subtractConvolution(inputs->data[j], stamps->data[j], bestIndex, bestCoeff, bestBG, footprint);
     352            pmSubtractionStamp *stamp = stamps->data[j]; // Stamp of interest
     353            if (stamp->status == PM_SUBTRACTION_STAMP_REJECTED ||
     354                stamp->status == PM_SUBTRACTION_STAMP_NONE) {
     355                continue;
     356            }
     357            subtractConvolution(inputs->data[j], stamp, bestIndex, bestCoeff, bestBG, footprint);
    324358        }
    325359
Note: See TracChangeset for help on using the changeset viewer.