Changeset 8386 for trunk/Ohana/src/relphot
- Timestamp:
- Aug 16, 2006, 10:12:55 AM (20 years ago)
- Location:
- trunk/Ohana/src/relphot
- Files:
-
- 1 added
- 2 deleted
- 4 edited
-
Makefile (modified) (2 diffs)
-
src/gcatalog.c (deleted)
-
src/load_catalogs.c (modified) (2 diffs)
-
src/misc.c (deleted)
-
src/reload_catalogs.c (modified) (3 diffs)
-
src/relphot.c (modified) (1 diff)
-
src/sort.c (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/relphot/Makefile
r7080 r8386 28 28 $(SRC)/select_images.$(ARCH).o \ 29 29 $(SRC)/load_catalogs.$(ARCH).o \ 30 $(SRC)/gcatalog.$(ARCH).o \31 30 $(SRC)/bcatalog.$(ARCH).o \ 32 31 $(SRC)/GridOps.v2.$(ARCH).o \ … … 37 36 $(SRC)/plot_scatter.$(ARCH).o \ 38 37 $(SRC)/plotstuff.$(ARCH).o \ 39 $(SRC)/ misc.$(ARCH).o \38 $(SRC)/sort.$(ARCH).o \ 40 39 $(SRC)/reload_catalogs.$(ARCH).o \ 41 $(SRC)/image-db.$(ARCH).o \42 $(SRC)/free_catalogs.$(ARCH).o \43 40 $(SRC)/setMrelFinal.$(ARCH).o \ 44 41 $(SRC)/write_coords.$(ARCH).o \ 45 42 $(SRC)/setExclusions.$(ARCH).o \ 46 43 $(SRC)/Shutdown.$(ARCH).o \ 47 $(SRC)/SetSignals.$(ARCH).o \ 48 $(SRC)/wcatalog.$(ARCH).o 44 $(SRC)/SetSignals.$(ARCH).o 49 45 50 46 OLD = \ -
trunk/Ohana/src/relphot/src/load_catalogs.c
r8328 r8386 8 8 if (VERBOSE) fprintf (stderr, "loading catalog data\n"); 9 9 10 // XXX skip over the empty catalogs? don't add to the list?11 10 ALLOCATE (catalog, Catalog, skylist[0].Nregions); 12 11 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 15 13 for (i = 0; i < skylist[0].Nregions; i++) { 14 15 // set up the basic catalog info 16 16 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 17 20 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); 37 23 exit (1); 38 24 } 25 if (VERBOSE && !tcatalog.Nave_disk) fprintf (stderr, "no data in %s, skipping\n", tcatalog.filename); 26 27 // select only the brighter stars 39 28 bcatalog (&catalog[i], &tcatalog); 29 dvo_catalog_unlock (&tcatalog); 30 dvo_catalog_free (&tcatalog); 40 31 } 41 32 33 // XXX keep this test? 42 34 Nstar = 0; 43 35 for (i = 0; i < skylist[0].Nregions; i++) { … … 49 41 } 50 42 43 // XXX consider only returning the populated catalogs 51 44 *Ncatalog = skylist[0].Nregions; 52 45 return (catalog); 53 46 } 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 14 14 catalog.filename = skylist[0].filename[i]; 15 15 16 // XXXonly update existing db tables16 // only update existing db tables 17 17 status = stat (catalog.filename, &filestat); 18 18 if ((status == -1) && (errno == ENOENT)) { … … 20 20 continue; 21 21 } 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); 32 35 continue; 33 default:34 fprintf (stderr, "weird lock_catalog exit state %s\n", catalog.filename);35 exit (1);36 36 } 37 37 38 initImageBins (&catalog, 1); 38 39 initMosaicBins (&catalog, 1); … … 43 44 44 45 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); 47 49 48 50 freeImageBins (1); -
trunk/Ohana/src/relphot/src/relphot.c
r7080 r8386 88 88 89 89 /* at this point, we have correct cal coeffs in the image/mosaic structures */ 90 f ree_catalogs (catalog, Ncatalog);90 for (i = 0; i < Ncatalog; i++) dvo_catalog_free (&catalog[i]); 91 91 freeImageBins (Ncatalog); 92 92 freeMosaicBins (Ncatalog);
Note:
See TracChangeset
for help on using the changeset viewer.
