IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 11, 2010, 9:18:20 AM (16 years ago)
Author:
eugene
Message:

some test prints are on; kernel second moments added in quadrature to image second moment

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100621/psModules/src/imcombine/pmSubtractionStamps.c

    r28866 r28894  
    891891    pmSubtractionGetFWHMs(&fwhm1, &fwhm2);
    892892
     893    bool zeroNull = false;
     894    int uOrder = kernels->u->data.S32[index];
     895    int vOrder = kernels->v->data.S32[index];
     896    if (uOrder % 2 == 0 && vOrder % 2 == 0) zeroNull = true;
     897
    893898    if (EMPIRICAL) {
    894899        psKernel *convolution1 = stamp->convolutions1->data[index];
    895         penalty1 = pmSubtractionKernelPenaltySingle(convolution1);
     900        penalty1 = pmSubtractionKernelPenaltySingle(convolution1, zeroNull);
    896901
    897902        psKernel *convolution2 = stamp->convolutions2->data[index];
    898         penalty2 = pmSubtractionKernelPenaltySingle(convolution2);
     903        penalty2 = pmSubtractionKernelPenaltySingle(convolution2, zeroNull);
    899904    } else {
    900905        pmSubtractionKernelPreCalc *kernel = kernels->preCalc->data[index];
    901         float M2 = pmSubtractionKernelPenaltySingle(kernel->kernel);
    902 
    903         penalty1 = M2 * PS_SQR(fwhm1 / 2.35); // rescale the unconvolved second-moment by the image second moment
    904         penalty2 = M2 * PS_SQR(fwhm2 / 2.35); // rescale the unconvolved second-moment by the image second moment
     906        float M2 = pmSubtractionKernelPenaltySingle(kernel->kernel, zeroNull);
     907
     908        penalty1 = M2 + PS_SQR(fwhm1 / 2.35); // rescale the unconvolved second-moment by the image second moment
     909        penalty2 = M2 + PS_SQR(fwhm2 / 2.35); // rescale the unconvolved second-moment by the image second moment
    905910    }
    906911    kernels->penalties1->data.F32[index] = kernels->penalty * penalty1;
     
    915920}
    916921
    917 float pmSubtractionKernelPenaltySingle(psKernel *kernel)
     922float pmSubtractionKernelPenaltySingle(psKernel *kernel, bool zeroNull)
    918923{
    919924    // Calculate moments
     
    924929        for (int u = kernel->xMin; u <= kernel->xMax; u++) {
    925930            double value = kernel->kernel[v][u];
     931            if (false && zeroNull && (u == 0) && (v == 0)) {
     932                value += 1.0;
     933            }
    926934            double value2 = PS_SQR(value);
    927935            sum += value;
     
    934942    penalty *= 1.0 / sum2;
    935943
    936     if (0) {
    937         fprintf(stderr, "min: %lf, max: %lf, moment: %lf\n", min, max, penalty);
     944    if (1) {
     945        fprintf(stderr, "min: %lf, max: %lf, moment: %lf, flux^2: %lf\n", min, max, penalty, sum2);
    938946        // psTrace("psModules.imcombine", 7, "Kernel %d: %f %d %d %f\n", index, fwhm, uOrder, vOrder, penalty);
    939947    }
Note: See TracChangeset for help on using the changeset viewer.