IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

add unofficial PS1_V4 output format (not yet standard); add clean radial profile to find sky limit; use sky limit to control kron analysis window; fix thread / memory problem for radial photometry; fix object matching for forced psf photometry; fix object matching to get the right matches

Location:
trunk/psphot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot

  • trunk/psphot/src/psphotSourceMatch.c

    r32348 r32633  
    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}
     
    234248           
    235249            // assign to a footprint on this readout->image
    236             peak->footprint = pmFootprintCopyData(footprint, readout->image);
    237 
    238             // the peak does not claim ownership of the footprint (it does not free it). save a copy of this
    239             // footprint on detections->footprints so we can free it later
    240             psArrayAdd(detections->footprints, 100, peak->footprint);
    241             psFree (peak->footprint);
     250            if (footprint) {
     251                peak->footprint = pmFootprintCopyData(footprint, readout->image);
     252
     253                // the peak does not claim ownership of the footprint (it does not free it). save a copy of this
     254                // footprint on detections->footprints so we can free it later
     255                psArrayAdd(detections->footprints, 100, peak->footprint);
     256                psFree (peak->footprint);
     257            }
    242258           
    243259            // create a new source
     
    268284        pmPhotObj *obj = objects->data[i];
    269285        nSources += obj->sources->n;
     286        psAssert (obj->sources->n == nImages, "failed to match sources?");
    270287    }
    271288    psLogMsg ("psphot", PS_LOG_DETAIL, "total of %d sources for %d images", nSources, nImages);
Note: See TracChangeset for help on using the changeset viewer.