IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32202


Ignore:
Timestamp:
Aug 29, 2011, 2:54:38 AM (15 years ago)
Author:
eugene
Message:

window for centroid, robustifying kron

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110710/psModules/src/objects/pmSourceMoments.c

    r31670 r32202  
    8080    }
    8181
     82    if (source->moments->nPixels != 0) {
     83        fprintf (stderr, "remeasure moments: %f,%f\n", source->peak->xf, source->peak->yf);
     84    }
     85
    8286    float Sum = 0.0;
    8387    float Var = 0.0;
     
    96100    // (int) so they can be used in the image index below.
    97101
    98     // do 2 passes : the first pass should use a somewhat smaller radius and no sigma window to
    99     // get an unbiased (but probably noisy) centroid
    100     if (!pmSourceMomentsGetCentroid (source, 0.75*radius, 0.0, minSN, maskVal, source->peak->xf, source->peak->yf)) {
    101         return false;
    102     }
    103     // second pass applies the Gaussian window and uses the centroid from the first pass
    104     if (!pmSourceMomentsGetCentroid (source, radius, sigma, minSN, maskVal, source->moments->Mx, source->moments->My)) {
     102    // XXX // do 2 passes : the first pass should use a somewhat smaller radius and no sigma window to
     103    // XXX // get an unbiased (but probably noisy) centroid
     104    // XXX if (!pmSourceMomentsGetCentroid (source, 0.75*radius, 0.0, minSN, maskVal, source->peak->xf, source->peak->yf)) {
     105    // XXX      return false;
     106    // XXX }
     107    // XXX // second pass applies the Gaussian window and uses the centroid from the first pass
     108    // XXX if (!pmSourceMomentsGetCentroid (source, radius, sigma, minSN, maskVal, source->moments->Mx, source->moments->My)) {
     109    // XXX      return false;
     110    // XXX }
     111
     112    // If we use a large radius for the centroid, it will be biased by any neighbors.  The flux
     113    // of any object drops pretty quickly outside 1-2 sigmas.  (The exception is bright
     114    // saturated stars, for which we need to use a very large radius here)
     115    if (!pmSourceMomentsGetCentroid (source, 1.5*sigma, 0.0, minSN, maskVal, source->peak->xf, source->peak->yf)) {
    105116        return false;
    106117    }
     
    318329            if (PS_SQR(pDiff) < minSN2*wDiff) continue;
    319330
     331# define WEIGHTED 1
     332# if (WEIGHTED)
     333            float z = r2 * rsigma2 / 4.0;
     334            assert (z >= 0.0);
     335            float weight  = exp(-z);
     336# endif
     337
    320338            float r  = sqrt(r2);
    321339            if (r < radKron) {
     340# if (WEIGHTED)
     341                Sum += pDiff*weight;
     342                Var += wDiff*weight;
     343# else
    322344                Sum += pDiff;
    323345                Var += wDiff;
     346# endif
    324347                nKronPix ++;
    325348                // if (beVerbose) fprintf (stderr, "mome: %d %d  %f  %f  %f\n", col, row, sky, *vPix, Sum);
     
    350373    source->moments->KronFinner = SumInner * M_PI * (PS_SQR(radKron)   - PS_SQR(radKinner)) / nInner;
    351374    source->moments->KronFouter = SumOuter * M_PI * (PS_SQR(radKouter) -   PS_SQR(radKron)) / nOuter;
     375
     376    // XXX not sure I should save this here...
     377    source->moments->KronFluxPSF    = source->moments->KronFlux;
     378    source->moments->KronFluxPSFErr = source->moments->KronFluxErr;
     379    source->moments->KronRadiusPSF  = source->moments->Mrf;
    352380
    353381    psTrace ("psModules.objects", 4, "Mrf: %f  KronFlux: %f  Mxx: %f  Mxy: %f  Myy: %f  Mxxx: %f  Mxxy: %f  Mxyy: %f  Myyy: %f  Mxxxx: %f  Mxxxy: %f  Mxxyy: %f  Mxyyy: %f  Mxyyy: %f\n",
Note: See TracChangeset for help on using the changeset viewer.