IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30869


Ignore:
Timestamp:
Mar 10, 2011, 5:29:34 PM (15 years ago)
Author:
eugene
Message:

modify the footprint analysis for potentially saturated objects -- use a max threshold of a smallish fraction of saturation so that we group all detections within the saturated region

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110213/psphot/src/psphotCullPeaks.c

    r27673 r30869  
    2626    psAssert (status, "cannot find SKY_STDEV in readout->analysis");
    2727
    28     const float min_threshold = nsigma_min*skyStdev;
     28    const float MIN_THRESHOLD = nsigma_min*skyStdev;
    2929   
     30    // for saturated stars, we should be somewhat more agressive about culling: instead of
     31    // letting the height of the intervening col (saddle point) be set by the S/N of the image
     32    // pixel, it should be set to a fraction of the saturation value.  example for a
     33    // near-saturation pixel:
     34    // flux = 40k, sigma = 200
     35    // nsigma_delta = 4.0, nsigma_min = 1.0, fPadding = 0.01,
     36    // fStdev = 0.005, stdev_pad = 0.011*40k = 400
     37    // threshold = 40k - 4*400 = 38400
     38
     39    // in practice, we should make the threshold in such a case more like 0.5 * saturation...
     40
     41    float SATURATION = NAN;
     42
     43    // do not completely trust the values in the header...
     44    float CELL_SATURATION = psMetadataLookupF32 (&status, readout->parent->concepts, "CELL.SATURATION");
     45    float MIN_SATURATION = psMetadataLookupF32 (&status, recipe, "DEBLEND_MIN_SATURATION");
     46    if (!status || !isfinite(MIN_SATURATION)) {
     47        MIN_SATURATION = 40000.0;
     48    }
     49    if (!isfinite(CELL_SATURATION)) {
     50        SATURATION = MIN_SATURATION;
     51    } else {
     52        SATURATION = PS_MAX(MIN_SATURATION, CELL_SATURATION);
     53    }
     54    float SAT_TEST_LEVEL = 0.50*SATURATION;
     55    float SAT_THRESHOLD  = 0.05*SATURATION;
     56
    3057    for (int i = 0; i < footprints->n; i++) {
    31         // if (i % 50 == 0) fprintf (stderr, "cull %d\n", i);
    3258        pmFootprint *fp = footprints->data[i];
     59        if (fp->peaks == NULL) continue;
     60        if (fp->peaks->n == 0) continue;
     61
    3362        if (fp->npix > 30000) {
    3463            fprintf (stderr, "big footprint: %f %f to %f %f (%d pix)\n", fp->bbox.x0, fp->bbox.y0, fp->bbox.x1, fp->bbox.y1, fp->npix);
    3564        }
    3665        psTimerStart ("psphot.cull.footprints");
    37         if (pmFootprintCullPeaks(readout->image, readout->variance, fp, nsigma_delta, fPadding, min_threshold) != PS_ERR_NONE) {
     66
     67        pmPeak *brightPeak = fp->peaks->data[0];
     68        float max_threshold = SAT_TEST_LEVEL;
     69        if (brightPeak->flux > SAT_TEST_LEVEL) {
     70            max_threshold = SAT_THRESHOLD;
     71            brightPeak->type = PM_PEAK_SUSPECT_SATURATION;
     72        }
     73
     74        if (pmFootprintCullPeaks(readout->image, readout->variance, fp, nsigma_delta, fPadding, MIN_THRESHOLD, max_threshold) != PS_ERR_NONE) {
    3875            return psError(PS_ERR_UNKNOWN, false, "Culling pmFootprint %d", fp->id);
    3976        }
Note: See TracChangeset for help on using the changeset viewer.