IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20213


Ignore:
Timestamp:
Oct 16, 2008, 3:50:31 PM (18 years ago)
Author:
Paul Price
Message:

Using faster psImageSmoothMask with new recipe option
(PEAKS_MIN_GAUSS) to control detection of peaks near the edges. This
was hard-wired in psImageSmoothMaskF32 to 0.25. I've set the default
value to 0.5, since that doesn't find so much stuff near the edges.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotSignificanceImage.c

    r18837 r20213  
    1515    // XXX we can a) choose fft to convolve if needed and b) multithread fftw
    1616
     17    float minGauss = psMetadataLookupF32(NULL, recipe, "PEAKS_MIN_GAUSS"); // Minimum valid fraction of kernel
     18    if (!isfinite(minGauss)) {
     19        psWarning("PEAKS_MIN_GAUSS is not set in recipe; using default value");
     20        minGauss = 0.5;
     21    }
     22
    1723    bool status_x, status_y;
    1824    float FWHM_X = psMetadataLookupF32 (&status_x, recipe, "FWHM_X");
     
    2632      // if we do not know the FWHM, use the guess smoothing kernel supplied.
    2733      // it is a configuration error if these are not supplied
    28       SIGMA_SMTH  = psMetadataLookupF32 (&status, recipe, "PEAKS_SMOOTH_SIGMA"); 
     34      SIGMA_SMTH  = psMetadataLookupF32 (&status, recipe, "PEAKS_SMOOTH_SIGMA");
    2935      PS_ASSERT (status, NULL);
    30       NSIGMA_SMTH = psMetadataLookupF32 (&status, recipe, "PEAKS_SMOOTH_NSIGMA"); 
     36      NSIGMA_SMTH = psMetadataLookupF32 (&status, recipe, "PEAKS_SMOOTH_NSIGMA");
    3137      PS_ASSERT (status, NULL);
    3238      guess = true;
    3339    }
    3440    // record the actual smoothing sigma
    35     psMetadataAddF32  (recipe, PS_LIST_TAIL, "SIGMA_SMOOTH", PS_META_REPLACE, "Smoothing sigma for detections", SIGMA_SMTH);
     41    psMetadataAddF32(recipe, PS_LIST_TAIL, "SIGMA_SMOOTH", PS_META_REPLACE, "Smoothing sigma for detections",
     42                     SIGMA_SMTH);
    3643
    3744    // smooth the image, applying the mask as we go
    38     psImage *smooth_im = psImageCopy (NULL, readout->image, PS_TYPE_F32);
    39     psImageSmoothMaskF32 (smooth_im, readout->mask, maskVal, SIGMA_SMTH, NSIGMA_SMTH);
    40     psLogMsg ("psphot", PS_LOG_MINUTIA, "smooth image: %f sec\n", psTimerMark ("smooth"));
     45    psImage *smooth_im = psImageCopy(NULL, readout->image, PS_TYPE_F32);
     46    psImageSmoothMask(smooth_im, smooth_im, readout->mask, maskVal, SIGMA_SMTH, NSIGMA_SMTH, minGauss);
     47    psLogMsg("psphot", PS_LOG_MINUTIA, "smooth image: %f sec\n", psTimerMark("smooth"));
    4148
    4249    // Smooth the weight, applying the mask as we go.  The variance is smoothed by the PSF^2,
     
    4754    // measurements based on apertures comparable to or larger than the smoothing kernel, the
    4855    // effective per-pixel variance is maintained.
    49     psImage *smooth_wt = psImageCopy (NULL, readout->weight, PS_TYPE_F32);
    50     psImageSmoothMaskF32 (smooth_wt, readout->mask, maskVal, SIGMA_SMTH/sqrt(2), NSIGMA_SMTH);
    51     psLogMsg ("psphot", PS_LOG_MINUTIA, "smooth weight: %f sec\n", psTimerMark ("smooth"));
     56    psImage *smooth_wt = psImageCopy(NULL, readout->weight, PS_TYPE_F32);
     57    psImageSmoothMask(smooth_wt, smooth_wt, readout->mask, maskVal, SIGMA_SMTH * M_SQRT1_2,
     58                      NSIGMA_SMTH, minGauss);
     59    psLogMsg("psphot", PS_LOG_MINUTIA, "smooth weight: %f sec\n", psTimerMark("smooth"));
    5260
    5361    psImage *mask = readout->mask;
     
    5866        char name[64];
    5967        sprintf (name, "imsmooth.v%d.fits", pass);
    60         psphotSaveImage (NULL, smooth_im, name);
     68        psphotSaveImage(NULL, smooth_im, name);
    6169        sprintf (name, "wtsmooth.v%d.fits", pass);
    62         psphotSaveImage (NULL, smooth_wt, name);
     70        psphotSaveImage(NULL, smooth_wt, name);
    6371    }
    6472
     
    6775    // sigma_s^2.  Ideally, we are choosing sigma_s = sigma_r, in which case sigma_o^2 = 2
    6876    // sigma_s^2.  If we do not know the input image PSF size (initial detection stage), then
    69     // we are assuming that sigma_r = sigma_s. 
     77    // we are assuming that sigma_r = sigma_s.
    7078
    7179    // Build the significance image on top of smooth_im.  We need to correct the ratio im/wt by
     
    93101    // record the effective area and significance scaling factor
    94102    float effArea = 8.0 * M_PI * PS_SQR(SIGMA_SMTH);
    95     psMetadataAddF32  (recipe, PS_LIST_TAIL, "EFFECTIVE_AREA", PS_META_REPLACE, "Effective Area", effArea);
    96     psMetadataAddF32  (recipe, PS_LIST_TAIL, "SIGNIFICANCE_SCALE_FACTOR", PS_META_REPLACE, "Signicance scale factor", factor);
     103    psMetadataAddF32(recipe, PS_LIST_TAIL, "EFFECTIVE_AREA", PS_META_REPLACE, "Effective Area", effArea);
     104    psMetadataAddF32(recipe, PS_LIST_TAIL, "SIGNIFICANCE_SCALE_FACTOR", PS_META_REPLACE,
     105                     "Signicance scale factor", factor);
    97106
    98107    // XXX multithread this if needed
     
    107116        }
    108117    }
    109     psLogMsg ("psphot", PS_LOG_INFO, "built smoothed signficance image: %f sec\n", psTimerMark ("smooth"));
     118    psLogMsg ("psphot", PS_LOG_INFO, "built smoothed signficance image: %f sec\n", psTimerMark("smooth"));
    110119
    111120    // optionally save example images under trace
     
    117126    }
    118127
    119     psFree (smooth_wt);
     128    psFree(smooth_wt);
    120129    return smooth_im;
    121130}
Note: See TracChangeset for help on using the changeset viewer.