IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27610


Ignore:
Timestamp:
Apr 5, 2010, 3:47:10 PM (16 years ago)
Author:
eugene
Message:

fixing avmatch

Location:
trunk/Ohana/src/opihi/dvo
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/avmatch.c

    r27594 r27610  
    8383    if ((vec[i] = SelectVector (name, ANYVECTOR, TRUE)) == NULL) goto escape;
    8484    ResetVector (vec[i], fields[i].type, NPTS);
     85    for (n = 0; n < vec[i][0].Nelements; n++) {
     86      if (vec[i][0].type == OPIHI_FLT) {
     87        vec[i][0].elements.Flt[n] = NAN;
     88      } else {
     89        vec[i][0].elements.Int[n] = 0; // or NAN_INT?
     90      }
     91    }
    8592  }
    8693  ALLOCATE (index, off_t, NPTS);
     
    103110    }
    104111    dvo_catalog_unlock (&catalog);  /// we can unlock here since this is read-only (do not block other access)
     112    if (catalog.Naverage == 0) {
     113      dvo_catalog_free (&catalog);
     114      continue;
     115    }
    105116
    106117    find_matches_by_vectors (skylist[0].regions[i], &catalog, RAvec, DECvec, RADIUS, index);
     
    111122
    112123      if (Ncat == -1) continue;
    113       if (Ncat == -2) {
    114         for (n = 0; n < Nfields; n++) {
    115           if (vec[n][0].type == OPIHI_FLT) {
    116             vec[n][0].elements.Flt[Npts] = NAN;
    117           } else {
    118             vec[n][0].elements.Int[Npts] = 0; // or NAN_INT?
    119           }
    120         }
    121         continue;
    122       }
     124      if (Ncat == -2) continue;
     125
    123126      // XXX set a 'found' vector to double check we catch everything?
    124127      m = catalog.average[Ncat].measureOffset;
     
    148151  dbFreeFields (fields, Nfields);
    149152  SkyListFree (skylist);
    150   dvo_catalog_free (&catalog);
    151153  return (TRUE);
    152154
     
    156158  dbFreeFields (fields, Nfields);
    157159  SkyListFree (skylist);
    158   dvo_catalog_free (&catalog);
    159160  return (FALSE);
    160161
  • trunk/Ohana/src/opihi/dvo/find_matches.c

    r27594 r27610  
    77int find_matches_by_vectors (SkyRegion *region, Catalog *catalog, Vector *RAvec, Vector *DECvec, float RADIUS, off_t *index) {
    88
    9   off_t i, j, J, Jmin, n, N, Npoints;
     9  off_t i, j, J, Jmin, Npoints, Nmatch;
    1010  off_t *N1, *N2;
    1111  double *X1, *Y1, *X2, *Y2;
     
    1616  Coords tcoords;
    1717
    18   assert(catalog[0].sorted);
     18  // XXX dvoconvert does not correctly maintain 'sorted'
     19  // assert(catalog[0].sorted);
    1920
    2021  Npoints = RAvec->Nelements;
     22  Nmatch = 0;
    2123
    2224  /** allocate local arrays (points) **/
     
    8082  RADIUS2 = RADIUS*RADIUS;
    8183
    82 # define NEXTi { i++; continue; }                                                                                                                                               
    83 # define NEXTj { j++; continue; }                                                                                                                                               
     84# define NEXTi { i++; continue; }
     85# define NEXTj { j++; continue; }
    8486                                                                                                                                                                                 
    8587  /** find matched stars **/
    8688  for (i = j = 0; (i < Npoints) && (j < Nave); ) {
    87     if (index[i] == -1) NEXTi;
     89    if (index[N1[i]] == -1) NEXTi;
    8890    if (!finite(X1[i]) || !finite(Y1[i])) NEXTi;
    8991    if (!finite(X2[j]) || !finite(Y2[j])) NEXTj;
     
    112114
    113115    /* no match, try next detection */
    114     if (Jmin == -1) NEXTi;
     116    if (Jmin == -1) {
     117      NEXTi;
     118    }
    115119
    116120    /*** a match is found, set the index for this entry ***/
    117     n = N2[Jmin];
    118     N = N1[i];
    119     index[N] = n;
     121    index[N1[i]] = N2[Jmin];
     122
     123    Nmatch ++;
    120124
    121125    NEXTi;
  • trunk/Ohana/src/opihi/dvo/skyregion.c

    r27594 r27610  
    140140    }
    141141  }
     142  list[0].Nregions = Nout;
    142143
    143144  free (found);
Note: See TracChangeset for help on using the changeset viewer.