IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 14, 2011, 3:07:22 PM (15 years ago)
Author:
eugene
Message:

psphotSignificanceImage now returns a pmReadout so we can keep the smoothed signal image as well as the S/N image; psphotCullPeaks (and pmFootprintCullPeaks) now uses the smooted image to cull the peaks -- this deals better with low-significance detections are large, low-surface brightness areas

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110213/psphot/src/psphotSignificanceImage.c

    r30750 r30903  
    44// (S/N)^2.  If FWMH_X,Y have been recorded, use them, otherwise use PEAKS_SMOOTH_SIGMA for the
    55// smoothing kernel.
    6 psImage *psphotSignificanceImage (pmReadout *readout, psMetadata *recipe, psImageMaskType maskVal) {
     6pmReadout *psphotSignificanceImage (pmReadout *readout, psMetadata *recipe, psImageMaskType maskVal) {
    77
    88    float SIGMA_SMTH, NSIGMA_SMTH;
     
    9494    psMetadataAddF32(readout->analysis, PS_LIST_TAIL, "SIGNIFICANCE_SCALE_FACTOR", PS_META_REPLACE, "Signicance scale factor", factor);
    9595
    96     // XXX multithread this if needed
     96    // we are going to return both the image and the weight here: the image contains the signal
     97    // while the 'weight' will contain the significance (NOTE the deviation from the usual
     98    // definition)
     99
     100    // save the smoothed significance image in the weight array
    97101    for (int j = 0; j < smooth_im->numRows; j++) {
    98102        for (int i = 0; i < smooth_im->numCols; i++) {
    99103            float value = smooth_im->data.F32[j][i];
    100104            if (value < 0 || smooth_wt->data.F32[j][i] <= 0 || (mask->data.PS_TYPE_IMAGE_MASK_DATA[j][i] & maskVal)) {
    101                 smooth_im->data.F32[j][i] = 0.0;
     105                smooth_wt->data.F32[j][i] = 0.0;
    102106            } else {
    103107                // XXX the value of 100 here (or 1000 before) must depend on the FWHM of the smoothing kernel, right??
    104108                float v2 = value + PS_SQR(value/100.0);
    105                 smooth_im->data.F32[j][i] = factor * PS_SQR(v2) / smooth_wt->data.F32[j][i];
     109                smooth_wt->data.F32[j][i] = factor * PS_SQR(v2) / smooth_wt->data.F32[j][i];
    106110            }
    107111        }
     
    115119        static int pass = 0;
    116120        sprintf (name, "snsmooth.v%d.fits", pass);
    117         psphotSaveImage (NULL, smooth_im, name);
     121        psphotSaveImage (NULL, smooth_wt, name);
    118122        pass ++;
    119123    }
    120 
    121     psFree(smooth_wt);
    122 
    123124    psImageConvolveSetThreads(oldThreads);
    124125
    125     return smooth_im;
     126    pmReadout *significanceRO = pmReadoutAlloc(NULL);
     127    significanceRO->variance = smooth_wt;   
     128    significanceRO->image = smooth_im;   
     129
     130    return significanceRO;
    126131}
    127132
Note: See TracChangeset for help on using the changeset viewer.