IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33798


Ignore:
Timestamp:
Apr 18, 2012, 9:31:56 AM (14 years ago)
Author:
eugene
Message:

fix missed-image matching code; add some timing notes

Location:
branches/eam_branches/ipp-20120405/Ohana/src/relphot/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120405/Ohana/src/relphot/src/MosaicOps.c

    r33797 r33798  
    152152}
    153153
     154# define MARKTIME(MSG,...) { \
     155  float dtime; \
     156  gettimeofday (&stopTimer, (void *) NULL); \
     157  dtime = DTIME (stopTimer, startTimer); \
     158  fprintf (stderr, MSG, __VA_ARGS__); }
     159
    154160/* find mosaic frames (unique time periods) (NOTE : we do NOT require matching photcodes...)
    155161   this function will also identify the images NOT in the subset which belong to a selected mosaic
     
    161167  char *pname;
    162168
     169  struct timeval startTimer, stopTimer;
     170
    163171  if (!MOSAIC_ZEROPT) return;
     172
     173  gettimeofday (&startTimer, (void *) NULL);
    164174
    165175  /* a 'mosaic' in relphot is (unlike relastro) a virtual concept: there is no
     
    174184  }
    175185  sort_times (startTimes, Nsubset);
     186  MARKTIME("create array of all image obstimes: %f sec\n", dtime);
    176187 
    177188  Nmosaic = 0;
     
    195206  }
    196207  Nmosaic ++;
     208  MARKTIME("create subset array of mosaic obstimes: %f sec\n", dtime);
    197209
    198210  int Nskip, Nmiss, Nmark;
     
    212224
    213225    /* 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);
    216228
    217229    /* find a matching mosaic */
     
    226238  }
    227239  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);
    228241
    229242  // now I have a list of uniq start times, and they are in order
     
    318331}
    319332
    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
    321336off_t findMosaic (unsigned int *startTimes, off_t Nmosaic, unsigned int start) {
    322337
     
    324339
    325340  // 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) {
    329349    N = 0.5*(Nlo + Nhi);
    330350    if (startTimes[N] < start) {
     
    334354    }
    335355  }
    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;
    341361  }
    342362  return (-1);
  • branches/eam_branches/ipp-20120405/Ohana/src/relphot/src/select_images.c

    r33797 r33798  
    133133  if (VERBOSE) fprintf (stderr, "finding images\n");
    134134  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);
    136136
    137137  nimage = 0;
Note: See TracChangeset for help on using the changeset viewer.