Changeset 27610
- Timestamp:
- Apr 5, 2010, 3:47:10 PM (16 years ago)
- Location:
- trunk/Ohana/src/opihi/dvo
- Files:
-
- 3 edited
-
avmatch.c (modified) (5 diffs)
-
find_matches.c (modified) (4 diffs)
-
skyregion.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/avmatch.c
r27594 r27610 83 83 if ((vec[i] = SelectVector (name, ANYVECTOR, TRUE)) == NULL) goto escape; 84 84 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 } 85 92 } 86 93 ALLOCATE (index, off_t, NPTS); … … 103 110 } 104 111 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 } 105 116 106 117 find_matches_by_vectors (skylist[0].regions[i], &catalog, RAvec, DECvec, RADIUS, index); … … 111 122 112 123 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 123 126 // XXX set a 'found' vector to double check we catch everything? 124 127 m = catalog.average[Ncat].measureOffset; … … 148 151 dbFreeFields (fields, Nfields); 149 152 SkyListFree (skylist); 150 dvo_catalog_free (&catalog);151 153 return (TRUE); 152 154 … … 156 158 dbFreeFields (fields, Nfields); 157 159 SkyListFree (skylist); 158 dvo_catalog_free (&catalog);159 160 return (FALSE); 160 161 -
trunk/Ohana/src/opihi/dvo/find_matches.c
r27594 r27610 7 7 int find_matches_by_vectors (SkyRegion *region, Catalog *catalog, Vector *RAvec, Vector *DECvec, float RADIUS, off_t *index) { 8 8 9 off_t i, j, J, Jmin, n, N, Npoints;9 off_t i, j, J, Jmin, Npoints, Nmatch; 10 10 off_t *N1, *N2; 11 11 double *X1, *Y1, *X2, *Y2; … … 16 16 Coords tcoords; 17 17 18 assert(catalog[0].sorted); 18 // XXX dvoconvert does not correctly maintain 'sorted' 19 // assert(catalog[0].sorted); 19 20 20 21 Npoints = RAvec->Nelements; 22 Nmatch = 0; 21 23 22 24 /** allocate local arrays (points) **/ … … 80 82 RADIUS2 = RADIUS*RADIUS; 81 83 82 # define NEXTi { i++; continue; } 83 # define NEXTj { j++; continue; } 84 # define NEXTi { i++; continue; } 85 # define NEXTj { j++; continue; } 84 86 85 87 /** find matched stars **/ 86 88 for (i = j = 0; (i < Npoints) && (j < Nave); ) { 87 if (index[ i] == -1) NEXTi;89 if (index[N1[i]] == -1) NEXTi; 88 90 if (!finite(X1[i]) || !finite(Y1[i])) NEXTi; 89 91 if (!finite(X2[j]) || !finite(Y2[j])) NEXTj; … … 112 114 113 115 /* no match, try next detection */ 114 if (Jmin == -1) NEXTi; 116 if (Jmin == -1) { 117 NEXTi; 118 } 115 119 116 120 /*** 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 ++; 120 124 121 125 NEXTi; -
trunk/Ohana/src/opihi/dvo/skyregion.c
r27594 r27610 140 140 } 141 141 } 142 list[0].Nregions = Nout; 142 143 143 144 free (found);
Note:
See TracChangeset
for help on using the changeset viewer.
