IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5239


Ignore:
Timestamp:
Oct 7, 2005, 3:00:23 PM (21 years ago)
Author:
eugene
Message:

finished basic update concept, added libdvo support

Location:
trunk/Ohana/src/addstar
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/Makefile

    r5229 r5239  
    1717
    1818INCS    =       -I$(INC) -I$(LINC) -I$(XINC)
    19 LIBS    =       -L$(LLIB) -lohana -lFITS -lz -lm
     19LIBS    =       -L$(LLIB) -ldvo -lFITS -lohana -lz -lm
    2020CFLAGS  =       $(INCS) -g
    2121LFLAGS  =       $(LIBS)
  • trunk/Ohana/src/addstar/doc/Changes.txt

    r5234 r5239  
     1
     22005.10.07
     3
     4        I have finished the basic implementation of the update mode.
     5        I have been able to demonstrate substantial improvements in
     6        speed when the number of existing measurements dominates the
     7        total number of measurements and the number of averages is
     8        typically small compared to the number of measurements (ie,
     9        most objects are real, detected in most images, and each new
     10        image supplies many new measurements of objects which exist
     11        and not many of objects which don't exist already).  The speed
     12        gain is significant in this context because the average table
     13        is small compared to the measure table; since both update and
     14        full-load methods require the complete average table, there is
     15        no difference in the load time for the average table. 
     16
     17        I was having some memory collision problems, and attempting to
     18        use the ohana_allocate functions reminded me that the libFITS
     19        functions were not supported under ohana_allocate.  This was
     20        unhelpful.  I bit the bullet and split libohana into libohana
     21        (base functions only, including ohana_allocate) and libdvo
     22        (functions based on the libautocode structures).  Doing this
     23        allowed me to make libFITS depend on libohana (including
     24        ohana_allocate).  BUT, this forced me to change all LDFLAGS
     25        entries in ohana to swap -lohana -lFITS for -lFITS -lohana,
     26        and to add include <fitsio.h> in some cases.
    127
    2282005.10.06
  • trunk/Ohana/src/addstar/include/addstar.h

    r5234 r5239  
    189189int *init_measure_links (Average *average, int Naverage, Measure *measure, int Nmeasure);
    190190int *init_missing_links (Average *average, int Naverage, Missing *missing, int Nmissing);
    191 int add_meas_link (Average *average, int *next, int Nmeasure);
     191int add_meas_link (Average *average, int *next, int Nmeasure, int NMEASURE);
    192192int add_miss_link (Average *average, int *next, int Nmissing);
    193193int *build_measure_links (Average *average, int Naverage, Measure *measure, int Nmeasure);
  • trunk/Ohana/src/addstar/src/addstar.c

    r5229 r5239  
    33int main (int argc, char **argv) {
    44
     5  int Nm, Na, Ns;
    56  int i, Nstars, Noverlap, Nregions, Nsubset, Naverage, Nmeasure;
    67  Stars *stars, **subset;
     
    1112
    1213  double dtime;
    13   struct timeval start, stop;
     14  struct timeval start, stop, t1, t2;
    1415
    1516  gettimeofday (&start, NULL);
     
    2829  /* we use the image table to lock db access -- perhaps this is not necessary?*/
    2930  lock_image_db (&db, ImageCat);
     31  gettimeofday (&stop, NULL);
     32  dtime = DTIME (stop, start);
     33  fprintf (stderr, "mark: lock_image_db: time %9.4f sec\n", dtime);
    3034
    3135  switch (MODE) {
     
    5155  if (VERBOSE) fprintf (stderr, "writing to %d regions\n", Nregions);
    5256
     57  gettimeofday (&stop, NULL);
     58  dtime = DTIME (stop, start);
     59  fprintf (stderr, "mark: gstars: time %9.4f sec\n", dtime);
     60
    5361  Naverage = Nmeasure = 0;
    5462  for (i = 0; i < Nregions; i++) {
     63
     64    gettimeofday (&t1, NULL);
     65
    5566    if (!load_pt_catalog (&catalog, &regions[i])) continue;
     67    Nm = catalog.Nmeasure + catalog.Nmeas_off;
     68    Na = catalog.Naverage;
     69    Ns = Nstars;
     70
     71    gettimeofday (&t2, NULL);
     72    dtime = DTIME (t2, t1);
     73    fprintf (stderr, "load time %9.4f sec for %5d stars, %6d average, %7d measure\n", dtime, Ns, Na, Nm);
    5674
    5775    Naverage += catalog.Naverage;
    5876    Nmeasure += catalog.Nmeasure;
     77
     78    gettimeofday (&t1, NULL);
    5979
    6080    switch (MODE) {
     
    7595      break;
    7696    }
     97
     98    gettimeofday (&t2, NULL);
     99    dtime = DTIME (t2, t1);
     100    fprintf (stderr, "match time %9.4f sec for %5d stars, %6d average, %7d measure\n", dtime, Ns, Na, Nm);
     101
     102    gettimeofday (&t1, NULL);
     103
    77104    if (Nsubset == 0) {
    78105      unlock_catalog (&catalog);
     
    80107      save_pt_catalog (&catalog);
    81108    }
     109
     110    gettimeofday (&t2, NULL);
     111    dtime = DTIME (t2, t1);
     112    fprintf (stderr, "save time %9.4f sec for %5d stars, %6d average, %7d measure\n", dtime, Ns, Na, Nm);
     113
    82114  }
     115
     116  gettimeofday (&stop, NULL);
     117  dtime = DTIME (stop, start);
     118  fprintf (stderr, "mark: match: time %9.4f sec\n", dtime);
    83119
    84120  if (CALIBRATE) { FindCalibration (&image); }
     
    102138  gettimeofday (&stop, NULL);
    103139  dtime = DTIME (stop, start);
    104   fprintf (stderr, "SUCCESS: elapsed time %8.3f sec for %5d stars, %6d average, %7d measure\n", dtime, Nstars, Naverage, Nmeasure);
     140  fprintf (stderr, "SUCCESS: elapsed time %9.4f sec for %5d stars, %6d average, %7d measure\n", dtime, Nstars, Naverage, Nmeasure);
    105141  exit (0);
    106142}
  • trunk/Ohana/src/addstar/src/build_links.c

    r5234 r5239  
    11# include "addstar.h"
    22
    3 /* build the initial links assuming the table is sorted */
     3/* build the initial links assuming the table is sorted,
     4   not partial, and has a correct set of average[].offset,Nm values */
    45int *init_measure_links (Average *average, int Naverage, Measure *measure, int Nmeasure) {
    56
     
    1314    for (j = 0; j < average[i].Nm - 1; j++, N++) {
    1415      next[N] = N + 1;
     16      if (N >= Nmeasure) {
     17        fprintf (stderr, "WARNING: N out of bounds (1)\n");
     18      }
    1519    }
    1620    next[N] = -1;
     21    if (N >= Nmeasure) {
     22      fprintf (stderr, "WARNING: N out of bounds (2)\n");
     23    }
     24
    1725    if (N >= Nmeasure) {
    1826      fprintf (stderr, "overflow in init_measure_links\n");
     
    4957}
    5058
    51 int add_meas_link (Average *average, int *next, int Nmeasure) {
     59/* average[].offset, average[].Nm are valid within an addstar run */
     60int add_meas_link (Average *average, int *next, int Nmeasure, int NMEASURE) {
    5261
    5362  int k, m;
    5463
     64  /* if we have trouble, check validity of next[m] : m < Nmeasure */
    5565  m = average[0].offset; 
    56   for (k = 0; k < average[0].Nm - 1; k++) m = next[m];
     66
     67  for (k = 0; k < average[0].Nm - 1; k++)  {
     68    m = next[m];
     69    if (m >= NMEASURE) {
     70      fprintf (stderr, "WARNING: m out of bounds (3)\n");
     71    }
     72  }
     73
    5774  /* set up references */
    5875  next[Nmeasure] = -1;
    59   next[m] = Nmeasure;
     76  if (Nmeasure >= NMEASURE) {
     77    fprintf (stderr, "WARNING: Nmeasure out of bounds (1)\n");
     78  }
     79
     80  if (m == -1) {
     81    average[0].offset = Nmeasure;
     82  } else {
     83    next[m] = Nmeasure;
     84    if (m >= NMEASURE) {
     85      fprintf (stderr, "WARNING: m out of bounds (4)\n");
     86    }
     87  }
     88
    6089  return (TRUE);
    6190}
     
    80109}
    81110
     111/* construct measure links which are valid FOR THIS LOAD
     112 * - if we have a full load, we will get links which can
     113 *   be used by other programs (eg, relphot, etc)
     114 * - if we have a partial load, the links are only valid
     115 *   for that partial load
     116 */
     117
    82118int *build_measure_links (Average *average, int Naverage, Measure *measure, int Nmeasure) {
    83119
    84   int m, k, Nm, averef;
     120  int i, m, k, Nm, averef;
    85121  int *next;
    86122
    87123  ALLOCATE (next, int, Nmeasure);
    88124
     125  /* reset the Nm, offset values for average */
     126  for (i = 0; i < Naverage; i++) {
     127    average[i].offset = -1;
     128    average[i].Nm     =  0;
     129  }
     130
    89131  for (Nm = 0; Nm < Nmeasure; Nm++) {
    90     next[Nm] = -1;
    91132    averef = measure[Nm].averef;
    92133    m = average[averef].offset; 
     134    next[Nm] = -1;
     135
     136    if (m == -1) { /* no links yet for source */
     137      average[averef].offset = Nm;
     138      average[averef].Nm     = 1;
     139      continue;
     140    }
     141
    93142    for (k = 0; next[m] != -1; k++) {
    94143      m = next[m];
    95     }
    96     if (m == Nm) {
    97       average[averef].Nm = k + 1;
    98     } else {
    99       average[averef].Nm = k + 2;
    100       next[m] = Nm;
     144      if (m >= Nmeasure) {
     145        fprintf (stderr, "WARNING: m out of bounds (1)\n");
     146      }
     147    }
     148
     149    average[averef].Nm = k + 2;
     150    next[m] = Nm;
     151    if (m >= Nmeasure) {
     152      fprintf (stderr, "WARNING: m out of bounds (2)\n");
    101153    }
    102154  }
  • trunk/Ohana/src/addstar/src/find_matches.c

    r5234 r5239  
    88  float dX, dY, dR;
    99  int *N1, *N2,  *next_meas, *next_miss;
    10   int Nave, NAVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch, offset;
     10  int Nave, NAVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch;
    1111  Coords tcoords;
    1212  int Nsecfilt, Nsec;
     
    4141  NMEAS = Nmeas = catalog[0].Nmeasure;
    4242  NMISS = Nmiss = catalog[0].Nmissing;
    43   offset = catalog[0].Nmeas_off;
    4443 
    4544  /* project onto rectilinear grid with 1 arcsec pixels */
     
    130129
    131130      /* add to end of measurement list */
    132       add_meas_link (&catalog[0].average[n], next_meas, Nmeas);
     131      add_meas_link (&catalog[0].average[n], next_meas, Nmeas, NMEAS);
    133132
    134133      /* calculate accurate per-star airmass */
     
    253252    catalog[0].average[Nave].Xm        = NO_MAG;
    254253    catalog[0].average[Nave].Xg        = NO_MAG;
    255     catalog[0].average[Nave].offset    = Nmeas + offset;   /* this needs to be an absolute reference */
     254    catalog[0].average[Nave].offset    = Nmeas;
    256255    catalog[0].average[Nave].missing   = -1;
    257256    catalog[0].average[Nave].code      = 0;
     
    317316  REALLOCATE (catalog[0].missing, Missing, Nmiss);
    318317 
    319   /* XXX EAM - temporary examination of next_meas
    320   for (i = 0; i < 5; i++) {
    321     m = catalog[0].average[i].offset;
    322     for (j = 0; j < catalog[0].average[i].Nm; j++) {
    323       fprintf (stderr, "this: %d (%f), next: %d\n", m, catalog[0].measure[m].M_PS, next_meas[m]);
    324       m = next_meas[m];
    325     }
    326   } */
    327 
    328318  if (NOSORT) {
    329319    catalog[0].sorted = FALSE;
  • trunk/Ohana/src/addstar/src/find_matches_closest.c

    r5234 r5239  
    88  float dX, dY, dR;
    99  int *N1, *N2,  *next_meas, *next_miss;
    10   int Nave, NAVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch, offset;
     10  int Nave, NAVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch;
    1111  Coords tcoords;
    1212  int Nsecfilt, Nsec;
     
    4141  NMEAS = Nmeas = catalog[0].Nmeasure;
    4242  NMISS = Nmiss = catalog[0].Nmissing;
    43   offset = catalog[0].Nmeas_off;
    4443 
    4544  /* project onto rectilinear grid with 1 arcsec pixels */
     
    145144
    146145    /* add to end of measurement list */
    147     add_meas_link (&catalog[0].average[n], next_meas, Nmeas);
     146    add_meas_link (&catalog[0].average[n], next_meas, Nmeas, NMEAS);
     147    ohana_memcheck (0);
    148148       
    149149    /* calculate accurate per-star airmass, if required */
     
    192192    Nmeas ++;
    193193    i++;
    194   }
    195 
     194    ohana_memcheck (0);
     195  }
    196196  ohana_memcheck (0);
    197197
     
    250250    catalog[0].average[Nave].Xm        = NO_MAG;
    251251    catalog[0].average[Nave].Xg        = NO_MAG;
    252     catalog[0].average[Nave].offset    = Nmeas + offset;
     252    catalog[0].average[Nave].offset    = Nmeas;
    253253    catalog[0].average[Nave].missing   = -1;
    254254    catalog[0].average[Nave].code      = 0;
     
    314314  REALLOCATE (catalog[0].missing, Missing, Nmiss);
    315315 
    316   /* XXX EAM - temporary examination of next_meas
    317   for (i = 0; i < 5; i++) {
    318     m = catalog[0].average[i].offset;
    319     for (j = 0; j < catalog[0].average[i].Nm; j++) {
    320       fprintf (stderr, "this: %d (%f), next: %d\n", m, catalog[0].measure[m].M_PS, next_meas[m]);
    321       m = next_meas[m];
    322     }
    323   } */
    324 
    325316  if (NOSORT) {
    326317    catalog[0].sorted = FALSE;
  • trunk/Ohana/src/addstar/src/replace_match.c

    r4865 r5239  
    1414    measure[i].M_PS        = MIN (star[0].M,  NO_MAG);
    1515    measure[i].dM_PS       = MIN (star[0].dM, NO_ERR);
    16     star[0].found      = average[0].offset + i;
     16    star[0].found          = average[0].offset + i;
    1717    return (TRUE);
    1818  }
  • trunk/Ohana/src/addstar/src/update_coords.c

    r4800 r5239  
    1212  if (average[0].Nm < 2) return;
    1313
    14   /* find the average & sum-square */
     14  /* find the average & sum-square (does not use reference coordinates) */
    1515  m = average[0].offset;  /* first measurement of this star */
    1616  for (i = 0; i < average[0].Nm; i++) {
Note: See TracChangeset for help on using the changeset viewer.