Changeset 39478
- Timestamp:
- Mar 23, 2016, 12:34:01 PM (10 years ago)
- Location:
- trunk/Ohana/src/relphot
- Files:
-
- 20 edited
-
Makefile (modified) (1 diff)
-
include/relphot.h (modified) (3 diffs)
-
src/BrightCatalog.c (modified) (1 diff)
-
src/ConfigInit.c (modified) (1 diff)
-
src/ImageOps.c (modified) (1 diff)
-
src/ImageSubset.c (modified) (3 diffs)
-
src/MosaicOps.c (modified) (1 diff)
-
src/StarOps.c (modified) (4 diffs)
-
src/args.c (modified) (5 diffs)
-
src/bcatalog.c (modified) (1 diff)
-
src/client_logger.c (modified) (1 diff)
-
src/initialize.c (modified) (1 diff)
-
src/load_catalogs.c (modified) (4 diffs)
-
src/load_images.c (modified) (5 diffs)
-
src/reload_catalogs.c (modified) (4 diffs)
-
src/relphot.c (modified) (6 diffs)
-
src/relphot_client.c (modified) (4 diffs)
-
src/relphot_images.c (modified) (5 diffs)
-
src/relphot_objects.c (modified) (5 diffs)
-
src/select_images.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/relphot/Makefile
r38062 r39478 92 92 $(SRC)/initialize.$(ARCH).o \ 93 93 $(SRC)/syncfile.$(ARCH).o \ 94 $(SRC)/select_images.$(ARCH).o \ 95 $(SRC)/load_images.$(ARCH).o \ 94 96 $(SRC)/load_catalogs.$(ARCH).o \ 95 97 $(SRC)/reload_catalogs.$(ARCH).o \ -
trunk/Ohana/src/relphot/include/relphot.h
r39464 r39478 418 418 Catalog *load_catalogs_parallel PROTO((SkyList *sky, int *Ncatalog, char *syncfile)); 419 419 420 SkyList *load_images PROTO((FITS_DB *db, char *regionName, SkyRegion *region));420 SkyList *load_images PROTO((FITS_DB *db, SkyTable *sky, char *regionName, SkyRegion *region)); 421 421 Image *select_images PROTO((SkyList *skylist, Image *timage, off_t Ntimage, char *inSubset, off_t **LineNumber, off_t *Nimage, SkyRegion *region)); 422 422 … … 475 475 void wimages PROTO((void)); 476 476 void write_coords PROTO((Header *header, Coords *coords)); 477 int relphot_objects ( int hostID, char *hostpath);477 int relphot_objects (SkyTable *sky, SkyList *skylist, int hostID, char *hostpath); 478 478 int relphot_images (void); 479 479 … … 597 597 int getMosaicFlags (off_t meas, int cat); 598 598 599 void relphot_free (SkyTable *sky, SkyList *skylist); 600 void freeImages (); 601 void relphot_client_free (SkyTable *sky, SkyList *skylist); 602 void BrightCatalogFree (BrightCatalog *bcatalog); 603 604 void free_astrom_table (); -
trunk/Ohana/src/relphot/src/BrightCatalog.c
r39262 r39478 547 547 } 548 548 549 void BrightCatalogFree (BrightCatalog *bcatalog) { 550 if (!bcatalog) return; 551 FREE (bcatalog[0].average); 552 FREE (bcatalog[0].measure); 553 FREE (bcatalog[0].secfilt); 554 FREE (bcatalog); 555 return; 556 } 557 549 558 // distribute a bright catalog across separate catalogs 550 559 CatalogSplitter *BrightCatalogSplitInit (int Nsecfilt) { -
trunk/Ohana/src/relphot/src/ConfigInit.c
r34749 r39478 73 73 SetZeroPoint (ZERO_POINT); 74 74 75 FreeConfigFile(); 75 76 free (config); 76 77 free (file); -
trunk/Ohana/src/relphot/src/ImageOps.c
r39457 r39478 265 265 free (N_ONIMAGE); 266 266 } 267 } 268 269 void freeImages () { 270 271 FREE (image); 272 FREE (LineNumber); 273 274 FREE (imageIDs); 275 FREE (imageIdx); 276 277 FREE (tessID); 278 FREE (projectID); 279 FREE (skycellID); 280 281 free_astrom_table(); 267 282 } 268 283 -
trunk/Ohana/src/relphot/src/ImageSubset.c
r37037 r39478 43 43 if (!gfits_load_header (f, &theader)) { 44 44 fclose (f); 45 gfits_free_header (&header); 46 gfits_free_matrix (&matrix); 45 47 return NULL; 46 48 } … … 49 51 if (!gfits_fread_ftable_data (f, &ftable, FALSE)) { 50 52 fclose (f); 53 gfits_free_header (&theader); 54 gfits_free_header (&header); 55 gfits_free_matrix (&matrix); 51 56 return (NULL); 52 57 } … … 100 105 free (ucdist); 101 106 107 gfits_free_header (&header); 108 gfits_free_matrix (&matrix); 109 gfits_free_header (&theader); 110 gfits_free_table (&ftable); 111 102 112 *nimage = Nrow; 103 113 return image; -
trunk/Ohana/src/relphot/src/MosaicOps.c
r39457 r39478 313 313 fprintf (stderr, "matched %d images to %d mosaics, %d simple chips not matched to mosaics\n", (int) (Nsubset - Nsimple), (int) Nmosaic, (int) Nsimple); 314 314 return; 315 } 316 317 void freeMosaics () { 315 318 } 316 319 -
trunk/Ohana/src/relphot/src/StarOps.c
r39464 r39478 302 302 303 303 SetMrelInfoFree (&results); 304 SetMrelInfoFree (&summary); 304 305 305 306 return (TRUE); … … 324 325 325 326 SetMrelInfoFree (&results); 327 SetMrelInfoFree (&summary); 326 328 return (TRUE); 327 329 } … … 387 389 threadinfo[i].summary.Nsys); 388 390 SetMrelInfoAccum (&summary, &threadinfo[i].summary); 391 SetMrelInfoFree (&threadinfo[i].summary); 389 392 } 390 393 if (VERBOSE2) fprintf (stderr, "total : %d stars with no data in photcode, %d stars marked having too few measurements (Nbad: %d, Ncal: %d, Nmos: %d, Ngrid: %d, Nsys: %d)\n", summary.Ncode, summary.Nfew, summary.Nbad, summary.Ncal, summary.Nmos, summary.Ngrid, summary.Nsys); 391 394 free (threadinfo); 392 395 396 SetMrelInfoFree (&summary); 393 397 return TRUE; 394 398 } … … 407 411 if (i == -1) { 408 412 threadinfo->state = THREAD_DONE; 413 SetMrelInfoFree (&results); 409 414 return NULL; 410 415 } -
trunk/Ohana/src/relphot/src/args.c
r39345 r39478 441 441 } 442 442 443 PhotcodeList = NULL; 444 photcodes = NULL; 443 445 switch (mode) { 444 446 case SYNTH_PHOT: … … 450 452 case PARALLEL_IMAGES: 451 453 case PARALLEL_REGIONS: 454 case APPLY_OFFSETS: 452 455 PhotcodeList = strcreate (argv[1]); 453 456 photcodes = ParsePhotcodeList (PhotcodeList, &Nphotcodes, TRUE); // require SEC photcodes … … 465 468 } 466 469 470 // XXX need to free sky 471 void relphot_free (SkyTable *sky, SkyList *skylist) { 472 FREE (UserCatalog); 473 FREE (OUTROOT); 474 FREE (UPDATE_CATFORMAT); 475 476 FREE (BOUNDARY_TREE); 477 FREE (REGION_FILE); 478 FREE (SYNTH_ZERO_POINTS); 479 FREE (IMAGE_TABLE); 480 FREE (CATDIR); 481 482 FREE (PhotcodeList); 483 FREE (photcodes); 484 485 SkyTableFree (sky); 486 SkyListFree(skylist); 487 FreePhotcodeTable(); 488 489 ohana_memcheck (VERBOSE); 490 ohana_memdump (VERBOSE); 491 } 492 467 493 int args_client (int argc, char **argv) { 468 494 … … 470 496 double trange; 471 497 472 // by definition, the client is not parallel498 // by definition, the client is not parallel 473 499 PARALLEL = FALSE; 474 500 PARALLEL_MANUAL = FALSE; … … 722 748 } 723 749 750 // XXX need to free sky 751 void relphot_client_free (SkyTable *sky, SkyList *skylist) { 752 FREE (HOSTDIR); 753 FREE (BCATALOG); 754 FREE (IMAGES); 755 756 FREE (SYNTH_ZERO_POINTS); 757 FREE (BOUNDARY_TREE); 758 FREE (UPDATE_CATFORMAT); 759 760 FREE (CATDIR); 761 FREE (PhotcodeList); 762 FREE (photcodes); 763 764 SkyTableFree (sky); 765 SkyListFree(skylist); 766 FreePhotcodeTable(); 767 768 ohana_memcheck (VERBOSE); 769 ohana_memdump (VERBOSE); 770 } 771 772 -
trunk/Ohana/src/relphot/src/bcatalog.c
r39341 r39478 239 239 } 240 240 241 free (Nvalid) 242 241 243 return (TRUE); 242 244 } -
trunk/Ohana/src/relphot/src/client_logger.c
r36630 r39478 27 27 int client_logger_message (char *format,...) { 28 28 29 if (!logfile) return FALSE; 30 29 31 va_list argp; 30 32 -
trunk/Ohana/src/relphot/src/initialize.c
r39377 r39478 92 92 93 93 // XXX need to determine which globals can affect relphot_client in either mode and pass appropriately 94 PhotcodeList = NULL; 95 photcodes = NULL; 94 96 95 97 relphot_client_help (argc, argv); -
trunk/Ohana/src/relphot/src/load_catalogs.c
r38986 r39478 176 176 fprintf (stderr, "command: %s\n", command); 177 177 178 if (PARALLEL_MANUAL) continue; 178 if (PARALLEL_MANUAL) { 179 free (command); 180 continue; 181 } 179 182 180 183 if (PARALLEL_SERIAL) { … … 194 197 table->hosts[i].pid = pid; // save for future reference 195 198 } 199 free (command); 196 200 } 197 201 … … 254 258 *Ncatalog = catalogs->Ncatalog; 255 259 260 // need to free the place-holder catalogs: 261 for (i = catalogs->Ncatalog; i < catalogs->NCATALOG; i++) { 262 free (catalogs->catalog[i].averageT); 263 free (catalogs->catalog[i].measureT); 264 free (catalogs->catalog[i].secfilt); 265 } 266 256 267 int Nmeasure = 0; 257 268 int Naverage = 0; … … 265 276 266 277 BrightCatalogSplitFree (catalogs); 278 FreeHostTable (table); 267 279 268 280 return (catalog); -
trunk/Ohana/src/relphot/src/load_images.c
r38986 r39478 1 1 # include "relphot.h" 2 3 static AstromOffsetTable *table = NULL; 2 4 3 5 // This function generates a subset of the images based on selections. Input db has already 4 6 // been loaded with the raw fits table data 5 SkyList *load_images (FITS_DB *db, char *regionName, SkyRegion *region) {7 SkyList *load_images (FITS_DB *db, SkyTable *sky, char *regionName, SkyRegion *region) { 6 8 7 9 Image *image, *subset; … … 10 12 char *inSubset; 11 13 12 SkyTable *sky = NULL;13 14 SkyList *skylist = NULL; 14 15 15 16 INITTIME; 16 17 17 // load the current sky table (layout of all SkyRegions)18 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);19 SkyTableSetFilenames (sky, CATDIR, "cpt");20 21 18 // convert database table to internal structure (binary to Image) 22 19 // 'image' points to the same memory as db->ftable->buffer … … 35 32 char mapfile[DVO_MAX_PATH]; 36 33 snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR); 37 AstromOffsetTable *table = AstromOffsetMapLoad (mapfile, 100000, VERBOSE);34 table = AstromOffsetMapLoad (mapfile, 100000, VERBOSE); 38 35 39 36 // assign images.coords.offsetMap -> table->map[i] … … 117 114 initMosaics (subset, Nsubset, image, inSubset, Nimage); 118 115 MARKTIME("init mosaics: %f sec\n", dtime); 116 free (inSubset); 119 117 120 118 // save the subset of images in the static reference in ImageOps, set up indexes … … 142 140 return (TRUE); 143 141 } 142 143 void free_astrom_table () { 144 if (!table) return; 145 AstromOffsetTableFree (table); 146 free (table); 147 } -
trunk/Ohana/src/relphot/src/reload_catalogs.c
r38986 r39478 152 152 } 153 153 free (image); 154 } else { 155 // load the current sky table (layout of all SkyRegions) 156 SkyTable *skytable = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 157 // XXX kind of hackish... 158 ALLOCATE (sky, SkyList, 1); 159 strcpy (sky->hosts, skytable->hosts); 154 // } else { 155 // // load the current sky table (layout of all SkyRegions) 156 // SkyTable *skytable = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 157 // // XXX kind of hackish... 158 // ALLOCATE (sky, SkyList, 1); 159 // strcpy (sky->hosts, skytable->hosts); 160 // SkyTableFree (skytable); 160 161 } 161 162 … … 189 190 reload_catalog_parallel_group (&groups[i], sky, imageFile); 190 191 } 192 193 for (i = 0; i < Ngroups; i++) { 194 free (groups[i].hosts); 195 } 196 free (groups); 197 FreeHostTable (table); 198 191 199 return TRUE; 192 200 } … … 264 272 fprintf (stderr, "command: %s\n", command); 265 273 266 if (PARALLEL_MANUAL) continue; 274 if (PARALLEL_MANUAL) { 275 free (command); 276 continue; 277 } 267 278 268 279 if (PARALLEL_SERIAL) { … … 282 293 group->hosts[i][0].pid = pid; // save for future reference 283 294 } 295 free (command); 284 296 } 285 297 -
trunk/Ohana/src/relphot/src/relphot.c
r38986 r39478 2 2 3 3 int main (int argc, char **argv) { 4 5 SkyTable *sky = NULL; 6 SkyList *skylist = NULL; 4 7 5 8 // get configuration info, args … … 17 20 // take the current set of detections and set the mean magnitudes 18 21 // DOES NOT LOAD THE IMAGE TABLE 19 relphot_objects (0, NULL); 22 sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, TRUE, -1, VERBOSE); 23 if (!sky) { 24 fprintf (stderr, "ERROR running loading sky table from %s\n", CATDIR); 25 exit (2); 26 } 27 SkyTableSetFilenames (sky, CATDIR, "cpt"); 28 29 skylist = SkyListByPatch (sky, -1, &UserPatch); 30 if (!skylist) { 31 fprintf (stderr, "ERROR setting up skylist for %s\n", CATDIR); 32 exit (2); 33 } 34 relphot_objects (sky, skylist, 0, NULL); 35 relphot_free (sky, skylist); 20 36 exit (0); 21 37 … … 23 39 // set the mean magnitudes ONLY for SYNPHOT objects 24 40 relphot_synthphot (0, NULL); 41 relphot_free (NULL, NULL); 25 42 exit (0); 26 43 … … 28 45 // run image updates in parallel across multiple remote machines 29 46 relphot_parallel_regions (); 47 relphot_free (NULL, NULL); 30 48 exit (0); 31 49 … … 33 51 // operation on the remote machines in the PARALLEL_REGION mode 34 52 relphot_parallel_images (); 53 relphot_free (NULL, NULL); 35 54 exit (0); 36 55 … … 41 60 exit (2); 42 61 } 43 reload_catalogs (NULL, NULL, 0, NULL); 62 63 sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, TRUE, -1, VERBOSE); 64 if (!sky) { 65 fprintf (stderr, "ERROR running loading sky table from %s\n", CATDIR); 66 exit (2); 67 } 68 SkyTableSetFilenames (sky, CATDIR, "cpt"); 69 70 skylist = SkyListByPatch (sky, -1, &UserPatch); 71 if (!skylist) { 72 fprintf (stderr, "ERROR setting up skylist for %s\n", CATDIR); 73 exit (2); 74 } 75 76 reload_catalogs (skylist, NULL, 0, NULL); 77 relphot_free (sky, skylist); 44 78 exit (0); 45 79 -
trunk/Ohana/src/relphot/src/relphot_client.c
r39289 r39478 22 22 client_logger_init (HOSTDIR); 23 23 24 // load the current sky table (layout of all SkyRegions) 24 // load the current sky table (layout of all SkyRegions) if needed 25 25 SkyTable *sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, TRUE, -1, VERBOSE); 26 26 if (!sky) { 27 fprintf (stderr, "ERROR running loading sky table from %s\n", CATDIR);28 exit (2);27 fprintf (stderr, "ERROR running loading sky table from %s\n", CATDIR); 28 exit (2); 29 29 } 30 30 SkyTableSetFilenames (sky, CATDIR, "cpt"); 31 31 32 32 SkyList *skylist = SkyListByPatch (sky, -1, &UserPatch); 33 33 if (!skylist) { 34 fprintf (stderr, "ERROR setting up skylist for %s\n", CATDIR);35 exit (2);34 fprintf (stderr, "ERROR setting up skylist for %s\n", CATDIR); 35 exit (2); 36 36 } 37 37 client_logger_message ("loaded sky table and defined patch\n"); … … 54 54 exit (2); 55 55 } 56 57 // free memory associated with the catalogs 58 for (int i = 0; i < Ncatalog; i++) { 59 free_tiny_values (&catalog[i]); 60 dvo_catalog_free (&catalog[i]); 61 } 62 free (catalog); 63 BrightCatalogFree (bcatalog); 56 64 client_logger_message ("generated subset table\n"); 65 relphot_client_free (sky, skylist); 57 66 break; 58 67 } … … 72 81 73 82 // load the flat-field correction table from CATDIR 74 # if (0)75 char flatcorrFile[1024];76 snprintf (flatcorrFile, 1024, "%s/flatcorr.fits", CATDIR);77 FlatCorrectionTable *flatcorr = FlatCorrectionLoad (flatcorrFile, VERBOSE);78 client_logger_message ("loaded flat-field correction data\n");79 # endif80 83 FlatCorrectionTable *flatcorr = NULL; 81 84 reload_catalogs (skylist, flatcorr, HOST_ID, HOSTDIR); 85 freeImages (); 86 free (image); 82 87 client_logger_message ("updated catalogs\n"); 88 relphot_client_free (sky, skylist); 83 89 break; 84 90 } 85 91 86 92 case MODE_UPDATE_OBJECTS: { 87 relphot_objects (HOST_ID, HOSTDIR); 93 relphot_objects (sky, skylist, HOST_ID, HOSTDIR); 94 relphot_client_free (sky, skylist); 88 95 client_logger_message ("updated objects\n"); 89 96 break; … … 101 108 } 102 109 client_logger_message ("done with relphot_client\n"); 103 104 110 exit (0); 105 111 } -
trunk/Ohana/src/relphot/src/relphot_images.c
r39377 r39478 12 12 Catalog *catalog = NULL; 13 13 FITS_DB db; 14 SkyList *skylist = NULL;15 14 16 15 INITTIME; 16 17 // load the current sky table (layout of all SkyRegions) 18 SkyTable *sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 19 SkyTableSetFilenames (sky, CATDIR, "cpt"); 17 20 18 21 /* register database handle with shutdown procedure */ … … 40 43 41 44 /* load regions and images based on specified sky patch and/or catalog */ 42 skylist = load_images (&db, UserCatalog, &UserPatch);45 SkyList *skylist = load_images (&db, sky, UserCatalog, &UserPatch); 43 46 MARKTIME("-- load images: %f sec\n", dtime); 44 47 … … 219 222 dvo_image_save (&dbX, VERBOSE); 220 223 dvo_image_unlock (&dbX); 224 gfits_db_free (&dbX); 221 225 MARKTIME("-- save Image.dat.bck: %f sec\n", dtime); 222 226 } … … 228 232 dvo_catalog_free (&catalog[i]); 229 233 } 234 free (catalog); 230 235 freeImageBins (Ncatalog, TRUE); 231 236 freeMosaicBins (Ncatalog, TRUE); … … 259 264 } 260 265 dvo_image_unlock (&db); 261 266 gfits_db_free (&db); 267 freeImages(); 268 269 relphot_free (sky, skylist); 262 270 exit (0); 263 271 } -
trunk/Ohana/src/relphot/src/relphot_objects.c
r39464 r39478 8 8 int relphot_objects_parallel (SkyList *sky); 9 9 10 int relphot_objects ( int hostID, char *hostpath) {10 int relphot_objects (SkyTable *sky, SkyList *skylist, int hostID, char *hostpath) { 11 11 12 12 off_t i, j, k; 13 13 int Nsecfilt; 14 14 15 SkyTable *sky = NULL;16 SkyList *skylist = NULL;17 15 Catalog catalog; 18 19 // load the current sky table (layout of all SkyRegions)20 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);21 SkyTableSetFilenames (sky, CATDIR, "cpt");22 23 // determine the populated SkyRegions overlapping the requested area (default depth)24 skylist = SkyListByPatch (sky, -1, &UserPatch);25 16 26 17 // XXX need to decide how to determine PARALLEL mode... … … 112 103 dvo_catalog_free (&catalog); 113 104 } 114 115 105 return (TRUE); 116 106 } … … 169 159 fprintf (stderr, "command: %s\n", command); 170 160 171 if (PARALLEL_MANUAL) continue; 161 if (PARALLEL_MANUAL) { 162 free (command); 163 continue; 164 } 172 165 173 166 if (PARALLEL_SERIAL) { … … 187 180 table->hosts[i].pid = pid; // save for future reference 188 181 } 182 free (command); 189 183 } 190 184 … … 197 191 } 198 192 193 FreeHostTable (table); 199 194 return TRUE; 200 195 } -
trunk/Ohana/src/relphot/src/select_images.c
r37807 r39478 269 269 REALLOCATE (line_number, off_t, MAX (nimage, 1)); 270 270 271 FREE (RmaxBand); 272 FREE (RminBand); 273 271 274 if (!USE_BASIC_CHECK) { 272 275 free (skycoords);
Note:
See TracChangeset
for help on using the changeset viewer.
