Changeset 8386 for trunk/Ohana
- Timestamp:
- Aug 16, 2006, 10:12:55 AM (20 years ago)
- Location:
- trunk/Ohana/src
- Files:
-
- 1 added
- 25 deleted
- 19 edited
-
addstar/src/addstar.c (modified) (3 diffs)
-
delstar/Makefile (modified) (1 diff)
-
delstar/src/RegionOps.c (deleted)
-
delstar/src/delete_imagefile.c (modified) (2 diffs)
-
delstar/src/delete_imagename.c (modified) (2 diffs)
-
delstar/src/delete_orphans.c (modified) (1 diff)
-
delstar/src/delete_times.c (modified) (1 diff)
-
delstar/src/gcatalog.c (deleted)
-
delstar/src/gregion_image.c (deleted)
-
delstar/src/gregion_patch.c (deleted)
-
delstar/src/image-db.c (deleted)
-
delstar/src/missed.c (deleted)
-
delstar/src/orphans.c (deleted)
-
delstar/src/wcatalog.c (deleted)
-
libdvo/include/dvo.h (modified) (1 diff)
-
libdvo/src/dvo_catalog.c (modified) (8 diffs)
-
libdvo/src/dvo_catalog_create.c (modified) (1 diff)
-
libdvo/src/dvo_catalog_split.c (modified) (11 diffs)
-
libdvo/src/skyregion_gsc.c (modified) (9 diffs)
-
markrock/src/aregion.c (deleted)
-
markrock/src/check_lockfile.c (deleted)
-
markrock/src/check_permissions.c (deleted)
-
markrock/src/gcatalog.c (deleted)
-
markrock/src/gregions.c (deleted)
-
markrock/src/load_gsc_data.c (deleted)
-
markrock/src/markrock.c (modified) (2 diffs)
-
markrock/src/wcatalog.c (deleted)
-
markstar/src/aregion.c (deleted)
-
markstar/src/check_lockfile.c (deleted)
-
markstar/src/check_permissions.c (deleted)
-
markstar/src/find_bright_stars.c (modified) (1 diff)
-
markstar/src/find_ghosts.c (modified) (1 diff)
-
markstar/src/gcatalog.c (deleted)
-
markstar/src/gregions.c (deleted)
-
markstar/src/load_gsc_data.c (deleted)
-
markstar/src/load_gsc_data_ghost.c (deleted)
-
markstar/src/markstar.c (modified) (3 diffs)
-
markstar/src/wcatalog.c (deleted)
-
relphot/Makefile (modified) (2 diffs)
-
relphot/src/gcatalog.c (deleted)
-
relphot/src/load_catalogs.c (modified) (2 diffs)
-
relphot/src/misc.c (deleted)
-
relphot/src/reload_catalogs.c (modified) (3 diffs)
-
relphot/src/relphot.c (modified) (1 diff)
-
relphot/src/sort.c (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/src/addstar.c
r8361 r8386 104 104 exit (2); 105 105 } 106 dvo_catalog_test (&catalog, TRUE); 106 107 107 108 // Nave_disk == 0 implies an empty catalog file … … 142 143 break; 143 144 } 145 dvo_catalog_test (&catalog, TRUE); 144 146 145 147 // write out catalog, if appropriate … … 149 151 SetProtect (FALSE); 150 152 } 153 dvo_catalog_test (&catalog, TRUE); 151 154 dvo_catalog_unlock (&catalog); 152 155 dvo_catalog_free (&catalog); -
trunk/Ohana/src/delstar/Makefile
r7393 r8386 28 28 $(SRC)/delete_times.$(ARCH).o \ 29 29 $(SRC)/gimages.$(ARCH).o \ 30 $(SRC)/gcatalog.$(ARCH).o \31 $(SRC)/wcatalog.$(ARCH).o \32 30 $(SRC)/find_image_db.$(ARCH).o \ 33 31 $(SRC)/find_matches.$(ARCH).o \ -
trunk/Ohana/src/delstar/src/delete_imagefile.c
r7080 r8386 23 23 24 24 for (i = 0; i < skylist[0].Nregions; i++) { 25 25 26 if (VERBOSE) fprintf (stderr, "deleting from %s\n", skylist[0].filename[i]); 26 27 catalog.filename = skylist[0].filename[i]; /* don't free region before catalog! */ 27 switch (lock_catalog (&catalog, LCK_XCLD)) { 28 case 0: 29 fprintf (stderr, "ERROR: can't lock file %s\n", catalog.filename); 30 exit (1); 31 case 1: 32 gcatalog (&catalog); 33 break; 34 case 2: 35 if (VERBOSE) fprintf (stderr, "no data in %s, skipping\n", catalog.filename); 36 unlock_catalog (&catalog); 37 continue; 38 default: 39 fprintf (stderr, "weird lock_catalog exit state\n"); 40 exit (1); 28 catalog.Nsecfilt = GetPhotcodeNsecfilt (); 29 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 30 31 // an error exit status here is a significant error 32 if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "u")) { 33 fprintf (stderr, "ERROR: failure to open catalog file %s\n", catalog.filename); 34 exit (2); 41 35 } 36 if (!catalog.Nave_disk) { 37 dvo_catalog_unlock (&catalog); 38 dvo_catalog_free (&catalog); 39 continue; 40 } 41 42 42 /* pad exposure time by 1 sec to require a valid time */ 43 43 /* trate is in 0.1 msec / row - stop is the latest exposure end time */ … … 46 46 stop = image[0].tzero + trange; 47 47 find_matches (&catalog, image[0].source, start, stop); 48 wcatalog (&catalog); 49 unlock_catalog (&catalog); 48 49 dvo_catalog_save (&catalog, VERBOSE); 50 dvo_catalog_unlock (&catalog); 51 dvo_catalog_free (&catalog); 50 52 } 51 53 -
trunk/Ohana/src/delstar/src/delete_imagename.c
r7080 r8386 35 35 if (VERBOSE) fprintf (stderr, "deleting from %s\n", skylist[0].filename[i]); 36 36 catalog.filename = skylist[0].filename[i]; /* don't free region before catalog! */ 37 switch (lock_catalog (&catalog, LCK_XCLD)) { 38 case 0: 39 fprintf (stderr, "ERROR: can't lock file %s\n", catalog.filename); 40 exit (1); 41 case 1: 42 gcatalog (&catalog); 43 break; 44 case 2: 45 if (VERBOSE) fprintf (stderr, "no data in %s, skipping\n", catalog.filename); 46 unlock_catalog (&catalog); 47 continue; 48 default: 49 fprintf (stderr, "weird lock_catalog exit state\n"); 50 exit (1); 37 catalog.Nsecfilt = GetPhotcodeNsecfilt (); 38 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 39 40 // an error exit status here is a significant error 41 if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "u")) { 42 fprintf (stderr, "ERROR: failure to open catalog file %s\n", catalog.filename); 43 exit (2); 44 } 45 if (!catalog.Nave_disk) { 46 dvo_catalog_unlock (&catalog); 47 dvo_catalog_free (&catalog); 48 continue; 51 49 } 52 50 … … 57 55 stop = image[j].tzero + trange; 58 56 find_matches (&catalog, image[j].source, start, stop); 59 wcatalog (&catalog); 60 unlock_catalog (&catalog); 57 58 dvo_catalog_save (&catalog, VERBOSE); 59 dvo_catalog_unlock (&catalog); 60 dvo_catalog_free (&catalog); 61 61 } 62 62 } -
trunk/Ohana/src/delstar/src/delete_orphans.c
r4607 r8386 15 15 /* find and load catalog file */ 16 16 catalog.filename = name; 17 gcatalog(&catalog);17 dvo_catalog_load (&catalog); 18 18 gcatstats (&catalog, &catstats); 19 19 -
trunk/Ohana/src/delstar/src/delete_times.c
r7080 r8386 55 55 if (VERBOSE) fprintf (stderr, "deleting from %s\n", skylist[0].filename[i]); 56 56 catalog.filename = skylist[0].filename[i]; /* don't free region before catalog! */ 57 switch (lock_catalog (&catalog, LCK_XCLD)) { 58 case 0: 59 fprintf (stderr, "ERROR: can't lock file\n"); 60 exit (1); 61 case 1: 62 gcatalog (&catalog); 63 break; 64 case 2: 65 fprintf (stderr, "no data in %s, skipping\n", catalog.filename); 66 unlock_catalog (&catalog); 67 continue; 68 default: 69 fprintf (stderr, "weird lock_catalog exit state\n"); 70 exit (1); 57 catalog.Nsecfilt = GetPhotcodeNsecfilt (); 58 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 59 60 // an error exit status here is a significant error 61 if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "u")) { 62 fprintf (stderr, "ERROR: failure to open catalog file %s\n", catalog.filename); 63 exit (2); 64 } 65 if (!catalog.Nave_disk) { 66 dvo_catalog_unlock (&catalog); 67 dvo_catalog_free (&catalog); 68 continue; 71 69 } 72 70 73 71 find_matches (&catalog, code, START, END); 74 wcatalog (&catalog); 75 unlock_catalog (&catalog); 72 dvo_catalog_save (&catalog, VERBOSE); 73 dvo_catalog_unlock (&catalog); 74 dvo_catalog_free (&catalog); 76 75 } 77 76 -
trunk/Ohana/src/libdvo/include/dvo.h
r8342 r8386 280 280 int dvo_catalog_catformat (char *catformat); 281 281 int dvo_catalog_catmode (char *catmode); 282 void dvo_catalog_test (Catalog *catalog, int halt); 282 283 283 284 /* catmode-specific APIs */ -
trunk/Ohana/src/libdvo/src/dvo_catalog.c
r8342 r8386 1 1 # include <dvo.h> 2 2 # define DEBUG 1 3 4 void dvo_catalog_test (Catalog *catalog, int halt) { 5 6 Catalog *subcat; 7 8 // fprintf (stderr, "catalog: Naverage = %d, average = %zx\n", catalog[0].Naverage, (size_t) catalog[0].average); 9 // fprintf (stderr, "catalog: Nmeasure = %d, measure = %zx\n", catalog[0].Nmeasure, (size_t) catalog[0].measure); 10 // fprintf (stderr, "catalog: Nmissing = %d, missing = %zx\n", catalog[0].Nmissing, (size_t) catalog[0].missing); 11 // fprintf (stderr, "catalog: Nsecfilt = %d, secfilt = %zx\n", catalog[0].Nsecfilt, (size_t) catalog[0].secfilt); 12 13 if (!catalog[0].measure || !catalog[0].secfilt) { 14 fprintf (stderr, "error: %s\n", catalog[0].filename); 15 if (halt) abort (); 16 } 17 18 // XXX test that things are correctly initialized 19 if (catalog[0].catmode != DVO_MODE_SPLIT) return; 20 21 subcat = catalog[0].measure_catalog; 22 if (subcat) { 23 if (subcat[0].measure_catalog || subcat[0].secfilt_catalog || subcat[0].missing_catalog) { 24 fprintf (stderr, "error in init\n"); 25 abort (); 26 } 27 } 28 subcat = catalog[0].missing_catalog; 29 if (subcat) { 30 if (subcat[0].measure_catalog || subcat[0].secfilt_catalog || subcat[0].missing_catalog) { 31 fprintf (stderr, "error in init\n"); 32 abort (); 33 } 34 } 35 subcat = catalog[0].secfilt_catalog; 36 if (subcat) { 37 if (subcat[0].measure_catalog || subcat[0].secfilt_catalog || subcat[0].missing_catalog) { 38 fprintf (stderr, "error in init\n"); 39 abort (); 40 } 41 } 42 } 3 43 4 44 int dvo_catalog_catformat (char *catformat) { … … 35 75 catalog[0].catflags = 0; 36 76 catalog[0].sorted = 0; 37 38 gfits_init_header (&catalog[0].header); 39 }77 } 78 79 gfits_init_header (&catalog[0].header); 40 80 41 81 // the following describe the catalog files on disk … … 102 142 // attempt to unlink an empty file 103 143 fd = fileno (catalog[0].f); 104 if ( fstat (fd, &filestat)) {144 if (!fstat (fd, &filestat)) { 105 145 if (filestat.st_size == 0) { 106 146 unlink (catalog[0].filename); … … 121 161 // returns FALSE if a catalog could not be opened 122 162 // returns TRUE if the catalog was empty 163 enum {DVO_OPEN_NONE, DVO_OPEN_READ, DVO_OPEN_WRITE, DVO_OPEN_UPDATE); 123 164 int dvo_catalog_open (Catalog *catalog, SkyRegion *region, int VERBOSE, char *iomode) { 124 165 125 int Nsecfilt ;126 int readonly; 127 128 readonly = -1;129 if (!strcasecmp (iomode, " r")) readonly = TRUE;130 if (!strcasecmp (iomode, " w")) readonly = FALSE;131 if ( readonly == -1) return (FALSE);166 int Nsecfilt, mode; 167 168 mode = DVO_OPEN_NONE; 169 if (!strcasecmp (iomode, "r")) mode = DVO_OPEN_READ; 170 if (!strcasecmp (iomode, "w")) mode = DVO_OPEN_WRITE; 171 if (!strcasecmp (iomode, "a")) mode = DVO_OPEN_UPDATE; 172 if (mode == DVO_OPEN_NONE) return (FALSE); 132 173 133 174 catalog[0].lockmode = LCK_XCLD; 134 if ( readonly) catalog[0].lockmode = LCK_SOFT;175 if (mode == DVO_OPEN_READ) catalog[0].lockmode = LCK_SOFT; 135 176 136 177 // XXX make a backup? always? … … 161 202 break; 162 203 case 2: 163 if ( readonly) return (TRUE);204 if (DVO_OPEN_READ || DVO_OPEN_UPDATE) return (TRUE); 164 205 dvo_catalog_create (region, catalog, Nsecfilt); /* fills in new header info */ 165 206 if (VERBOSE) fprintf (stderr, "creating new file %s\n", catalog[0].filename); … … 177 218 char measure[80]; 178 219 220 dvo_catalog_init (catalog, FALSE); 221 179 222 // load the main catalog header, determine characteristics 180 223 if (!gfits_fread_header (catalog[0].f, &catalog[0].header)) { … … 200 243 catalog[0].catformat = DVO_FORMAT_UNDEF; 201 244 202 catalog[0].average = NULL;203 catalog[0].secfilt = NULL;204 catalog[0].measure = NULL;205 catalog[0].missing = NULL;206 207 245 switch (catalog[0].catmode) { 208 246 case DVO_MODE_RAW: … … 217 255 if (VERBOSE) fprintf (stderr, "reading catalog (mode DVO_MODE_SPLIT)\n"); 218 256 dvo_catalog_load_split (catalog, VERBOSE); 257 dvo_catalog_test (catalog, TRUE); 219 258 break; 220 259 default: -
trunk/Ohana/src/libdvo/src/dvo_catalog_create.c
r8342 r8386 1 1 # include <dvo.h> 2 # define DEBUG 12 # define DEBUG 0 3 3 4 4 // create a new dvo catalog file (if split, lock extra files as well?) -
trunk/Ohana/src/libdvo/src/dvo_catalog_split.c
r8342 r8386 60 60 gfits_free_header (&header); 61 61 } 62 dvo_catalog_test (catalog, FALSE); 62 63 63 64 /*** Measure Table ***/ … … 68 69 if (catalog[0].catflags & LOAD_MEAS) { 69 70 ALLOCATE (measure, Catalog, 1); 70 measure[0].measure_catalog = NULL; 71 measure[0].missing_catalog = NULL; 72 measure[0].secfilt_catalog = NULL; 71 dvo_catalog_init (measure, TRUE); 73 72 74 73 /* get split filename from main header (paths relative to cpt file) */ … … 90 89 /* matrix should be empty */ 91 90 if (!gfits_fread_matrix (measure[0].f, &matrix, &measure[0].header)) { 92 if (VERBOSE) fprintf (stderr, "can't read primary matrix ");91 if (VERBOSE) fprintf (stderr, "can't read primary matrix\n"); 93 92 return (FALSE); 94 93 } 95 94 /* read Measure table header */ 96 95 if (!gfits_fread_header (measure[0].f, &header)) { 97 if (VERBOSE) fprintf (stderr, "can't read measure PHU header ");96 if (VERBOSE) fprintf (stderr, "can't read measure PHU header\n"); 98 97 return (FALSE); 99 98 } 100 99 /* read Measure table data */ 101 100 if (!gfits_fread_ftable_data (measure[0].f, &ftable)) { 102 if (VERBOSE) fprintf (stderr, "can't read table measure data ");101 if (VERBOSE) fprintf (stderr, "can't read table measure data\n"); 103 102 return (FALSE); 104 103 } … … 112 111 gfits_free_matrix (&matrix); 113 112 } 113 dvo_catalog_test (catalog, FALSE); 114 114 115 115 /* (Meta Load) */ 116 116 if (catalog[0].catflags & LOAD_MEAS_META) { 117 117 ALLOCATE (measure, Catalog, 1); 118 dvo_catalog_init (measure, TRUE); 118 119 119 120 /* get split filename from main header (paths relative to cpt file) */ … … 142 143 } 143 144 catalog[0].measure_catalog = measure; 145 dvo_catalog_test (catalog, FALSE); 144 146 145 147 /*** Missing Table ***/ … … 148 150 if (catalog[0].catflags & LOAD_MISS) { 149 151 ALLOCATE (missing, Catalog, 1); 150 missing[0].measure_catalog = NULL; 151 missing[0].missing_catalog = NULL; 152 missing[0].secfilt_catalog = NULL; 152 dvo_catalog_init (missing, TRUE); 153 153 154 154 /* get split filename from main header (paths relative to cpt file) */ … … 170 170 /* matrix should be empty */ 171 171 if (!gfits_fread_matrix (missing[0].f, &matrix, &missing[0].header)) { 172 if (VERBOSE) fprintf (stderr, "can't read primary matrix ");172 if (VERBOSE) fprintf (stderr, "can't read primary matrix\n"); 173 173 return (FALSE); 174 174 } 175 175 /* read Missing table header */ 176 176 if (!gfits_fread_header (missing[0].f, &header)) { 177 if (VERBOSE) fprintf (stderr, "can't read table missing header ");177 if (VERBOSE) fprintf (stderr, "can't read table missing header\n"); 178 178 return (FALSE); 179 179 } 180 180 /* read Missing table data */ 181 181 if (!gfits_fread_ftable_data (missing[0].f, &ftable)) { 182 if (VERBOSE) fprintf (stderr, "can't read table missing data ");182 if (VERBOSE) fprintf (stderr, "can't read table missing data\n"); 183 183 return (FALSE); 184 184 } … … 192 192 } 193 193 catalog[0].missing_catalog = missing; 194 dvo_catalog_test (catalog, FALSE); 194 195 195 196 /*** Secfilt Table ***/ … … 198 199 if (catalog[0].catflags & LOAD_SECF) { 199 200 ALLOCATE (secfilt, Catalog, 1); 200 secfilt[0].measure_catalog = NULL; 201 secfilt[0].missing_catalog = NULL; 202 secfilt[0].secfilt_catalog = NULL; 201 dvo_catalog_init (secfilt, TRUE); 203 202 204 203 /* get split filename from main header (paths relative to cpt file) */ … … 220 219 /* matrix should be empty */ 221 220 if (!gfits_fread_matrix (secfilt[0].f, &matrix, &secfilt[0].header)) { 222 if (VERBOSE) fprintf (stderr, "can't read primary matrix ");221 if (VERBOSE) fprintf (stderr, "can't read primary matrix\n"); 223 222 return (FALSE); 224 223 } 225 224 /* read secfilt table header */ 226 225 if (!gfits_fread_header (secfilt[0].f, &header)) { 227 if (VERBOSE) fprintf (stderr, "can't read table secfilt header ");226 if (VERBOSE) fprintf (stderr, "can't read table secfilt header\n"); 228 227 return (FALSE); 229 228 } 230 229 /* read secfilt table data */ 231 230 if (!gfits_fread_ftable_data (secfilt[0].f, &ftable)) { 232 if (VERBOSE) fprintf (stderr, "can't read table secfilt data ");231 if (VERBOSE) fprintf (stderr, "can't read table secfilt data\n"); 233 232 return (FALSE); 234 233 } … … 242 241 } 243 242 catalog[0].secfilt_catalog = secfilt; 243 dvo_catalog_test (catalog, FALSE); 244 244 245 245 /* save the current number so we can do partial updates */ -
trunk/Ohana/src/libdvo/src/skyregion_gsc.c
r8342 r8386 2 2 # define NDECBANDS 24 3 3 # define NDIV 4 4 # define DEBUG 0 4 5 5 6 static int DecLines[] = {593, 584, 551, 530, 522, 465, 406, 362, 280, 198, 123, 25, 597, 578, 574, 577, 534, 499, 442, 376, 294, 212, 144, 48}; … … 85 86 L0.regions[0].childE = NDECBANDS; 86 87 strcpy (L0.regions[0].name, "fullsky"); 87 //SkyRegionPrint (&L0.regions[0]);88 if (DEBUG) SkyRegionPrint (&L0.regions[0]); 88 89 89 90 /* allocate space for all levels */ … … 93 94 ALLOCATE (L3.regions, SkyRegion, 1); 94 95 ALLOCATE (L4.regions, SkyRegion, 1); 96 97 // skipLines = 0; 98 // for (i = 0; i < 16; i++) skipLines += DecLines[i]; 99 // for (i = 16; i < 17; i++) { 95 100 96 101 /* L1 : dec bands */ … … 107 112 L1.regions[i].table = -1; 108 113 strcpy (L1.regions[i].name, DecNames[i]); 109 //SkyRegionPrint (&L1.regions[i]);114 if (DEBUG) SkyRegionPrint (&L1.regions[i]); 110 115 111 116 /* build the L2 regions for this L1 region (based on zones) */ … … 123 128 /* subdivide each zone */ 124 129 for (j = 0; j < Nzones; j++) { 130 if (DEBUG) fprintf (stderr, "zone: %d : %f - %f : %f - %f\n", j, zones[j].Rmin, zones[j].Rmax, zones[j].Dmin, zones[j].Dmax); 125 131 SkyTableL2fromZone (&L2, &L3, &L4, band, &zones[j], i); 126 132 } … … 273 279 Dmax = MAX (regions[i].Dmax, Dmax); 274 280 dDec = regions[i].Dmax - regions[i].Dmin; 275 if ( dDec != zones[Nz].dDec) {281 if (fabs(dDec - zones[Nz].dDec) > 0.001) { 276 282 /* we've found the end of the current zone */ 277 283 zones[Nz].L3end = i; … … 347 353 *p = '/'; 348 354 strcpy (L2[0].regions[Nr].name, name); 349 //SkyRegionPrint (&L2[0].regions[Nr]);355 if (DEBUG) SkyRegionPrint (&L2[0].regions[Nr]); 350 356 351 357 /* childS and childE are set in SkyTableL3fromL2 */ … … 383 389 L3[0].regions[Nr].childE = 0; 384 390 385 //SkyRegionPrint (&L3[0].regions[Nr]);391 if (DEBUG) SkyRegionPrint (&L3[0].regions[Nr]); 386 392 /* name is set for the band in SkyRegionForDecBand */ 387 393 … … 432 438 sprintf (name, "%s.%02d", L3[0].name, Nbox); 433 439 strcpy (L4[0].regions[Nr].name, name); 434 //SkyRegionPrint (&L4[0].regions[Nr]);440 if (DEBUG) SkyRegionPrint (&L4[0].regions[Nr]); 435 441 436 442 Nr ++; -
trunk/Ohana/src/markrock/src/markrock.c
r6674 r8386 37 37 38 38 catalog.filename = argv[1]; 39 switch (lock_catalog (&catalog, LCK_XCLD)) { 40 case 0: 41 fprintf (stderr, "ERROR: can't lock file\n"); 42 exit (1); 43 case 1: 44 gcatalog (&catalog); /* load from disk */ 45 break; 46 case 2: 47 fprintf (stderr, "no data in %s, skipping\n", catalog.filename); 48 catalog.Naverage = 0; 49 catalog.Nmeasure = 0; 50 unlock_catalog (&catalog); 51 exit (0); 52 default: 53 fprintf (stderr, "weird lock_catalog exit state\n"); 54 exit (1); 39 catalog.Nsecfilt = GetPhotcodeNsecfilt (); 40 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 41 42 // an error exit status here is a significant error 43 if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "a")) { 44 fprintf (stderr, "ERROR: failure to open catalog file %s\n", catalog.filename); 45 exit (2); 46 } 47 if (catalog.Nave_disk) { 48 dvo_catalog_unlock (&catalog); 49 dvo_catalog_free (&catalog); 50 continue; 55 51 } 56 52 … … 63 59 64 60 /* rocks2 = find_slow_rocks (&catalog, &catstats, &Nrocks2); */ 61 dvo_catalog_save (&catalog, VERBOSE); 62 dvo_catalog_unlock (&catalog); 63 dvo_catalog_free (&catalog); 65 64 66 wcatalog (&catalog);67 65 wrocks (rocks1, Nrocks1); 68 69 unlock_catalog (&catalog);70 66 /* wrocks (rocks2, Nrocks2); */ 71 67 -
trunk/Ohana/src/markstar/src/find_bright_stars.c
r2490 r8386 15 15 double dX, dY, dR, MaxDist, MaxDist1, MaxRadius, radius, radius2; 16 16 17 // put limits on the ref catalog mags 17 18 load_gsc_data (&GSCdata, catstats); 18 19 -
trunk/Ohana/src/markstar/src/find_ghosts.c
r2490 r8386 32 32 33 33 /* find ghost stars */ 34 // put limits on the ref catalog mags 34 35 load_gsc_data_ghost (&GSCdata, region, Nregions, &timage); 35 36 -
trunk/Ohana/src/markstar/src/markstar.c
r4864 r8386 37 37 38 38 set_db (&db); 39 lock_image_db (&db, ImageCat);39 dvo_image_lock (&db, ImageCat, 3600.0, LCK_XCLD); 40 40 41 gcatalog (argv[1], &catalog); 41 catalog.filename = argv[1]; 42 catalog.Nsecfilt = GetPhotcodeNsecfilt (); 43 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 44 45 // an error exit status here is a significant error 46 if (!dvo_catalog_open (&catalog, NULL, VERBOSE, "a")) { 47 fprintf (stderr, "ERROR: failure to open catalog file %s\n", catalog.filename); 48 exit (2); 49 } 50 if (!catalog.Nave_disk) { 51 dvo_catalog_unlock (&catalog); 52 dvo_catalog_free (&catalog); 53 exit (0); 54 } 42 55 43 56 gcatstats (&catalog, &catstats); … … 53 66 /* find_ghosts (&catalog, &catstats, argv[1], image, Nimage); */ 54 67 55 56 wcatalog (argv[1], &catalog); 68 dvo_catalog_save (&catalog, VERBOSE); 69 dvo_catalog_unlock (&catalog); 70 dvo_catalog_free (&catalog); 57 71 58 72 if (VERBOSE) { … … 61 75 (now.tv_sec - then.tv_sec) + 1e-6*(now.tv_usec - then.tv_usec)); 62 76 } 63 clear_lockfile ();64 77 fprintf (stderr, "SUCCESS\n"); 65 78 } -
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.
