Changeset 33798
- Timestamp:
- Apr 18, 2012, 9:31:56 AM (14 years ago)
- Location:
- branches/eam_branches/ipp-20120405/Ohana/src/relphot/src
- Files:
-
- 2 edited
-
MosaicOps.c (modified) (9 diffs)
-
select_images.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20120405/Ohana/src/relphot/src/MosaicOps.c
r33797 r33798 152 152 } 153 153 154 # define MARKTIME(MSG,...) { \ 155 float dtime; \ 156 gettimeofday (&stopTimer, (void *) NULL); \ 157 dtime = DTIME (stopTimer, startTimer); \ 158 fprintf (stderr, MSG, __VA_ARGS__); } 159 154 160 /* find mosaic frames (unique time periods) (NOTE : we do NOT require matching photcodes...) 155 161 this function will also identify the images NOT in the subset which belong to a selected mosaic … … 161 167 char *pname; 162 168 169 struct timeval startTimer, stopTimer; 170 163 171 if (!MOSAIC_ZEROPT) return; 172 173 gettimeofday (&startTimer, (void *) NULL); 164 174 165 175 /* a 'mosaic' in relphot is (unlike relastro) a virtual concept: there is no … … 174 184 } 175 185 sort_times (startTimes, Nsubset); 186 MARKTIME("create array of all image obstimes: %f sec\n", dtime); 176 187 177 188 Nmosaic = 0; … … 195 206 } 196 207 Nmosaic ++; 208 MARKTIME("create subset array of mosaic obstimes: %f sec\n", dtime); 197 209 198 210 int Nskip, Nmiss, Nmark; … … 212 224 213 225 /* set image time range */ 214 start = subset[i].tzero;215 stop = subset[i].tzero + MAX(1.01*subset[i].trate*subset[i].NY, 1);226 start = image[i].tzero; 227 stop = image[i].tzero + MAX(1.01*image[i].trate*image[i].NY, 1); 216 228 217 229 /* find a matching mosaic */ … … 226 238 } 227 239 fprintf (stderr, "%d images, %d skip, %d miss, %d mark\n", (int) Nimage, (int) Nskip, (int) Nmiss, (int) Nmark); 240 MARKTIME("find unselected images matching selected mosaics: %f sec\n", dtime); 228 241 229 242 // now I have a list of uniq start times, and they are in order … … 318 331 } 319 332 320 // use bisection to find the overlapping mosaic 333 // use bisection to find the overlapping mosaic (returns exact match) 334 // startTimes is a sorted, unique list of times 335 // start might not be in the list 321 336 off_t findMosaic (unsigned int *startTimes, off_t Nmosaic, unsigned int start) { 322 337 … … 324 339 325 340 // find the last mosaic before start 326 Nlo = 0; // startTimes[Nlo] guaranteed to be <= start 327 Nhi = Nmosaic - 1; // startTimes[Nhi] guaranteed to be >= start 328 while (Nhi - Nlo > 10) { 341 Nlo = 0; // first valid startTimes value 342 Nhi = Nmosaic - 1; // last valid startTimes value 343 344 // if start is not in this range, return -1 345 if (start < startTimes[Nlo]) return (-1); 346 if (start > startTimes[Nhi]) return (-1); 347 348 while (Nhi - Nlo > 4) { 329 349 N = 0.5*(Nlo + Nhi); 330 350 if (startTimes[N] < start) { … … 334 354 } 335 355 } 336 337 // check for the matched mosaic starting from Nlo 338 for (N = Nlo; N < Nmosaic; N++) {339 if (start > startTimes[N]) continue;340 return (N);356 // we now have : startTimes[Nlo] < start <= starTimes[Nhi] 357 358 // find a matched mosaic starting from Nlo, or return -1 359 for (N = Nlo; N <= Nhi; N++) { 360 if (startTimes[N] == start) return N; 341 361 } 342 362 return (-1); -
branches/eam_branches/ipp-20120405/Ohana/src/relphot/src/select_images.c
r33797 r33798 133 133 if (VERBOSE) fprintf (stderr, "finding images\n"); 134 134 BuildChipMatch (timage, Ntimage); 135 MARKTIME("build chip match : %f sec\n", dtime);135 MARKTIME("build chip match for %d images: %f sec\n", (int) Ntimage, dtime); 136 136 137 137 nimage = 0;
Note:
See TracChangeset
for help on using the changeset viewer.
