Changeset 28858
- Timestamp:
- Aug 6, 2010, 3:10:29 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100621/ppSub/src/ppSubFlagNeighbors.c
r28823 r28858 23 23 bool ppSubFlagNeighbors(pmConfig *config, pmFPAview *view, psArray *sources, bool matchRef) { 24 24 25 bool status; 26 25 27 psAssert(config, "Require config"); 26 28 psAssert(view, "Require config"); … … 28 30 29 31 // 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? 31 33 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"); 32 40 33 41 // Input sources … … 67 75 } 68 76 69 // XXX put in recipe70 float radius = 20.0; // radius in pixels71 72 77 // Match the sources to both inSources and refSources. We want to find the closest source 73 78 // in the positive source lists to each source in the diff source list. 74 79 // XXX we need to either (a) apply S/N and other filters before we pass the in/ref sources 75 80 // 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); 78 83 79 84 // now mark or flag the sources with matches that meet some criterion … … 160 165 # define NEXT1 { i++; continue; } 161 166 # define NEXT2 { j++; continue; } 162 bool ppSubMatchSources (psArray *objects, psArray *sources, float RADIUS ) {167 bool ppSubMatchSources (psArray *objects, psArray *sources, float RADIUS, float MIN_SN) { 163 168 164 169 float dx, dy; … … 172 177 // match sources to existing objects 173 178 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); 175 180 176 181 int nMatch = 0; … … 186 191 if (!finite(src->peak->xf)) NEXT1; 187 192 if (!finite(src->peak->yf)) NEXT1; 193 if (!finite(src->peak->SN)) NEXT1; 194 if (src->peak->SN < MIN_SN) NEXT1; 188 195 189 196 if (!obj) NEXT2; … … 198 205 int Imin = -1; 199 206 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++) { 201 208 202 209 src = sources->data[I]; 203 210 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 204 218 dx = src->peak->xf - obj->x; 205 219 dy = src->peak->yf - obj->y; … … 210 224 Rmin = dr; 211 225 Imin = I; 226 // fprintf (stderr, "j: %d, I: %d, Imin: %d, dr: %f, dx: %f, dy: %f\n", j, I, Imin, dr, dx, dy); 212 227 } 213 228 214 229 // no match, try next object 215 230 if (Imin == -1) { 231 // fprintf (stderr, "*** missed j: %d, Imin: %d, obj x,y: %f, %f\n", j, Imin, obj->x, obj->y); 216 232 j++; 217 233 continue; 218 234 } 219 235 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); 220 238 221 239 // add source to object
Note:
See TracChangeset
for help on using the changeset viewer.
