IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28858


Ignore:
Timestamp:
Aug 6, 2010, 3:10:29 PM (16 years ago)
Author:
eugene
Message:

minor changes to test ppSubFlagNeighbors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100621/ppSub/src/ppSubFlagNeighbors.c

    r28823 r28858  
    2323bool ppSubFlagNeighbors(pmConfig *config, pmFPAview *view, psArray *sources, bool matchRef) {
    2424
     25    bool status;
     26
    2527    psAssert(config, "Require config");
    2628    psAssert(view, "Require config");
     
    2830
    2931    // Look up recipe values
    30     psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // should this be psphot?
     32    psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, PPSUB_RECIPE); // should this be psphot?
    3133    psAssert(recipe, "We checked this earlier, so it should be here.");
     34
     35    float radius = psMetadataLookupF32(&status, recipe, "INPUT.MATCH.RADIUS");
     36    psAssert (status, "cannot find INPUT.MATCH.RADIUS");
     37
     38    float minSN  = psMetadataLookupF32(&status, recipe, "INPUT.MATCH.MIN.SN");
     39    psAssert (status, "cannot find INPUT.MATCH.MIN.SN");
    3240
    3341    // Input sources
     
    6775    }
    6876
    69     // XXX put in recipe
    70     float radius = 20.0; // radius in pixels
    71 
    7277    // Match the sources to both inSources and refSources.  We want to find the closest source
    7378    // in the positive source lists to each source in the diff source list.
    7479    // XXX we need to either (a) apply S/N and other filters before we pass the in/ref sources
    7580    // to this function, or (b) add those filters in the function
    76     ppSubMatchSources (objects, inSources, radius);
    77     ppSubMatchSources (objects, refSources, radius);
     81    ppSubMatchSources (objects, inSources, radius, minSN);
     82    ppSubMatchSources (objects, refSources, radius, minSN);
    7883   
    7984    // now mark or flag the sources with matches that meet some criterion
     
    160165# define NEXT1 { i++; continue; }
    161166# define NEXT2 { j++; continue; }
    162 bool ppSubMatchSources (psArray *objects, psArray *sources, float RADIUS) {
     167bool ppSubMatchSources (psArray *objects, psArray *sources, float RADIUS, float MIN_SN) {
    163168 
    164169    float dx, dy;
     
    172177    // match sources to existing objects
    173178
    174     psLogMsg ("psphot", PS_LOG_DETAIL, "attempt to match sources (%ld vs %ld)", sources->n, objects->n);
     179    psLogMsg ("psphot", PS_LOG_DETAIL, "attempt to match sources (%ld vs %ld) (SN > %f)", sources->n, objects->n, MIN_SN);
    175180
    176181    int nMatch = 0;
     
    186191        if (!finite(src->peak->xf)) NEXT1;
    187192        if (!finite(src->peak->yf)) NEXT1;
     193        if (!finite(src->peak->SN)) NEXT1;
     194        if (src->peak->SN < MIN_SN) NEXT1;
    188195 
    189196        if (!obj) NEXT2;
     
    198205        int Imin = -1;
    199206        float Rmin = RADIUS2;
    200         for (int I = i; (dx > -1.02*RADIUS) && (I < objects->n); I++) {
     207        for (int I = i; (dx < +1.02*RADIUS) && (I < sources->n); I++) {
    201208 
    202209            src = sources->data[I];
    203210           
     211            if (!src) NEXT1;
     212            if (!src->peak) NEXT1;
     213            if (!finite(src->peak->xf)) NEXT1;
     214            if (!finite(src->peak->yf)) NEXT1;
     215            if (!finite(src->peak->SN)) NEXT1;
     216            if (src->peak->SN < MIN_SN) NEXT1;
     217
    204218            dx = src->peak->xf - obj->x;
    205219            dy = src->peak->yf - obj->y;
     
    210224            Rmin = dr;
    211225            Imin  = I;
     226            // fprintf (stderr, "j: %d, I: %d, Imin: %d, dr: %f, dx: %f, dy: %f\n", j, I, Imin, dr, dx, dy);
    212227        }
    213228
    214229        // no match, try next object
    215230        if (Imin == -1) {
     231            // fprintf (stderr, "*** missed j: %d, Imin: %d, obj x,y: %f, %f\n", j, Imin, obj->x, obj->y);
    216232            j++;
    217233            continue;
    218234        }
    219235        src = sources->data[Imin];
     236
     237        fprintf (stderr, "j: %d, Imin: %d, obj x,y: %f, %f  src x,y: %f, %f, SN: %f, ID: %d\n", j, Imin, obj->x, obj->y, src->peak->xf, src->peak->yf, src->peak->SN, src->id);
    220238
    221239        // add source to object
Note: See TracChangeset for help on using the changeset viewer.