IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 5, 2009, 5:03:33 PM (17 years ago)
Author:
Paul Price
Message:

Merging pap_branch_20090128. Resolved a small number of conflicts. Compiles, but not tested in detail.

File:
1 edited

Legend:

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

    r21183 r21366  
    11# include "psphotInternal.h"
    22
    3 // In this function, we smooth the image and weight, then generate the significance image :
     3// In this function, we smooth the image and variance, then generate the significance image :
    44// (S/N)^2.  If FWMH_X,Y have been recorded, use them, otherwise use PEAKS_SMOOTH_SIGMA for the
    55// smoothing kernel.
     
    1010    bool guess = false;
    1111
    12     // smooth the image and weight map
     12    // smooth the image and variance map
    1313    psTimerStart ("psphot.smooth");
    1414    bool oldThreads = psImageConvolveSetThreads(true); // Old value of threading in psImageConvolve
     
    4848    psLogMsg("psphot", PS_LOG_MINUTIA, "smooth image: %f sec\n", psTimerMark("psphot.smooth"));
    4949
    50     // Smooth the weight, applying the mask as we go.  The variance is smoothed by the PSF^2,
     50    // Smooth the variance, applying the mask as we go.  The variance is smoothed by the PSF^2,
    5151    // renomalized to maintain the input level of the variance.  We achieve this by smoothing
    5252    // with a Gaussian with sigma = SIGMA_SMTH/sqrt(2) with unity normalization.  Note that
     
    5555    // measurements based on apertures comparable to or larger than the smoothing kernel, the
    5656    // effective per-pixel variance is maintained.
    57     psImage *smooth_wt = psImageCopy(NULL, readout->weight, PS_TYPE_F32);
     57    psImage *smooth_wt = psImageCopy(NULL, readout->variance, PS_TYPE_F32);
    5858    psImageSmoothMask_Threaded(smooth_wt, smooth_wt, readout->mask, maskVal, SIGMA_SMTH * M_SQRT1_2,
    5959                      NSIGMA_SMTH, minGauss);
    60     psLogMsg("psphot", PS_LOG_MINUTIA, "smooth weight: %f sec\n", psTimerMark("psphot.smooth"));
     60    psLogMsg("psphot", PS_LOG_MINUTIA, "smooth variance: %f sec\n", psTimerMark("psphot.smooth"));
    6161
    6262    psImage *mask = readout->mask;
     
    100100
    101101    float factor = guess ? 4.0 * M_PI * PS_SQR(SIGMA_SMTH) : 4.0 * M_PI * PS_SQR(SIGMA_SMTH);
     102
     103    // Correct the correction factor for the covariance produced by the (potentially multiple) smoothing
     104    psKernel *kernel = psImageSmoothKernel(SIGMA_SMTH, NSIGMA_SMTH); // Kernel used for smoothing
     105    psKernel *covar = psImageCovarianceCalculate(kernel, readout->covariance); // Covariance matrix
     106    psFree(kernel);
     107    factor /= psImageCovarianceFactor(covar);
     108    psFree(covar);
     109
    102110    // record the effective area and significance scaling factor
    103111    float effArea = 8.0 * M_PI * PS_SQR(SIGMA_SMTH);
Note: See TracChangeset for help on using the changeset viewer.