Changeset 31260
- Timestamp:
- Apr 10, 2011, 12:14:54 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110404/Ohana/src/relphot
- Files:
-
- 4 edited
-
include/relphot.h (modified) (1 diff)
-
src/MosaicOps.c (modified) (8 diffs)
-
src/reload_catalogs.c (modified) (4 diffs)
-
src/relphot.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110404/Ohana/src/relphot/include/relphot.h
r31258 r31260 227 227 void relphot_help (int argc, char **argv); 228 228 229 off_t getImageByID (off_t ID); 230 229 231 int rationalize_mosaics (); 230 232 int LimitDensityCatalog (Catalog *subcatalog, Catalog *catalog); -
branches/eam_branches/ipp-20110404/Ohana/src/relphot/src/MosaicOps.c
r31258 r31260 9 9 static off_t **imlist; /* mosaic -> image[] */ 10 10 static off_t **bin; /* catalog, measure -> mosaic */ 11 12 // list of mosaics associated with an image 13 static off_t *mosimage; 11 14 12 15 // list of mosaic associated with each image … … 33 36 ALLOCATE (NIMLIST, off_t, NMOSAIC); 34 37 38 ALLOCATE (mosimage, off_t, Nimage); // mosaic to which image belongs 39 35 40 /* a 'mosaic' in relphot is (unlike relastro) a virtual concept: there is no 36 41 * entry in the image table that represents this mosaic. Instead, it is an … … 40 45 /* generate list of unique mosaics */ 41 46 for (i = 0; i < Nimage; i++) { 47 mosimage[i] = -1; 42 48 43 49 /* select valid mosaic images by photcode */ … … 56 62 if (start > mosaic[j].stop) continue; 57 63 found = TRUE; 64 65 // add reference from image to mosaic 66 mosimage[i] = j; 58 67 59 68 /* add image to mosaic image list */ … … 84 93 imlist[Nmosaic][0] = i; 85 94 95 // add reference from image to mosaic 96 mosimage[i] = Nmosaic; 97 86 98 Nmosaic ++; 87 99 if (Nmosaic == NMOSAIC) { … … 269 281 } 270 282 283 # if 1 284 // # if USE_IMAGE_ID 285 286 void matchMosaics (Catalog *catalog, off_t meas, int cat) { 287 288 off_t idx, ID, mosID; 289 Measure *measure; 290 291 measure = &catalog[cat].measure[meas]; 292 293 ID = measure[0].imageID; 294 idx = getImageByID (ID); 295 if (idx == -1) { 296 if (VERBOSE2) fprintf (stderr, "missed measurement "OFF_T_FMT", %d\n", meas, cat); 297 } 298 299 mosID = mosimage[idx]; 300 if (mosID < 0) { 301 Image *image = getimage(idx); 302 fprintf (stderr, "unmatched image %s\n", image[0].name); 303 return; 304 } 305 306 // test to check we got the right match: 307 { 308 Image *image = getimage(idx); 309 unsigned int imageStart = image[0].tzero - MAX(0.01*image[0].trate*image[0].NY, 1); 310 if (imageStart != mosaic[mosID].start) { 311 fprintf (stderr, "error in image to mosaic match\n"); 312 abort(); 313 } 314 } 315 316 bin[cat][meas] = mosID; 317 318 clist[mosID][Nlist[mosID]] = cat; 319 mlist[mosID][Nlist[mosID]] = meas; 320 Nlist[mosID] ++; 321 322 if (Nlist[mosID] == NLIST[mosID]) { 323 NLIST[mosID] += 100; 324 REALLOCATE (clist[mosID], int, NLIST[mosID]); 325 REALLOCATE (mlist[mosID], off_t, NLIST[mosID]); 326 } 327 return; 328 } 329 330 # else // USE_IMAGE_ID 331 271 332 void matchMosaics (Catalog *catalog, off_t meas, int cat) { 272 333 … … 287 348 setGridMeasure (meas, cat, X, Y); 288 349 } 289 # endif 350 # endif // GRID_V1 290 351 291 352 bin[cat][meas] = i; … … 303 364 } 304 365 // if we miss a measurement, it might be a REF type of value 305 // fprintf (stderr, "missed measurement\n");366 if (VERBOSE2) fprintf (stderr, "missed measurement "OFF_T_FMT", %d\n", meas, cat); 306 367 return; 307 368 } 369 # endif // USE_IMAGE_ID 308 370 309 371 float getMmos (off_t meas, int cat) { -
branches/eam_branches/ipp-20110404/Ohana/src/relphot/src/reload_catalogs.c
r15743 r31260 1 1 # include "relphot.h" 2 3 # define TIMESTAMP(TIME) \ 4 gettimeofday (&stop, (void *) NULL); \ 5 dtime = DTIME (stop, start); \ 6 TIME += dtime; \ 7 gettimeofday (&start, (void *) NULL); 2 8 3 9 void reload_catalogs (SkyList *skylist) { … … 8 14 Catalog catalog; 9 15 16 struct timeval start, stop; 17 double dtime, time1, time2, time3, time4, time5, time6, time7; 18 10 19 if (VERBOSE) fprintf (stderr, "re-loading catalog data\n"); 11 20 12 21 /* load data from each region file */ 13 22 for (i = 0; i < skylist[0].Nregions; i++) { 23 gettimeofday (&start, (void *) NULL); 14 24 catalog.filename = skylist[0].filename[i]; 15 25 … … 20 30 continue; 21 31 } 32 TIMESTAMP(time1); 22 33 23 34 catalog.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data … … 36 47 continue; 37 48 } 49 TIMESTAMP(time2); 38 50 39 51 initImageBins (&catalog, 1); 40 52 initMosaicBins (&catalog, 1); 41 53 initGridBins (&catalog, 1); 54 TIMESTAMP(time3); 42 55 43 56 findImages (&catalog, 1); 44 57 findMosaics (&catalog, 1); 58 TIMESTAMP(time4); 45 59 46 60 setMrelFinal (&catalog); 61 TIMESTAMP(time5); 62 47 63 dvo_catalog_save (&catalog, VERBOSE); 48 64 dvo_catalog_unlock (&catalog); 49 65 dvo_catalog_free (&catalog); 66 TIMESTAMP(time6); 50 67 51 68 freeImageBins (1); 52 69 freeMosaicBins (1); 53 70 freeGridBins (1); 71 TIMESTAMP(time7); 54 72 } 73 74 fprintf (stderr, "time1 %f : find catalog\n", time1); 75 fprintf (stderr, "time2 %f : load catalog\n", time2); 76 fprintf (stderr, "time3 %f : init imbins\n", time3); 77 fprintf (stderr, "time4 %f : find images\n", time4); 78 fprintf (stderr, "time5 %f : set Mrel\n", time5); 79 fprintf (stderr, "time6 %f : save catalog\n", time6); 80 fprintf (stderr, "time7 %f : free catalog\n", time7); 55 81 } -
branches/eam_branches/ipp-20110404/Ohana/src/relphot/src/relphot.c
r31258 r31260 47 47 if (!dvo_image_load (&db, VERBOSE, FALSE)) Shutdown ("can't read image catalog %s", db.filename); 48 48 } 49 MARKTIME(" load image data: %f sec\n", dtime);49 MARKTIME("-- load image data: %f sec\n", dtime); 50 50 51 51 /* load regions and images based on specified sky patch */ … … 54 54 // XXX this is fairly lame: argv[1] is photcode if UserPatchSelect is true 55 55 skylist = load_images (&db, argv[1], &UserPatch, UserPatchSelect); 56 MARKTIME(" load images: %f sec\n", dtime);56 MARKTIME("-- load images: %f sec\n", dtime); 57 57 58 58 /* unlock, if we can (else, unlocked below) */ … … 61 61 /* load catalog data from region files */ 62 62 catalog = load_catalogs (skylist, &Ncatalog); 63 MARKTIME(" load catalog data: %f sec\n", dtime);63 MARKTIME("-- load catalog data: %f sec\n", dtime); 64 64 65 65 /* add in a loop over the catalogs calling dvo_catalog_chipcoords */ … … 67 67 /* match measurements with images, mosaics */ 68 68 initImageBins (catalog, Ncatalog); 69 MARKTIME(" make image bins: %f sec\n", dtime);69 MARKTIME("-- make image bins: %f sec\n", dtime); 70 70 71 71 initMosaicBins (catalog, Ncatalog); … … 74 74 75 75 findImages (catalog, Ncatalog); 76 MARKTIME(" set up image indexes: %f sec\n", dtime);76 MARKTIME("-- set up image indexes: %f sec\n", dtime); 77 77 78 78 findMosaics (catalog, Ncatalog); /* also sets Grid values */ 79 MARKTIME(" set up mosaic indexes: %f sec\n", dtime);79 MARKTIME("-- set up mosaic indexes: %f sec\n", dtime); 80 80 81 81 SAVEPLOT = FALSE; … … 152 152 // if ((i == 4) || (i == 8) || (i == 12) || (i == 16)) clean_images (); 153 153 global_stats (catalog, Ncatalog); 154 MARKTIME("-- finished loop %d: %f sec\n", i, dtime); 154 155 } 155 156 … … 169 170 setMcal (catalog, TRUE); 170 171 setMmos (catalog, TRUE); 172 MARKTIME("-- finalize Mcal values: %f sec\n", dtime); 171 173 172 174 /* at this point, we have correct cal coeffs in the image/mosaic structures */ … … 178 180 /* load catalog data from region files, update Mrel include all data */ 179 181 reload_catalogs (skylist); 182 MARKTIME("-- updated all catalogs: %f sec\n", dtime); 183 180 184 setMcalFinal (); 181 182 185 reload_images (&db); 183 186
Note:
See TracChangeset
for help on using the changeset viewer.
