IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 18, 2012, 5:56:48 AM (14 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20121130/psphot
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20121130/psphot

  • branches/eam_branches/ipp-20121130/psphot/src

  • branches/eam_branches/ipp-20121130/psphot/src/psphotSourceMatch.c

    r34542 r34838  
    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    // The matchInfo recipe each entry contains 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 filters with a non-zero is above its limit we consider the y band stack to
     233    // be suspect and so disable the y band matchAll recipe (if set)
     234
     235    int iy = -1;
     236    // note now we are looping over matchInfo
     237    for (int i = 0; i < nImages; i++) {
     238        // Remember which input is y
     239        if (!strcmp(matchInfo[i].filterID, "y")) {
     240            iy = i;
     241        }
     242        pmDetections *detections = detArrays->data[matchInfo[i].inputNum];
     243        matchInfo[i].nSources = detections->allSources->n;
     244    }
     245
     246    if (iy >= 0) {
     247        int nCut = 0;
     248        int nTry = 0;
     249        for (int i = 0; i < nImages; i++) {
     250            if (i == iy) continue;
     251            if (matchInfo[i].yRatioMax != 0.0 && matchInfo[i].nSources > 0) {
     252                ++nTry;
     253                float ratio = (float) matchInfo[iy].nSources / (float) matchInfo[i].nSources;
     254                psLogMsg ("psphot", PS_LOG_DETAIL, "nSrc_y / nSrc_%s: %6.3f max: %6.3f", matchInfo[i].filterID, ratio,
     255                    matchInfo[i].yRatioMax);
     256                if (ratio > matchInfo[i].yRatioMax) {
     257                    // This one is above it's threshold
     258                    ++nCut;
     259                }
     260            }
     261        }
     262        if (nTry > 0 && nCut == nTry) {
     263            // All filters with a cut were above the threshold. Disable matchAll for y band
     264            psLogMsg ("psphot", PS_LOG_INFO, "Clearing y band matchAll because y ratio was too high in %d filters", nTry);
     265            matchInfo[iy].matchAll = false;
     266        }
    223267    }
    224268
     
    516560            bool matchAll = (strcasecmp("true", matchAllStr) == 0);
    517561
     562            psString yRatioStr = psMetadataLookupStr (&status, item->data.md, "Y.RATIO.MAX");
     563            psF32 yRatioMax = atof(yRatioStr);
     564
    518565            // look for this filter in the inputs
    519566            for (int i = 0; i < num; i++) {
     
    524571                    matchInfo[i].order = order;
    525572                    matchInfo[i].matchAll = matchAll;
     573                    matchInfo[i].yRatioMax = yRatioMax;
     574                    matchInfo[i].nSources = 0;
    526575                    psLogMsg ("psphot", PS_LOG_DETAIL, "input: %d %s match order: %d match all: %d\n",
    527576                                                               i, thisFilter, order, matchAll);
Note: See TracChangeset for help on using the changeset viewer.