IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25647


Ignore:
Timestamp:
Sep 28, 2009, 5:54:54 PM (17 years ago)
Author:
eugene
Message:

remove Unthreaded code, remove MIN_PIXEL_SN (not a valid option)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20090715/psphot/src/psphotSourceStats.c

    r25528 r25647  
    156156    float RADIUS       = psMetadataLookupF32 (&status, recipe, "PSF_MOMENTS_RADIUS");
    157157    if (!status) return false;
    158     float MIN_PIXEL_SN = psMetadataLookupF32 (&status, recipe, "MOMENTS_MIN_PIXEL_SN");
    159     if (!status) return false;
    160158    float SIGMA        = psMetadataLookupF32 (&status, recipe, "MOMENTS_GAUSS_SIGMA");
    161159    if (!status) return false;
     
    206204        }
    207205
    208         // measure basic source moments
    209         status = pmSourceMoments (source, RADIUS, SIGMA, MIN_PIXEL_SN);
     206        // measure basic source moments (no S/N clipping on input pixels)
     207        status = pmSourceMoments (source, RADIUS, SIGMA, 0.0);
    210208        if (status) {
    211209            Nmoments ++;
     
    217215        BIG_RADIUS = PS_MIN (INNER, 3*RADIUS);
    218216        psTrace ("psphot", 4, "retrying moments for %d, %d\n", source->peak->x, source->peak->y);
    219         status = pmSourceMoments (source, BIG_RADIUS, 3.0*SIGMA, MIN_PIXEL_SN);
     217        status = pmSourceMoments (source, BIG_RADIUS, 3.0*SIGMA, 0.0);
    220218        if (status) {
    221219            source->mode |= PM_SOURCE_MODE_BIG_RADIUS;
     
    248246    bool status;
    249247
    250     float MIN_SN       = psMetadataLookupF32 (&status, recipe, "MOMENTS_SN_MIN");
     248    float MIN_SN = psMetadataLookupF32 (&status, recipe, "MOMENTS_SN_MIN");
    251249    if (!status) return false;
    252250
     
    273271            }
    274272
    275             // measure basic source moments
     273            // measure basic source moments (no S/N clipping on input pixels)
    276274            status = pmSourceMoments (source, 4*sigma[i], sigma[i], 0.0);
    277275        }
     
    332330    return true;
    333331}
    334 
    335 # if (0)
    336 bool psphotSourceStats_Unthreaded (int *nfail, int *nmoments, psArray *sources, psMetadata *recipe) {
    337 
    338     bool status = false;
    339     float BIG_RADIUS;
    340 
    341     float INNER    = psMetadataLookupF32 (&status, recipe, "SKY_INNER_RADIUS");
    342     if (!status) return false;
    343     float MIN_SN   = psMetadataLookupF32 (&status, recipe, "MOMENTS_SN_MIN");
    344     if (!status) return false;
    345     float RADIUS   = psMetadataLookupF32 (&status, recipe, "PSF_MOMENTS_RADIUS");
    346     if (!status) return false;
    347 
    348     // bit-masks to test for good/bad pixels
    349     psImageMaskType maskVal = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT");
    350     assert (maskVal);
    351 
    352     // bit-mask to mark pixels not used in analysis
    353     psImageMaskType markVal = psMetadataLookupImageMask(&status, recipe, "MARK.PSPHOT");
    354     assert (markVal);
    355 
    356     // maskVal is used to test for rejected pixels, and must include markVal
    357     maskVal |= markVal;
    358 
    359     // threaded measurement of the sources moments
    360     int Nfail = 0;
    361     int Nmoments = 0;
    362     for (int i = 0; i < sources->n; i++) {
    363         pmSource *source = sources->data[i];
    364 
    365         // skip faint sources for moments measurement
    366         if (source->peak->SN < MIN_SN) {
    367             continue;
    368         }
    369 
    370         // measure a local sky value
    371         // the local sky is now ignored; kept here for reference only
    372         status = pmSourceLocalSky (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, markVal);
    373         if (!status) {
    374             psErrorClear(); // XXX re-consider the errors raised here
    375             Nfail ++;
    376             continue;
    377         }
    378 
    379         // measure the local sky variance (needed if noise is not sqrt(signal))
    380         // XXX EAM : this should use ROBUST not SAMPLE median, but it is broken
    381         status = pmSourceLocalSkyVariance (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, markVal);
    382         if (!status) {
    383             Nfail ++;
    384             psErrorClear();
    385             continue;
    386         }
    387 
    388         // measure basic source moments
    389         status = pmSourceMoments (source, RADIUS, SIGMA, MIN_PIXEL_SN);
    390         if (status) {
    391             Nmoments ++;
    392             continue;
    393         }
    394 
    395         // if no valid pixels, or massive swing, likely saturated source,
    396         // try a much larger box
    397         BIG_RADIUS = PS_MIN (INNER, 3*RADIUS);
    398         psTrace ("psphot", 4, "retrying moments for %d, %d\n", source->peak->x, source->peak->y);
    399         status = pmSourceMoments (source, BIG_RADIUS, 3.0*SIGMA, MIN_PIXEL_SN);
    400         if (status) {
    401             Nmoments ++;
    402             continue;
    403         }
    404 
    405         Nfail ++;
    406         psErrorClear();
    407         continue;
    408     }
    409 
    410     // change the value of a scalar on the array (wrap this and put it in psArray.h)
    411     *nmoments = Nmoments;
    412     *nfail = Nfail;
    413 
    414     return true;
    415 }
    416 # endif
Note: See TracChangeset for help on using the changeset viewer.