Changeset 34303
- Timestamp:
- Aug 13, 2012, 8:34:55 PM (14 years ago)
- Location:
- branches/eam_branches/ipp-20120805/Ohana/src/dvomerge/src
- Files:
-
- 5 edited
-
dvoverify.c (modified) (1 diff)
-
dvoverify_args.c (modified) (1 diff)
-
dvoverify_catalogs.c (modified) (1 diff)
-
dvoverify_client.c (modified) (1 diff)
-
dvoverify_utils.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20120805/Ohana/src/dvomerge/src/dvoverify.c
r34260 r34303 42 42 } 43 43 44 if (CHECK_IMAGE_ID) { 45 LoadImageIDs (CATDIR); 46 } 47 44 48 // load the sky table for the existing database 45 49 sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, FALSE, SKY_DEPTH_HST, VERBOSE); -
branches/eam_branches/ipp-20120805/Ohana/src/dvomerge/src/dvoverify_args.c
r34260 r34303 53 53 if ((N = get_argument (*argc, argv, "-skip-toplevel"))) { 54 54 CHECK_TOPLEVEL = FALSE; 55 remove_argument (N, argc, argv); 56 } 57 58 CHECK_IMAGE_ID = TRUE; 59 if ((N = get_argument (*argc, argv, "-skip-image-ids"))) { 60 CHECK_IMAGE_ID = FALSE; 55 61 remove_argument (N, argc, argv); 56 62 } -
branches/eam_branches/ipp-20120805/Ohana/src/dvomerge/src/dvoverify_catalogs.c
r34260 r34303 100 100 101 101 char tmpline[DVO_MAX_PATH]; 102 if (VERBOSE) { snprintf (tmpline, DVO_MAX_PATH, "%s -v", command); strcpy (command, tmpline); } 103 if (CHECKSORTED) { snprintf (tmpline, DVO_MAX_PATH, "%s -s", command); strcpy (command, tmpline); } 104 if (LIST_MISSING) { snprintf (tmpline, DVO_MAX_PATH, "%s -list-missing", command); strcpy (command, tmpline); } 102 if (VERBOSE) { snprintf (tmpline, DVO_MAX_PATH, "%s -v", command); strcpy (command, tmpline); } 103 if (CHECKSORTED) { snprintf (tmpline, DVO_MAX_PATH, "%s -s", command); strcpy (command, tmpline); } 104 if (!CHECK_IMAGE_ID) { snprintf (tmpline, DVO_MAX_PATH, "%s -skip-image-ids", command); strcpy (command, tmpline); } 105 if (LIST_MISSING) { snprintf (tmpline, DVO_MAX_PATH, "%s -list-missing", command); strcpy (command, tmpline); } 105 106 106 107 fprintf (stderr, "command: %s\n", command); -
branches/eam_branches/ipp-20120805/Ohana/src/dvomerge/src/dvoverify_client.c
r34260 r34303 19 19 skylist = SkyListByPatch (sky, -1, &UserPatch); 20 20 21 if (CHECK_IMAGE_ID) { 22 // XXX in client mode, we should be reading a reduced table generated by the calling 23 // serial program 24 LoadImageIDs (CATDIR); 25 } 26 21 27 dvoverify_catalogs (skylist, &Nbad); 22 28 -
branches/eam_branches/ipp-20120805/Ohana/src/dvomerge/src/dvoverify_utils.c
r34260 r34303 49 49 50 50 // is this file a consistent FITS file? 51 // note that VerifyTableFile only has to read the headers, 52 // not the data blocks (it uses stat for sizes) 51 53 int VerifyTableFile (char *filename) { 52 54 … … 194 196 // \sum average[].Nmeasure = Nmeasure 195 197 196 // if the table is NOT SORTED, we have a subset of checks we can make198 // if the table is NOT SORTED, do we have a subset of checks we can make? 197 199 if (!catalog.sorted) { 198 200 fprintf (stderr, "!"); … … 231 233 } 232 234 235 // if we have a problem with Nmeasure and/or measureOffset values, we 236 // cannot do any further check -- we risk segfaults 233 237 if (!status) { 234 238 dvo_catalog_unlock (&catalog); … … 263 267 } 264 268 265 // for (i = 0; i < catalog.Naverage; i++) { 266 // m = catalog.average[i].measureOffset; 267 // for (j = 0; i < catalog.Nmeasure; i++) { 268 // objIDsOK &= (catalog.average[i].objID == catalog.measure[m+j].objID); 269 // catIDsOK &= (catalog.average[i].catID == catalog.measure[m+j].catID);270 // averefOK &= (catalog.measure[m+j].averef = i);271 //}272 //}269 // check the image ID here? 270 if (CHECK_IMAGE_ID) { 271 int Nfail = CheckImageID (&catalog); 272 if (Nfail > 0) { 273 fprintf (stderr, "ERROR: catalog %s has invalid %d unmatched image IDs\n", catalog.filename, Nfail); 274 status = FALSE; 275 } 276 } 273 277 274 278 dvo_catalog_unlock (&catalog); … … 278 282 } 279 283 280 // gfits_scan(&cpmHeaderTBL, "NAXIS1", "%d", 1, &NbytesPerRow); 281 // gfits_scan(&cpmHeaderTBL, "NAXIS2", "%d", 1, &Nrows); 282 284 static int maxID = 0; 285 static int *IDlist = NULL; 286 287 // check that every measure->imageID (if set) matches an existing 288 // image->ID. return the number of failures. 289 int CheckImageID (Catalog *catalog) { 290 291 off_t i, j, m, id; 292 int Nfail = 0; 293 294 for (i = 0; i < catalog[0].Naverage; i++) { 295 m = catalog[0].average[i].measureOffset; 296 for (j = 0; j < catalog[0].average[i].Nmeasure; j++) { 297 id = catalog[0].measure[m+j].imageID; 298 if (id > maxID) { 299 Nfail ++; 300 continue; 301 // is this sufficient to catch IDs set without an image table? 302 } 303 if (IDlist) { 304 if (IDlist[id] < 0) { 305 Nfail ++; 306 continue; 307 } 308 } else { 309 if (id > 0) { 310 Nfail ++; 311 continue; 312 } 313 } 314 } 315 } 316 return Nfail; 317 } 318 319 int LoadImageIDs (char *catdir) { 320 321 int status; 322 off_t Nimages, i; 323 Image *images; 324 FITS_DB inDB; 325 326 char ImageCat[DVO_MAX_PATH]; 327 snprintf (ImageCat, DVO_MAX_PATH, "%s/Images.dat", catdir); 328 329 // load the iage database table 330 status = dvo_image_lock (&inDB, ImageCat, 3600.0, LCK_SOFT); // shorter timeout? 331 if (!status) { 332 fprintf (stderr, "ERROR: failure to lock image catalog %s", inDB.filename); 333 exit (3); 334 } 335 336 // load the image table 337 if (inDB.dbstate == LCK_EMPTY) { 338 dvo_image_unlock (&inDB); // unlock input 339 // this is not an error: we can have no image table for, eg, 2MASS only db 340 return TRUE; 341 } 342 if (!dvo_image_load (&inDB, VERBOSE, TRUE)) { 343 fprintf (stderr, "can't read input image catalog %s", inDB.filename); 344 exit (4); 345 } 346 347 images = gfits_table_get_Image (&inDB.ftable, &Nimages, &inDB.swapped); 348 if (!images) { 349 fprintf (stderr, "ERROR: failed to read images from src\n"); 350 exit (2); 351 } 352 353 // generate a lookup table for the images 283 354 355 // first, find the max imageID 356 for (i = 0; i < Nimages; i++) { 357 maxID = MAX(maxID, images[i].imageID); 358 } 359 360 ALLOCATE (IDlist, int, maxID + 1); 361 for (i = 0; i < maxID + 1; i++) { 362 IDlist[i] = -1; 363 } 364 365 for (i = 0; i < Nimages; i++) { 366 int id = images[i].imageID; 367 IDlist[id] = i; 368 } 369 370 // free image table here? 371 // (in the future, I'll have to do the image table read in segments 372 // it is just getting to be too large...) 373 dvo_image_unlock (&inDB); // unlock input 374 375 return TRUE; 376 }
Note:
See TracChangeset
for help on using the changeset viewer.
