- Timestamp:
- Jun 4, 2010, 12:04:25 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ppTranslate/src/ppMopsMerge.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppTranslate/src/ppMopsMerge.c
r28218 r28220 9 9 #include "ppMops.h" 10 10 11 #define LEAF_SIZE 4// Size of leaf11 #define LEAF_SIZE 2 // Size of leaf 12 12 #define MATCH_RADIUS SEC_TO_RAD(1.0) // Matching radius 13 13 #define MJD_TOL 1.0/3600.0/24.0 // Tolerance for MJD matching … … 16 16 #define POSANGLE_TOL SEC_TO_RAD(1.0) // Tolerance for position angle matching 17 17 #define AIRMASS_TOL 1.0e-3 // Tolerance for airmass matching 18 19 #if 0 20 #undef psTrace 21 #define psTrace(facil, level, ...) \ 22 if (level <= 5) { \ 23 fprintf(stderr, __VA_ARGS__); \ 24 } 25 #endif 18 26 19 27 // Get distance from detection to centre of image … … 171 179 psAssert(indices->n > 0, "Expect at least one match for source %d in input %d", j, i); 172 180 181 if (indices->n == 1 && sourceMerged->data.U16[indices->data.S64[0]] == i) { 182 // It's myself 183 psFree(indices); 184 continue; 185 } 186 173 187 // Which one do we keep? 174 188 float bestDistance = INFINITY; // Best distance to centre … … 193 207 } 194 208 195 float distance = mergeDistance(det, j); // Distance to centre of image 196 if (!isfinite(bestDistance) || distance < bestDistance) { 197 psTrace("ppMops.merge", 6, "New source clobbers old sources\n"); 198 for (int k = 0; k < indices->n; k++) { 199 long mergeIndex = indices->data.S64[k]; // Index of point 200 int source = sourceMerged->data.U16[mergeIndex]; // Source image 201 if (source == i) { 202 continue; 209 if (bestIndex >= 0) { 210 float distance = mergeDistance(det, j); // Distance to centre of image 211 if (bestIndex >= 0 && distance < bestDistance) { 212 psTrace("ppMops.merge", 6, "New source clobbers old sources\n"); 213 for (int k = 0; k < indices->n; k++) { 214 long mergeIndex = indices->data.S64[k]; // Index of point 215 int source = sourceMerged->data.U16[mergeIndex]; // Source image 216 if (source == i) { 217 continue; 218 } 219 long index = indexMerged->data.U32[mergeIndex]; // Index in source 220 psVector *dupes = duplicates->data[source]; // Duplicates list 221 if (!dupes->data.U8[index]) { 222 dupes->data.U8[index] = 0xFF; 223 dupNum->data.U32[source]++; 224 } 203 225 } 204 long index = indexMerged->data.U32[mergeIndex]; // Index in source 205 psVector *dupes = duplicates->data[source]; // Duplicates list 206 if (!dupes->data.U8[index]) { 207 dupes->data.U8[index] = 0xFF; 208 dupNum->data.U32[source]++; 209 } 210 } 211 } else { 212 psTrace("ppMops.merge", 6, "Old sources clobber new source\n"); 213 dupes->data.U8[j] = 0xFF; 214 dupNum->data.U32[i]++; 226 } else { 227 psTrace("ppMops.merge", 6, "Old sources clobber new source\n"); 228 dupes->data.U8[j] = 0xFF; 229 dupNum->data.U32[i]++; 230 } 215 231 } 216 232 psFree(indices);
Note:
See TracChangeset
for help on using the changeset viewer.
