IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 30, 2009, 5:20:29 PM (17 years ago)
Author:
watersc1
Message:

Finished up my edits to the detrend cleanup, and some changes to my
copy of burntool and the pslib astrometry. Detrend cleanup has not
been tested yet. That's up next.

Location:
branches/czw_branch/cleanup
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/cleanup

  • branches/czw_branch/cleanup/psModules/src/imcombine/pmSubtractionEquation.c

    r24621 r24951  
    793793
    794794#ifdef TESTING
    795               // XXX double-check for NAN in data:
    796                 for (int iy = 0; iy < stamp->matrix1->numRows; iy++) {
    797                     for (int ix = 0; ix < stamp->matrix1->numCols; ix++) {
    798                         if (!isfinite(stamp->matrix1->data.F64[iy][ix])) {
    799                             fprintf (stderr, "WARNING: NAN in matrix1\n");
    800                         }
    801                     }
    802                 }
    803                 for (int ix = 0; ix < stamp->vector1->n; ix++) {
    804                     if (!isfinite(stamp->vector1->data.F64[ix])) {
    805                         fprintf (stderr, "WARNING: NAN in vector1\n");
    806                     }
    807                 }
     795              // XXX double-check for NAN in data:
     796                for (int iy = 0; iy < stamp->matrix1->numRows; iy++) {
     797                    for (int ix = 0; ix < stamp->matrix1->numCols; ix++) {
     798                        if (!isfinite(stamp->matrix1->data.F64[iy][ix])) {
     799                            fprintf (stderr, "WARNING: NAN in matrix1\n");
     800                        }
     801                    }
     802                }
     803                for (int ix = 0; ix < stamp->vector1->n; ix++) {
     804                    if (!isfinite(stamp->vector1->data.F64[ix])) {
     805                        fprintf (stderr, "WARNING: NAN in vector1\n");
     806                    }
     807                }
    808808#endif
    809809
     
    818818
    819819#ifdef TESTING
    820         for (int ix = 0; ix < sumVector->n; ix++) {
    821             if (!isfinite(sumVector->data.F64[ix])) {
    822                 fprintf (stderr, "WARNING: NAN in vector1\n");
    823             }
    824         }
     820        for (int ix = 0; ix < sumVector->n; ix++) {
     821            if (!isfinite(sumVector->data.F64[ix])) {
     822                fprintf (stderr, "WARNING: NAN in vector1\n");
     823            }
     824        }
    825825#endif
    826826
     
    828828
    829829#ifdef TESTING
    830         for (int ix = 0; ix < sumVector->n; ix++) {
    831             if (!isfinite(sumVector->data.F64[ix])) {
    832                 fprintf (stderr, "WARNING: NAN in vector1\n");
    833             }
    834         }
     830        for (int ix = 0; ix < sumVector->n; ix++) {
     831            if (!isfinite(sumVector->data.F64[ix])) {
     832                fprintf (stderr, "WARNING: NAN in vector1\n");
     833            }
     834        }
    835835        {
    836836            psImage *inverse = psMatrixInvert(NULL, sumMatrix, NULL);
     
    866866
    867867#ifdef TESTING
    868         // XXX double-check for NAN in data:
    869         for (int ix = 0; ix < kernels->solution1->n; ix++) {
    870             if (!isfinite(kernels->solution1->data.F64[ix])) {
    871                 fprintf (stderr, "WARNING: NAN in vector1\n");
    872             }
    873         }
     868        // XXX double-check for NAN in data:
     869        for (int ix = 0; ix < kernels->solution1->n; ix++) {
     870            if (!isfinite(kernels->solution1->data.F64[ix])) {
     871                fprintf (stderr, "WARNING: NAN in vector1\n");
     872            }
     873        }
    874874#endif
    875875
     
    11271127                source = stamp->image1;
    11281128                convolutions = stamp->convolutions1;
     1129
     1130                // Having convolved image1 and changed its normalisation, we need to renormalise the residual
     1131                // so that it is on the scale of image1.
     1132                psImage *image = pmSubtractionKernelImage(kernels, stamp->xNorm, stamp->yNorm,
     1133                                                          false); // Kernel image
     1134                if (!image) {
     1135                    psError(PS_ERR_UNKNOWN, false, "Unable to generate image of kernel.");
     1136                    return false;
     1137                }
     1138                double sumKernel = 0;   // Sum of kernel, for normalising residual
     1139                int size = kernels->size; // Half-size of kernel
     1140                int fullSize = 2 * size + 1; // Full size of kernel
     1141                for (int y = 0; y < fullSize; y++) {
     1142                    for (int x = 0; x < fullSize; x++) {
     1143                        sumKernel += image->data.F32[y][x];
     1144                    }
     1145                }
     1146                psFree(image);
     1147                devNorm = 1.0 / sumKernel / numPixels;
    11291148                break;
    11301149              case PM_SUBTRACTION_MODE_2:
Note: See TracChangeset for help on using the changeset viewer.