IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34788


Ignore:
Timestamp:
Dec 11, 2012, 9:09:45 AM (14 years ago)
Author:
bills
Message:

Compare the number of sources in y band to number of sources in i and r.
If the ratio Ny/Ni > 0.4 and the ratio Ny/Nr > 0.6 assume that the y
band stack is suspect and turn off the matchAll feature where forced
detections are created for all missing y band sources. This prevents
large amounts of garbage measurements in about 2% of LAP skycells

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippconfig/recipes/psphot.config

    r34769 r34788  
    384384# Note: if an input has a filter not in this list it will be processed after all of the others with MATCH.ALL = FALSE
    385385PSPHOT.STACK.MATCH.FILTERS   METADATA
    386     TYPE        PSPHOT_STACK.MATCH.FILTER FILTER.ID ORDER MATCH.ALL
    387     gband       PSPHOT_STACK.MATCH.FILTER   g        4       FALSE
    388     rband       PSPHOT_STACK.MATCH.FILTER   r        2       FALSE
    389     iband       PSPHOT_STACK.MATCH.FILTER   i        1       FALSE
    390     zband       PSPHOT_STACK.MATCH.FILTER   z        3       FALSE
    391     yband       PSPHOT_STACK.MATCH.FILTER   y        5       TRUE
    392     wband       PSPHOT_STACK.MATCH.FILTER   w        0       FALSE
     386    TYPE        PSPHOT_STACK.MATCH.FILTER FILTER.ID ORDER MATCH.ALL Y.RATIO.MAX
     387    gband       PSPHOT_STACK.MATCH.FILTER   g        4       FALSE      0
     388    rband       PSPHOT_STACK.MATCH.FILTER   r        2       FALSE      0.6
     389    iband       PSPHOT_STACK.MATCH.FILTER   i        1       FALSE      0.4
     390    zband       PSPHOT_STACK.MATCH.FILTER   z        3       FALSE      0
     391    yband       PSPHOT_STACK.MATCH.FILTER   y        5       TRUE       0
     392    wband       PSPHOT_STACK.MATCH.FILTER   w        0       FALSE      0
    393393END
    394394
  • trunk/psphot/src/psphotSourceMatch.c

    r34542 r34788  
    77    int     order;
    88    bool    matchAll;
     9    long    nSources;
     10    float   yRatioMax;
    911    char    filterID[MATCH_INFO_FILTER_STR_LEN];
    1012} psphotStackMatchInfo;
     
    218220        pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");
    219221        psAssert (detections, "missing detections?");
     222        psAssert (detections->allSources, "all sources not defined?");
    220223
    221224        detArrays->data[i] = psMemIncrRefCounter(detections);
    222225        readouts->data[i] = psMemIncrRefCounter(readout);
     226    }
     227
     228    // We are having a problem with large number of false y band detections causing large numbers of
     229    // matched detections to be created.
     230    // In matchInfo recipe each filter can have a value for Y.RATIO.MAX. For each filter with a non-zero value
     231    // we compare the ratio of the number of y detections to the number of detections in that filter to Y.RATIO.MAX.
     232    // If the ratio in all specified filters is above its limit, we disable matchAll for y band.
     233
     234    int iy = -1;
     235    // now we are looping over matchInfo
     236    for (int i = 0; i < nImages; i++) {
     237        // Remember which input is y
     238        if (!strcmp(matchInfo[i].filterID, "y")) {
     239            iy = i;
     240        }
     241        pmDetections *detections = detArrays->data[matchInfo[i].inputNum];
     242        matchInfo[i].nSources = detections->allSources->n;
     243    }
     244
     245    if (iy >= 0) {
     246        int nCut = 0;
     247        int nTry = 0;
     248        for (int i = 0; i < nImages; i++) {
     249            if (i == iy) continue;
     250            if (matchInfo[i].yRatioMax != 0.0 && matchInfo[i].nSources > 0) {
     251                ++nTry;
     252                float ratio = (float) matchInfo[iy].nSources / (float) matchInfo[i].nSources;
     253                psLogMsg ("psphot", PS_LOG_DETAIL, "nSrc_y / nSrc_%s: %6.3f max: %6.3f", matchInfo[i].filterID, ratio,
     254                    matchInfo[i].yRatioMax);
     255                if (ratio > matchInfo[i].yRatioMax) {
     256                    // This one is above it's threshold
     257                    ++nCut;
     258                }
     259            }
     260        }
     261        if (nTry > 0 && nCut == nTry) {
     262            // All filters with a cut were above the threshold. Disable matchAll for y band
     263            psLogMsg ("psphot", PS_LOG_INFO, "Clearing y band matchAll because y ratio was too high in %d filters", nTry);
     264            matchInfo[iy].matchAll = false;
     265        }
    223266    }
    224267
     
    516559            bool matchAll = (strcasecmp("true", matchAllStr) == 0);
    517560
     561            psString yRatioStr = psMetadataLookupStr (&status, item->data.md, "Y.RATIO.MAX");
     562            psF32 yRatioMax = atof(yRatioStr);
     563
    518564            // look for this filter in the inputs
    519565            for (int i = 0; i < num; i++) {
     
    524570                    matchInfo[i].order = order;
    525571                    matchInfo[i].matchAll = matchAll;
     572                    matchInfo[i].yRatioMax = yRatioMax;
     573                    matchInfo[i].nSources = 0;
    526574                    psLogMsg ("psphot", PS_LOG_DETAIL, "input: %d %s match order: %d match all: %d\n",
    527575                                                               i, thisFilter, order, matchAll);
Note: See TracChangeset for help on using the changeset viewer.