Changeset 28894 for branches/eam_branches/ipp-20100621/psModules/src/imcombine/pmSubtractionStamps.c
- Timestamp:
- Aug 11, 2010, 9:18:20 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100621/psModules/src/imcombine/pmSubtractionStamps.c
r28866 r28894 891 891 pmSubtractionGetFWHMs(&fwhm1, &fwhm2); 892 892 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 893 898 if (EMPIRICAL) { 894 899 psKernel *convolution1 = stamp->convolutions1->data[index]; 895 penalty1 = pmSubtractionKernelPenaltySingle(convolution1 );900 penalty1 = pmSubtractionKernelPenaltySingle(convolution1, zeroNull); 896 901 897 902 psKernel *convolution2 = stamp->convolutions2->data[index]; 898 penalty2 = pmSubtractionKernelPenaltySingle(convolution2 );903 penalty2 = pmSubtractionKernelPenaltySingle(convolution2, zeroNull); 899 904 } else { 900 905 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 moment904 penalty2 = M2 *PS_SQR(fwhm2 / 2.35); // rescale the unconvolved second-moment by the image second moment906 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 905 910 } 906 911 kernels->penalties1->data.F32[index] = kernels->penalty * penalty1; … … 915 920 } 916 921 917 float pmSubtractionKernelPenaltySingle(psKernel *kernel )922 float pmSubtractionKernelPenaltySingle(psKernel *kernel, bool zeroNull) 918 923 { 919 924 // Calculate moments … … 924 929 for (int u = kernel->xMin; u <= kernel->xMax; u++) { 925 930 double value = kernel->kernel[v][u]; 931 if (false && zeroNull && (u == 0) && (v == 0)) { 932 value += 1.0; 933 } 926 934 double value2 = PS_SQR(value); 927 935 sum += value; … … 934 942 penalty *= 1.0 / sum2; 935 943 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); 938 946 // psTrace("psModules.imcombine", 7, "Kernel %d: %f %d %d %f\n", index, fwhm, uOrder, vOrder, penalty); 939 947 }
Note:
See TracChangeset
for help on using the changeset viewer.
