Changeset 26283
- Timestamp:
- Nov 27, 2009, 1:07:41 PM (16 years ago)
- Location:
- trunk/Ohana/src/addstar/src
- Files:
-
- 4 edited
-
find_matches.c (modified) (3 diffs)
-
find_matches_closest.c (modified) (2 diffs)
-
find_matches_closest_refstars.c (modified) (2 diffs)
-
find_matches_refstars.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/src/find_matches.c
r26277 r26283 115 115 /* negative dX: j is too large */ 116 116 dX = X1[i] - X2[j]; 117 if (dX <= - 2*RADIUS) {117 if (dX <= -1.02*RADIUS) { 118 118 i++; 119 119 continue; 120 120 } 121 121 /* positive dX, i is too large */ 122 if (dX >= 2*RADIUS) {122 if (dX >= 1.02*RADIUS) { 123 123 j++; 124 124 continue; … … 126 126 127 127 /* within match range; look for matches */ 128 for (J = j; (dX > - 2*RADIUS) && (J < Nave); J++) {128 for (J = j; (dX > -1.02*RADIUS) && (J < Nave); J++) { 129 129 dX = X1[i] - X2[J]; 130 130 dY = Y1[i] - Y2[J]; 131 131 dR = dX*dX + dY*dY; 132 132 if (dR > RADIUS2) continue; 133 134 /*** a match is found, add to average, measure ***/ 135 Nmatch ++; 136 n = N2[J]; 137 N = N1[i]; 133 138 134 139 /* make sure there is space for next entry */ … … 138 143 REALLOCATE (catalog[0].measure, Measure, NMEAS); 139 144 } 140 141 Nmatch ++;142 n = N2[J];143 N = N1[i];144 145 145 146 /* add to end of measurement list */ -
trunk/Ohana/src/addstar/src/find_matches_closest.c
r26277 r26283 148 148 149 149 /*** a match is found, add to average, measure ***/ 150 Nmatch ++; 151 n = N2[Jmin]; 152 N = N1[i]; 150 153 151 154 /* make sure there is space for next entry */ … … 155 158 REALLOCATE (catalog[0].measure, Measure, NMEAS); 156 159 } 157 158 Nmatch ++;159 n = N2[Jmin];160 N = N1[i];161 160 162 161 /* add to end of measurement list */ -
trunk/Ohana/src/addstar/src/find_matches_closest_refstars.c
r26280 r26283 152 152 } 153 153 154 /*** a match is found, add to average, measure ***/ 155 Nmatch ++; 156 n = N2[Jmin]; 157 N = N1[i]; 158 159 /** in replace mode, search for entry and replace values M, dM, R, D */ 160 // XXX this fails for unsorted catalogs, right? 161 if (options.replace && replace_match (&catalog[0].average[n], catalog[0].measure, stars[N])) continue; 162 154 163 /* make sure there is space for next entry */ 155 164 if (Nmeas >= NMEAS) { … … 158 167 REALLOCATE (catalog[0].measure, Measure, NMEAS); 159 168 } 160 161 /*** a match is found, add to average, measure ***/162 Nmatch ++;163 n = N2[Jmin];164 N = N1[i];165 166 /** in replace mode, search for entry and replace values M, dM, R, D */167 // XXX this fails for unsorted catalogs, right?168 if (options.replace && replace_match (&catalog[0].average[n], catalog[0].measure, stars[N])) continue;169 169 170 170 /* add to end of measurement list */ -
trunk/Ohana/src/addstar/src/find_matches_refstars.c
r26279 r26283 38 38 39 39 Nmatch = 0; 40 Nmeas = catalog[0].Nmeasure; 41 NMEAS = Nmeas + 1000; 42 ALLOCATE (next_meas, int, NMEAS); 43 REALLOCATE (catalog[0].measure, Measure, NMEAS); 40 NMEAS = Nmeas = catalog[0].Nmeasure; 44 41 45 42 // current max obj ID for this catalog … … 91 88 // XXX could use NREFSTAR_GROUP to do this match more quicky 92 89 for (i = j = 0; (i < Nstars) && (j < Nave); ) { 90 if (!finite(X1[i]) || !finite(Y1[i])) { 91 i++; 92 continue; 93 } 94 if (!finite(X2[j]) || !finite(Y2[j])) { 95 j++; 96 continue; 97 } 93 98 94 99 dX = X1[i] - X2[j]; 95 if (dX <= - 2*RADIUS) {100 if (dX <= -1.02*RADIUS) { 96 101 i++; 97 102 continue; 98 103 } 99 if (dX >= 2*RADIUS) {104 if (dX >= 1.02*RADIUS) { 100 105 j++; 101 106 continue; … … 103 108 104 109 /* negative dX: j is too large, positive dX, i is too large */ 105 for (J = j; (dX > - 2*RADIUS) && (J < Nave); J++) {110 for (J = j; (dX > -1.02*RADIUS) && (J < Nave); J++) { 106 111 dX = X1[i] - X2[J]; 107 112 dY = Y1[i] - Y2[J]; … … 109 114 if (dR > RADIUS2) continue; 110 115 116 /*** a match is found, add to average, measure ***/ 111 117 Nmatch ++; 112 118 n = N2[J]; … … 115 121 /** in replace mode, search for entry and replace values M, dM, R, D */ 116 122 if (options.replace && replace_match (&catalog[0].average[n], catalog[0].measure, stars[N])) continue; 123 124 if (Nmeas == NMEAS) { 125 NMEAS = Nmeas + 1000; 126 REALLOCATE (next_meas, int, NMEAS); 127 REALLOCATE (catalog[0].measure, Measure, NMEAS); 128 } 117 129 118 130 /* add to end of measurement list */ … … 127 139 catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N][0].average.R); 128 140 catalog[0].measure[Nmeas].dD = 3600.0*(catalog[0].average[n].D - stars[N][0].average.D); 141 catalog[0].measure[Nmeas].dbFlags = 0; 142 catalog[0].measure[Nmeas].averef = n; 143 catalog[0].measure[Nmeas].objID = catalog[0].average[n].objID; 144 catalog[0].measure[Nmeas].catID = catalog[0].catID; 129 145 130 146 // rationalize dR: … … 139 155 catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N][0].average.R); 140 156 } 141 142 catalog[0].measure[Nmeas].averef = n;143 catalog[0].measure[Nmeas].dbFlags = 0;144 catalog[0].measure[Nmeas].objID = catalog[0].average[n].objID;145 catalog[0].measure[Nmeas].catID = catalog[0].catID;146 157 147 158 catalog[0].measure[Nmeas].t = (TIMEREF == 0) ? stars[N][0].measure.t : TIMEREF; /** careful : time_t vs e_time **/ … … 181 192 catalog[0].average[n].Nmeasure ++; 182 193 Nmeas ++; 183 if (Nmeas == NMEAS) { 184 NMEAS = Nmeas + 1000; 185 REALLOCATE (next_meas, int, NMEAS); 186 REALLOCATE (catalog[0].measure, Measure, NMEAS); 187 } 188 189 update_coords (&catalog[0].average[n], &catalog[0].measure[0], next_meas); 194 195 // update_coords (&catalog[0].average[n], &catalog[0].measure[0], next_meas); 190 196 } 191 197 i++; … … 201 207 202 208 for (i = 0; (i < Nstars) && !options.only_match; i+=NREFSTAR_GROUP) { 209 if (Nmeas >= NMEAS - NREFSTAR_GROUP) { 210 NMEAS = Nmeas + 1000; 211 REALLOCATE (next_meas, int, NMEAS); 212 REALLOCATE (catalog[0].measure, Measure, NMEAS); 213 } 214 if (Nave == NAVE) { 215 NAVE = Nave + 1000; 216 REALLOCATE (catalog[0].average, Average, NAVE); 217 REALLOCATE (catalog[0].secfilt, SecFilt, NAVE*catalog[0].Nsecfilt); 218 } 219 203 220 N = N1[i]; 204 221 if (stars[N][0].found > -1) continue; 222 if (!IN_REGION (stars[N][0].average.R, stars[N][0].average.D)) continue; 205 223 206 224 catalog[0].average[Nave].R = stars[N][0].average.R; … … 272 290 273 291 stars[N][0].found = Nmeas; 292 next_meas[Nmeas] = -1; 274 293 Nmeas ++; 275 if (Nmeas == NMEAS) { 276 NMEAS = Nmeas + 1000; 277 REALLOCATE (next_meas, int, NMEAS); 278 REALLOCATE (catalog[0].measure, Measure, NMEAS); 279 } 280 } 281 294 } 282 295 Nave ++; 283 if (Nave == NAVE) {284 NAVE = Nave + 1000;285 REALLOCATE (catalog[0].average, Average, NAVE);286 REALLOCATE (catalog[0].secfilt, SecFilt, NAVE*catalog[0].Nsecfilt);287 }288 296 } 289 297
Note:
See TracChangeset
for help on using the changeset viewer.
