IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 9, 2009, 3:16:06 PM (17 years ago)
Author:
Paul Price
Message:

Get input and reference source lists, and merge them to provide a source list for stamps and PSF.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSub/src/ppSubMatchPSFs.c

    r23217 r23235  
    5050
    5151    // Sources in image, used for stamps: these must be loaded from previous analysis stages
    52     pmReadout *sourcesRO = pmFPAfileThisReadout(config->files, view, "PPSUB.SOURCES"); // Readout with sources
    53     psArray *sources = NULL;            // Sources in image; used for stamps
    54     if (sourcesRO) {
    55         sources = psMetadataLookupPtr(&mdok, sourcesRO->analysis, "PSPHOT.SOURCES");
     52    psArray *inSources = psMetadataLookupPtr(&mdok, inRO->analysis, "PSPHOT.SOURCES"); // Input source list
     53    psArray *refSources = psMetadataLookupPtr(&mdok, refRO->analysis, "PSPHOT.SOURCES"); // Ref source list
     54
     55    psArray *sources = NULL;            // Merged list of sources
     56    if (inSources && refSources) {
     57        float radius = psMetadataLookupF32(NULL, recipe, "SOURCE.RADIUS"); // Matching radius
     58        psArray *lists = psArrayAlloc(2); // Source lists
     59        lists->data[0] = psMemIncrRefCounter(inSources);
     60        lists->data[1] = psMemIncrRefCounter(refSources);
     61        sources = pmSourceMatchMerge(lists, radius);
     62        psFree(lists);
     63        if (!sources) {
     64            psError(PS_ERR_UNKNOWN, false, "Unable to merge source lists");
     65            return false;
     66        }
     67    } else if (inSources) {
     68        sources = psMemIncrRefCounter(inSources);
     69    } else if (refSources) {
     70        sources = psMemIncrRefCounter(refSources);
    5671    }
     72
     73    psMetadataAddArray(inConv->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE,
     74                       "Merged source list", sources);
     75    psMetadataAddArray(refConv->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE,
     76                       "Merged source list", sources);
     77    psFree(sources);                    // Drop reference
    5778
    5879    int footprint = psMetadataLookupS32(NULL, recipe, "STAMP.FOOTPRINT"); // Stamp half-size
Note: See TracChangeset for help on using the changeset viewer.