Changeset 8342 for trunk/Ohana/src/addstar
- Timestamp:
- Aug 14, 2006, 6:27:39 PM (20 years ago)
- Location:
- trunk/Ohana/src/addstar
- Files:
-
- 3 edited
-
Makefile (modified) (3 diffs)
-
src/addstar.c (modified) (5 diffs)
-
src/wcatalog.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/Makefile
r7780 r8342 35 35 $(SRC)/find_subset.$(ARCH).o \ 36 36 $(SRC)/fakeimage.$(ARCH).o \ 37 $(SRC)/gcatalog.$(ARCH).o \38 37 $(SRC)/get2mass.$(ARCH).o \ 39 38 $(SRC)/get2mass_as.$(ARCH).o \ … … 49 48 $(SRC)/gimages.$(ARCH).o \ 50 49 $(SRC)/gstars.$(ARCH).o \ 51 $(SRC)/image-db.$(ARCH).o \52 50 $(SRC)/in_image.$(ARCH).o \ 53 $(SRC)/load_pt_catalog.$(ARCH).o \54 51 $(SRC)/load_subpix.$(ARCH).o \ 55 $(SRC)/mkcatalog.$(ARCH).o \56 52 $(SRC)/opening_angle.$(ARCH).o \ 57 53 $(SRC)/parse_time.$(ARCH).o \ … … 61 57 $(SRC)/sort_lists.$(ARCH).o \ 62 58 $(SRC)/update_coords.$(ARCH).o \ 63 $(SRC)/wcatalog.$(ARCH).o \64 59 $(SRC)/Shutdown.$(ARCH).o \ 65 60 $(SRC)/SkyTableFromTychoIndex.$(ARCH).o \ -
trunk/Ohana/src/addstar/src/addstar.c
r8328 r8342 30 30 overlap = NULL; 31 31 set_db (&db); 32 if (options.update) {33 catalog.catflags = LOAD_AVES | LOAD_MEAS_META | LOAD_MISS | LOAD_SECF;34 } else {35 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;36 }37 32 38 33 /* we use the image table to lock db access -- perhaps this is not necessary? */ 34 db.mode = dvo_catalog_catmode (CATMODE); 35 db.format = dvo_catalog_catformat (CATFORMAT); 39 36 status = dvo_image_lock (&db, ImageCat, 3600.0, LCK_XCLD); 40 37 if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename); … … 61 58 62 59 if (db.dbstate == LCK_EMPTY) { 63 create_image_db (&db);60 dvo_image_create (&db, ZeroPt); 64 61 } else { 65 62 if (!dvo_image_load (&db, VERBOSE, FORCE_READ)) { … … 94 91 for (i = 0; i < skylist[0].Nregions; i++) { 95 92 93 // set the parameters which guide catalog open/load/create 94 catalog.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 95 catalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data 96 96 catalog.filename = skylist[0].filename[i]; 97 catalog.catformat = dvo_catalog_format (CATFORMAT); // set the default catformat from config data 98 catalog.catmode = dvo_catalog_mode (CATMODE); // set the default catmode from config data 99 catalog.lockmode = LCK_XCLD; 100 dvo_catalog_open (&catalog, skylist[0].regions[i], Nsecfilt, "w"); 97 catalog.Nsecfilt = GetPhotcodeNsecfilt (); 98 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 99 if (options.update) catalog.catflags = LOAD_AVES | LOAD_MEAS_META | LOAD_MISS | LOAD_SECF; 101 100 102 /* for only_match, skip empty catalogs XXX EAM : this leaves behind empty files */ 101 // an error exit status here is a significant error 102 if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "w")) { 103 fprintf (stderr, "ERROR: failure to open/create catalog file %s\n", catalog.filename); 104 exit (2); 105 } 106 107 // Nave_disk == 0 implies an empty catalog file 108 // for only_match, skip empty catalogs 103 109 if ((catalog.Nave_disk == 0) && options.only_match) { 104 110 dvo_catalog_unlock (&catalog); 105 free (catalog.filename); // can this be done within the dvo_catalog_free function??106 111 dvo_catalog_free (&catalog); 107 112 continue; … … 138 143 } 139 144 140 if (Nsubset == 0) { 141 // XXX remove empty catalogs 142 unlock_catalog (&catalog); 143 } else { 145 // write out catalog, if appropriate 146 if (Nsubset && !options.only_images) { 144 147 SetProtect (TRUE); 145 if (!options.only_images) dvo_catalog_save (&catalog);148 dvo_catalog_save (&catalog, VERBOSE); 146 149 SetProtect (FALSE); 147 dvo_catalog_unlock (&catalog);148 150 } 151 dvo_catalog_unlock (&catalog); 149 152 dvo_catalog_free (&catalog); 150 free (catalog.filename); // XXX ????151 153 152 154 if (options.mode == M_REFCAT) free (stars); 153 155 } 154 156 157 // XXX is it necessary to lock the image catalog during this entire process? 155 158 if (options.calibrate) { FindCalibration (&image); } 156 159 157 160 if (db.dbstate == LCK_EMPTY) { 158 create_image_db (&db); 161 if (VERBOSE) fprintf (stderr, "can't find %s, creating a new one\n", ImageCat); 162 dvo_image_create (&db, ZeroPt); 159 163 } 160 164 … … 173 177 gettimeofday (&stop, NULL); 174 178 dtime = DTIME (stop, start); 175 fprintf (stderr, "SUCCESS: elapsed time %9.4f sec for %5d stars, %6 d average, %7d measure\n", dtime, Nstars, Naverage, Nmeasure);179 fprintf (stderr, "SUCCESS: elapsed time %9.4f sec for %5d stars, %6lld average, %7lld measure\n", dtime, Nstars, Naverage, Nmeasure); 176 180 exit (0); 177 181 } -
trunk/Ohana/src/addstar/src/wcatalog.c
r8001 r8342 5 5 /* output CATMODE and CATFORMAT are set by mkcatalog 6 6 or by mode and format of existing data */ 7 8 /* should this be moved into save_catalog?? */9 gfits_modify (&catalog[0].header, "SORTED", "%t", 1, catalog[0].sorted);10 7 11 8 /* if partial load, must use update */ … … 23 20 } 24 21 25 void free_catalog (Catalog *catalog) {26 27 /* free, initialize data structures */28 if (catalog[0].average != NULL) {29 free (catalog[0].average);30 catalog[0].Naverage = 0;31 }32 if (catalog[0].measure != NULL) {33 free (catalog[0].measure);34 catalog[0].Nmeasure = 0;35 }36 if (catalog[0].missing != NULL) {37 free (catalog[0].missing);38 catalog[0].Nmissing = 0;39 }40 if (catalog[0].secfilt != NULL) {41 free (catalog[0].secfilt);42 catalog[0].Nsecfilt = 0;43 }44 gfits_free_header (&catalog[0].header);45 }
Note:
See TracChangeset
for help on using the changeset viewer.
