IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 16, 2006, 10:12:55 AM (20 years ago)
Author:
eugene
Message:

updating to new DVO APIs

Location:
trunk/Ohana/src/relphot
Files:
1 added
2 deleted
4 edited

Legend:

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

    r7080 r8386  
    2828$(SRC)/select_images.$(ARCH).o   \
    2929$(SRC)/load_catalogs.$(ARCH).o   \
    30 $(SRC)/gcatalog.$(ARCH).o        \
    3130$(SRC)/bcatalog.$(ARCH).o        \
    3231$(SRC)/GridOps.v2.$(ARCH).o      \
     
    3736$(SRC)/plot_scatter.$(ARCH).o    \
    3837$(SRC)/plotstuff.$(ARCH).o       \
    39 $(SRC)/misc.$(ARCH).o            \
     38$(SRC)/sort.$(ARCH).o            \
    4039$(SRC)/reload_catalogs.$(ARCH).o \
    41 $(SRC)/image-db.$(ARCH).o \
    42 $(SRC)/free_catalogs.$(ARCH).o   \
    4340$(SRC)/setMrelFinal.$(ARCH).o    \
    4441$(SRC)/write_coords.$(ARCH).o    \
    4542$(SRC)/setExclusions.$(ARCH).o   \
    4643$(SRC)/Shutdown.$(ARCH).o        \
    47 $(SRC)/SetSignals.$(ARCH).o      \
    48 $(SRC)/wcatalog.$(ARCH).o
     44$(SRC)/SetSignals.$(ARCH).o     
    4945
    5046OLD = \
  • trunk/Ohana/src/relphot/src/load_catalogs.c

    r8328 r8386  
    88  if (VERBOSE) fprintf (stderr, "loading catalog data\n");
    99
    10   // XXX skip over the empty catalogs? don't add to the list?
    1110  ALLOCATE (catalog, Catalog, skylist[0].Nregions);
    1211
    13   /* load data from each region file, only use bright stars */
    14   // we use LCK_SOFT since we assume the image is locked
     12  // load data from each region file, only use bright stars
    1513  for (i = 0; i < skylist[0].Nregions; i++) {
     14
     15    // set up the basic catalog info
    1616    tcatalog.filename = skylist[0].filename[i];
     17    tcatalog.catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
     18    tcatalog.catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
     19    tcatalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_SECF; // don't need to load all data at this point
    1720
    18     tcatalog.catformat = dvo_catalog_format (CATFORMAT);  // set the default catformat from config data
    19     tcatalog.catmode   = dvo_catalog_mode (CATMODE);      // set the default catmode from config data
    20     tcatalog.lockmode  = LCK_SOFT;
    21     dvo_catalog_open (&tcatalog, skylist[0].regions[i], Nsecfilt, "r");
    22 
    23     switch (lock_catalog (&tcatalog, LCK_SOFT)) {
    24     case 0:
    25       fprintf (stderr, "ERROR: can't lock file %s\n", tcatalog.filename);
    26       exit (1);
    27     case 1:
    28       gcatalog (&tcatalog, FALSE); /* load from disk */
    29       break;
    30     case 2:
    31       if (VERBOSE) fprintf (stderr, "no data in %s, skipping\n", tcatalog.filename);
    32       tcatalog.Naverage = 0;
    33       tcatalog.Nmeasure = 0;
    34       break;
    35     default:
    36       fprintf (stderr, "weird lock_catalog exit state\n");
     21    if (!dvo_catalog_open (&tcatalog, skylist[0].regions[i], VERBOSE, "r")) {
     22      fprintf (stderr, "ERROR: failure reading catalog %s\n", tcatalog.filename);
    3723      exit (1);
    3824    }
     25    if (VERBOSE && !tcatalog.Nave_disk) fprintf (stderr, "no data in %s, skipping\n", tcatalog.filename);
     26
     27    // select only the brighter stars
    3928    bcatalog (&catalog[i], &tcatalog);
     29    dvo_catalog_unlock (&tcatalog);
     30    dvo_catalog_free (&tcatalog);
    4031  }
    4132
     33  // XXX keep this test?
    4234  Nstar = 0;
    4335  for (i = 0; i < skylist[0].Nregions; i++) {
     
    4941  }
    5042
     43  // XXX consider only returning the populated catalogs
    5144  *Ncatalog = skylist[0].Nregions;
    5245  return (catalog);
    5346}
     47
     48/* this function loads all relevant catalog files for the first pass.  it currently loads the data
     49   read only (SOFT lock) since it assumes the image table has been locked. if we go to the new
     50   addstar locking paradigm, in which the images and catalogs are updated independently, then we may
     51   need to use an XCLD lock here. 
     52*/
  • trunk/Ohana/src/relphot/src/reload_catalogs.c

    r7402 r8386  
    1414    catalog.filename = skylist[0].filename[i];
    1515
    16     // XXX only update existing db tables
     16    // only update existing db tables
    1717    status = stat (catalog.filename, &filestat);
    1818    if ((status == -1) && (errno == ENOENT)) {
     
    2020      continue;
    2121    }
    22     switch (lock_catalog (&catalog, LCK_XCLD)) {
    23       case 0: // file cannot be locked
    24         fprintf (stderr, "ERROR: can't lock file %s\n", catalog.filename);
    25         exit (1);
    26       case 1: // file is now locked
    27         gcatalog (&catalog, TRUE); /* load from disk */
    28         break;
    29       case 2: // file is empty
    30         if (VERBOSE) fprintf (stderr, "no data in file %s, skipping\n", catalog.filename);
    31         unlock_catalog (&catalog);
     22
     23    catalog.catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
     24    catalog.catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
     25    catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
     26
     27    if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "w")) {
     28      fprintf (stderr, "ERROR: failure reading catalog %s\n", catalog.filename);
     29      exit (1);
     30    }
     31    if (VERBOSE && (catalog.Nave_disk == 0)) {
     32        fprintf (stderr, "no data in %s, skipping\n", catalog.filename);
     33        dvo_catalog_unlock (&catalog);
     34        dvo_catalog_free (&catalog);
    3235        continue;
    33       default:
    34         fprintf (stderr, "weird lock_catalog exit state %s\n", catalog.filename);
    35         exit (1);
    3636    }
     37
    3738    initImageBins  (&catalog, 1);
    3839    initMosaicBins (&catalog, 1);
     
    4344
    4445    setMrelFinal (&catalog);
    45     wcatalog (&catalog);
    46     unlock_catalog (&catalog);
     46    dvo_catalog_save (&catalog, VERBOSE);
     47    dvo_catalog_unlock (&catalog);
     48    dvo_catalog_free (&catalog);
    4749
    4850    freeImageBins (1);
  • trunk/Ohana/src/relphot/src/relphot.c

    r7080 r8386  
    8888
    8989  /* at this point, we have correct cal coeffs in the image/mosaic structures */
    90   free_catalogs (catalog, Ncatalog);
     90  for (i = 0; i < Ncatalog; i++) dvo_catalog_free (&catalog[i]);
    9191  freeImageBins (Ncatalog);
    9292  freeMosaicBins (Ncatalog);
Note: See TracChangeset for help on using the changeset viewer.