IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11186


Ignore:
Timestamp:
Jan 19, 2007, 12:16:23 PM (19 years ago)
Author:
eugene
Message:

added 1st and 2nd pass options

File:
1 edited

Legend:

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

    r11169 r11186  
    22
    33// In this function, we smooth the image, then search for the peaks
    4 psArray *psphotFindPeaks (pmReadout *readout, psMetadata *recipe) {
     4psArray *psphotFindPeaks (pmReadout *readout, psMetadata *recipe, int pass) {
    55
     6    float SIGMA_SMTH, NSIGMA_SMTH, NSIGMA_PEAK;
    67    bool  status = false;
    78
     
    910    psTimerStart ("psphot");
    1011
    11     float SIGMA  = psMetadataLookupF32 (&status, recipe, "PEAKS_SMOOTH_SIGMA");
    12     float NSIGMA = psMetadataLookupF32 (&status, recipe, "PEAKS_SMOOTH_NSIGMA");
     12    if (pass == 1) {
     13        SIGMA_SMTH  = psMetadataLookupF32 (&status, recipe, "PEAKS_SMOOTH_SIGMA");
     14        NSIGMA_SMTH = psMetadataLookupF32 (&status, recipe, "PEAKS_SMOOTH_NSIGMA");
     15    } else {
     16        bool status_x, status_y;
     17        float FWHM_X = psMetadataLookupF32 (&status_x, recipe, "FWHM_X");
     18        float FWHM_Y = psMetadataLookupF32 (&status_y, recipe, "FWHM_Y");
     19        if (!status_x | !status_y) psAbort ("psphotFindPeaks", "FWHM_X or FWHM_Y not defined");
     20        SIGMA_SMTH  = 0.5*(FWHM_X + FWHM_Y) / (2.0*sqrt(2.0*log(2.0)));
     21        NSIGMA_SMTH = psMetadataLookupF32 (&status, recipe, "PEAKS_SMOOTH_NSIGMA");
     22    }
    1323
    1424    // smooth the image, applying the mask as we go
    1525    psImage *smooth_im = psImageCopy (NULL, readout->image, PS_TYPE_F32);
    16     psImageSmoothMaskF32 (smooth_im, readout->mask, 0xff, SIGMA, NSIGMA);
     26    psImageSmoothMaskF32 (smooth_im, readout->mask, 0xff, SIGMA_SMTH, NSIGMA_SMTH);
    1727    psLogMsg ("psphot", PS_LOG_MINUTIA, "smooth image: %f sec\n", psTimerMark ("psphot"));
    1828
    1929    // smooth the weight, applying the mask as we go
    2030    psImage *smooth_wt = psImageCopy (NULL, readout->weight, PS_TYPE_F32);
    21     psImageSmoothMaskF32 (smooth_wt, readout->mask, 0xff, SIGMA/sqrt(2), NSIGMA);
     31    psImageSmoothMaskF32 (smooth_wt, readout->mask, 0xff, SIGMA_SMTH/sqrt(2), NSIGMA_SMTH);
    2232    psLogMsg ("psphot", PS_LOG_MINUTIA, "smooth weight: %f sec\n", psTimerMark ("psphot"));
    2333
     
    5262
    5363    // signal/noise limit for the detected peaks
    54     NSIGMA = psMetadataLookupF32 (&status, recipe, "PEAKS_NSIGMA_LIMIT");
    55 
    56     // we need to define the threshold based on the value of NSIGMA and the applied smoothing
     64    if (pass == 1) {
     65        NSIGMA_PEAK = psMetadataLookupF32 (&status, recipe, "PEAKS_NSIGMA_LIMIT");
     66    } else {
     67        NSIGMA_PEAK = psMetadataLookupF32 (&status, recipe, "PEAKS_NSIGMA_LIMIT_2");
     68    }   
     69   
     70    // we need to define the threshold based on the value of NSIGMA_PEAK and the applied smoothing
    5771    // gaussian SIGMA.  a peak in the significance image has an effective S/N for faint sources
    5872    // of (S = Io*2pi*sigma_eff^2) / sqrt(Var), where sigma_eff^2 = sigma_obs^2 + sigma_sm^2.
     
    6478    // S/N = sqrt(Io)*4*pi*sigma_sm^2
    6579    // thus, the threshold is:
    66     float effArea = 4.0*M_PI*PS_SQR(SIGMA);
    67     float threshold = PS_SQR(NSIGMA) / effArea;
     80    float effArea = 4.0*M_PI*PS_SQR(SIGMA_SMTH);
     81    float threshold = PS_SQR(NSIGMA_PEAK) / effArea;
    6882
    6983    // find the peaks in the smoothed image
Note: See TracChangeset for help on using the changeset viewer.