IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28220 for trunk


Ignore:
Timestamp:
Jun 4, 2010, 12:04:25 PM (16 years ago)
Author:
Paul Price
Message:

Catch case where all sources found in the search radius are from the image under consideration.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppTranslate/src/ppMopsMerge.c

    r28218 r28220  
    99#include "ppMops.h"
    1010
    11 #define LEAF_SIZE 4                     // Size of leaf
     11#define LEAF_SIZE 2                     // Size of leaf
    1212#define MATCH_RADIUS SEC_TO_RAD(1.0)    // Matching radius
    1313#define MJD_TOL 1.0/3600.0/24.0         // Tolerance for MJD matching
     
    1616#define POSANGLE_TOL SEC_TO_RAD(1.0)    // Tolerance for position angle matching
    1717#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
    1826
    1927// Get distance from detection to centre of image
     
    171179            psAssert(indices->n > 0, "Expect at least one match for source %d in input %d", j, i);
    172180
     181            if (indices->n == 1 && sourceMerged->data.U16[indices->data.S64[0]] == i) {
     182                // It's myself
     183                psFree(indices);
     184                continue;
     185            }
     186
    173187            // Which one do we keep?
    174188            float bestDistance = INFINITY; // Best distance to centre
     
    193207            }
    194208
    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                        }
    203225                    }
    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                }
    215231            }
    216232            psFree(indices);
Note: See TracChangeset for help on using the changeset viewer.