IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 8, 2011, 2:41:42 PM (15 years ago)
Author:
eugene
Message:

match sources before final linear fit (to enable forced photometry of PSF mags); only a single detection per image allowed for an object; distinguish conditions for Radial Aperture analysis and Petrosian analysis; no Radial Aperture analysis for chisq image

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110906/psphot/src/psphotSourceMatch.c

    r32619 r32628  
    6767    objects = psArraySort (objects, pmPhotObjSortByX);
    6868 
    69     psVector *found = psVectorAlloc(sources->n, PS_TYPE_U8);
    70     psVectorInit (found, 0);
     69    psVector *foundSrc = psVectorAlloc(sources->n, PS_TYPE_U8);
     70    psVectorInit (foundSrc, 0);
     71
     72    psVector *foundObj = psVectorAlloc(sources->n, PS_TYPE_U8);
     73    psVectorInit (foundObj, 0);
    7174
    7275    // match sources to existing objects
     
    9396        if (dx > +1.02*RADIUS) NEXT2;
    9497 
     98        /* this block will match a given detection to the closest object within range of that detection.
     99           XXX note that this matches ALL detections within range of the single object to that same object
     100           this is bad, but I cannot just go in linear order (ie, mark off each object as they are
     101           used).  I should make a list of all Nobj * Ndet pairs in range and choose the matches
     102           based on their separations.  UGH
     103        */
     104   
    95105        // we are within match range, look for matches:
    96106        int Jmin = -1;
     
    98108        for (int J = j; (dx > -1.02*RADIUS) && (J < objects->n); J++) {
    99109 
     110            // skip objects that are already assigned:
     111            if (foundObj->data.U8[J]) continue;
    100112            obj = objects->data[J];
    101113           
     
    117129        }
    118130        obj = objects->data[Jmin];
     131        foundObj->data.U8[Jmin] = 1;
    119132
    120133        // add to object
    121134        pmPhotObjAddSource (obj, src);
    122         found->data.U8[i] = 1;
     135        foundSrc->data.U8[i] = 1;
    123136        i++;
    124137    }
     
    128141    for (i = 0; i < sources->n; i++) {
    129142
    130         if (found->data.U8[i]) continue;
     143        if (foundSrc->data.U8[i]) continue;
    131144
    132145        pmSource *src = sources->data[i];
     
    139152    psLogMsg ("psphot", PS_LOG_DETAIL, "matched sources (%ld vs %ld)", sources->n, objects->n);
    140153
    141     psFree (found);
     154    psFree (foundSrc);
     155    psFree (foundObj);
    142156    return true;
    143157}
     
    270284        pmPhotObj *obj = objects->data[i];
    271285        nSources += obj->sources->n;
     286        psAssert (obj->sources->n == nImages, "failed to match sources?");
    272287    }
    273288    psLogMsg ("psphot", PS_LOG_DETAIL, "total of %d sources for %d images", nSources, nImages);
Note: See TracChangeset for help on using the changeset viewer.