Changeset 29001 for trunk/Ohana/src/dvomerge
- Timestamp:
- Aug 20, 2010, 12:05:07 PM (16 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 10 edited
- 1 copied
-
. (modified) (1 prop)
-
src/dvomerge/Makefile (modified) (2 diffs)
-
src/dvomerge/include/dvomerge.h (modified) (1 diff)
-
src/dvomerge/src/SkyTablePopulatedRange.c (modified) (1 diff)
-
src/dvomerge/src/args.c (modified) (2 diffs)
-
src/dvomerge/src/dvo_image_merge_dbs.c (modified) (2 diffs)
-
src/dvomerge/src/dvoconvert.c (modified) (1 diff)
-
src/dvomerge/src/dvomergeUpdate.c (modified) (5 diffs)
-
src/dvomerge/src/dvosecfilt.c (copied) (copied from branches/eam_branches/ipp-20100621/Ohana/src/dvomerge/src/dvosecfilt.c )
-
src/dvomerge/src/dvoverify.c (modified) (1 diff)
-
src/dvomerge/src/help.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
- Property svn:mergeinfo deleted
-
trunk/Ohana/src/dvomerge/Makefile
r27583 r29001 20 20 dvomerge : $(BIN)/dvoconvert.$(ARCH) 21 21 22 all: dvomerge dvoconvert 22 all: dvomerge dvoconvert dvosecfilt 23 23 24 24 DVOMERGE = \ … … 58 58 $(BIN)/dvoconvert.$(ARCH) : $(DVOCONVERT) 59 59 60 INSTALL = dvomerge dvoconvert 60 DVOSECFILT = \ 61 $(SRC)/dvosecfilt.$(ARCH).o \ 62 $(SRC)/SetSignals.$(ARCH).o \ 63 $(SRC)/ConfigInit.$(ARCH).o \ 64 $(SRC)/Shutdown.$(ARCH).o \ 65 $(SRC)/help.$(ARCH).o \ 66 $(SRC)/args.$(ARCH).o 67 68 $(DVOSECFILT) : $(INC)/dvomerge.h 69 70 $(BIN)/dvosecfilt.$(ARCH) : $(DVOSECFILT) 71 72 INSTALL = dvomerge dvoconvert dvosecfilt 61 73 62 74 # dependancy rules for binary code ######################### -
trunk/Ohana/src/dvomerge/include/dvomerge.h
r28855 r29001 55 55 int dvoconvert_args PROTO((int *argc, char **argv)); 56 56 57 void dvosecfilt_usage PROTO((void)); 58 void dvosecfilt_help PROTO((int argc, char **argv)); 59 int dvosecfilt_args PROTO((int *argc, char **argv)); 60 57 61 int SkyTablePopulatedRange PROTO((off_t *ns, off_t *ne, SkyTable *sky, off_t Nstart)); 62 int SkyListPopulatedRange PROTO((off_t *ns, off_t *ne, SkyList *sky, off_t Nstart)); 58 63 59 64 SkyList *SkyTablePopulatedList PROTO((SkyTable *sky)); -
trunk/Ohana/src/dvomerge/src/SkyTablePopulatedRange.c
r27435 r29001 12 12 Ns = sky[0].regions[Nstart].childS; 13 13 Ne = sky[0].regions[Nstart].childE; 14 if (Ns == 0) { 15 fprintf (stderr, "no populated tables at an appropriate depth\n"); 16 exit (1); 17 } 18 Nstart = Ns; 19 } 20 21 *ns = Ns; 22 *ne = Ne; 23 return (TRUE); 24 } 25 26 int SkyListPopulatedRange (off_t *ns, off_t *ne, SkyList *sky, off_t Nstart) { 27 28 off_t Ns, Ne; 29 30 // given the starting sky region, find the populated range at or below this region 31 32 Ns = Nstart; 33 Ne = Nstart + 1; 34 while (!sky[0].regions[Nstart][0].table) { 35 Ns = sky[0].regions[Nstart][0].childS; 36 Ne = sky[0].regions[Nstart][0].childE; 14 37 if (Ns == 0) { 15 38 fprintf (stderr, "no populated tables at an appropriate depth\n"); -
trunk/Ohana/src/dvomerge/src/args.c
r28855 r29001 15 15 remove_argument (N, argc, argv); 16 16 ALTERNATE_PHOTCODE_FILE = strdup(argv[N]); 17 remove_argument (N, argc, argv); 18 } 19 20 /*** provide additional data ***/ 21 /* restrict to a portion of the sky? */ 22 UserPatch.Rmin = 0; 23 UserPatch.Rmax= 360; 24 UserPatch.Dmin = -90; 25 UserPatch.Dmax = +90; 26 if ((N = get_argument (*argc, argv, "-region"))) { 27 remove_argument (N, argc, argv); 28 UserPatch.Rmin = atof (argv[N]); 29 remove_argument (N, argc, argv); 30 UserPatch.Rmax = atof (argv[N]); 31 remove_argument (N, argc, argv); 32 UserPatch.Dmin = atof (argv[N]); 33 remove_argument (N, argc, argv); 34 UserPatch.Dmax = atof (argv[N]); 17 35 remove_argument (N, argc, argv); 18 36 } … … 37 55 return TRUE; 38 56 } 57 58 /*** check for command line options ***/ 59 int dvosecfilt_args (int *argc, char **argv) { 60 61 int N; 62 63 /* extra error messages */ 64 VERBOSE = FALSE; 65 if ((N = get_argument (*argc, argv, "-v"))) { 66 VERBOSE = TRUE; 67 remove_argument (N, argc, argv); 68 } 69 70 if (*argc != 3) dvosecfilt_usage(); 71 return TRUE; 72 } -
trunk/Ohana/src/dvomerge/src/dvo_image_merge_dbs.c
r28354 r29001 13 13 14 14 images = gfits_table_get_Image (&in[0].ftable, &Nimages, &in[0].swapped); 15 if (!images) { 16 fprintf (stderr, "ERROR: failed to read images\n"); 17 exit (2); 18 } 19 15 20 ALLOCATE (IDmap->old, off_t, Nimages); 16 21 ALLOCATE (IDmap->new, off_t, Nimages); … … 59 64 60 65 off_t Nlo, Nhi, N; 66 67 if (!IDmap->Nmap) return 0; 61 68 62 69 // find the a close entry below desired ID -
trunk/Ohana/src/dvomerge/src/dvoconvert.c
r28855 r29001 148 148 // convert the raw image table to Image type (byteswap if needed) 149 149 images = gfits_table_get_Image (&inDB.ftable, &Nimages, &inDB.swapped); 150 if (!images) { 151 fprintf (stderr, "ERROR: failed to read images\n"); 152 exit (2); 153 } 150 154 151 155 // update additional metadata -
trunk/Ohana/src/dvomerge/src/dvomergeUpdate.c
r28857 r29001 6 6 off_t i, j, Ns, Ne; 7 7 SkyTable *outsky, *insky; 8 SkyList * inlist;8 SkyList *outlist, *inlist; 9 9 Catalog incatalog, outcatalog; 10 10 char filename[256], *input, *output; … … 70 70 SkyTableSetFilenames (insky, input, "cpt"); 71 71 72 // XXX apply this...generate the subset matching the user-selected region 73 inlist = SkyListByPatch (insky, -1, &UserPatch); 74 72 75 // generate an output table populated at the desired depth 73 76 outsky = SkyTableLoadOptimal (output, NULL, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); … … 79 82 // loop over the populatable output tables; check for data in input in the corresponding regions 80 83 81 Sky TablePopulatedRange (&Ns, &Ne, insky, 0);82 depth = in sky[0].regions[Ns].depth;84 SkyListPopulatedRange (&Ns, &Ne, inlist, 0); 85 depth = inlist[0].regions[Ns][0].depth; 83 86 84 // loop over the populat able output regions85 for (i = 0; i < outsky[0].Nregions; i++) {86 if (! outsky[0].regions[i].table) continue;87 if (VERBOSE) fprintf (stderr, " output: %s\n", outsky[0].regions[i].name);87 // loop over the populated input regions 88 for (i = 0; i < inlist[0].Nregions; i++) { 89 if (!inlist[0].regions[i][0].table) continue; 90 if (VERBOSE) fprintf (stderr, "input: %s\n", inlist[0].regions[i][0].name); 88 91 89 SetPhotcodeTable( outputPhotcodes);92 SetPhotcodeTable(inputPhotcodes); 90 93 // load / create output catalog (if catalog does not exist, it will be created) 91 LoadCatalog (&outcatalog, &outsky[0].regions[i], outsky[0].filename[i], "w"); 94 LoadCatalog (&incatalog, &inlist[0].regions[i][0], inlist[0].filename[i], "r"); 95 // skip empty input catalogs 96 if (!incatalog.Naves_disk) { 97 dvo_catalog_unlock (&incatalog); 98 dvo_catalog_free (&incatalog); 99 continue; 100 } 92 101 93 102 // combine only tables at equal or larger depth … … 97 106 // compare to a slightly reduced footprint 98 107 float dPos = 2.0/3600.0; 99 inlist = SkyListByBounds (insky, depth, outsky[0].regions[i].Rmin + dPos, outsky[0].regions[i].Rmax - dPos, outsky[0].regions[i].Dmin + dPos, outsky[0].regions[i].Dmax - dPos);100 for (j = 0; j < inlist[0].Nregions; j++) {101 if (VERBOSE) fprintf (stderr, " input : %s\n", inlist[0].regions[j][0].name);108 outlist = SkyListByBounds (outsky, depth, inlist[0].regions[i][0].Rmin + dPos, inlist[0].regions[i][0].Rmax - dPos, inlist[0].regions[i][0].Dmin + dPos, inlist[0].regions[i][0].Dmax - dPos); 109 for (j = 0; j < outlist[0].Nregions; j++) { 110 if (VERBOSE) fprintf (stderr, "output : %s\n", outlist[0].regions[j][0].name); 102 111 103 112 // load input catalog 104 SetPhotcodeTable( inputPhotcodes);105 LoadCatalog (& incatalog, inlist[0].regions[j], inlist[0].filename[j], "r");113 SetPhotcodeTable(outputPhotcodes); 114 LoadCatalog (&outcatalog, outlist[0].regions[j], outlist[0].filename[j], "w"); 106 115 107 // skip empty input catalogs108 if (!incatalog.Naves_disk) {109 dvo_catalog_unlock (&incatalog);110 dvo_catalog_free (&incatalog);111 continue;112 }113 116 dvo_update_image_IDs (&IDmap, &incatalog); 114 merge_catalogs_old (&outsky[0].regions[i], &outcatalog, &incatalog, RADIUS, secfiltMap); 115 dvo_catalog_unlock (&incatalog); 116 dvo_catalog_free (&incatalog); 117 merge_catalogs_old (&outsky[0].regions[j], &outcatalog, &incatalog, RADIUS, secfiltMap); 117 118 118 fprintf (stderr, "merged %s into %s\n", outsky[0].regions[i].name, inlist[0].regions[j][0].name); 119 outcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 120 121 // if we receive a signal which would cause us to exit, wait until the full catalog is written 122 SetProtect (TRUE); 123 dvo_catalog_save (&outcatalog, VERBOSE); 124 SetProtect (FALSE); 125 126 dvo_catalog_unlock (&outcatalog); 127 dvo_catalog_free (&outcatalog); 128 129 fprintf (stderr, "merged %s into %s\n", inlist[0].regions[i][0].name, outlist[0].regions[j][0].name); 119 130 } 120 SkyListFree ( inlist);131 SkyListFree (outlist); 121 132 122 outcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 123 dvo_catalog_save (&outcatalog, VERBOSE); 124 dvo_catalog_unlock (&outcatalog); 125 dvo_catalog_free (&outcatalog); 133 dvo_catalog_unlock (&incatalog); 134 dvo_catalog_free (&incatalog); 126 135 } 127 136 … … 153 162 // load the image table 154 163 if (inDB.dbstate == LCK_EMPTY) { 155 Shutdown ("can't find input image catalog %s", inDB.filename); 164 // Shutdown ("can't find input image catalog %s", inDB.filename); 165 IDmap->Nmap = 0; 166 return TRUE; 156 167 } 157 168 if (!dvo_image_load (&inDB, VERBOSE, TRUE)) { -
trunk/Ohana/src/dvomerge/src/dvoverify.c
r28268 r29001 154 154 // convert the raw image table to Image type (byteswap if needed) 155 155 images = gfits_table_get_Image (&inDB.ftable, &Nimages, &inDB.swapped); 156 if (!images) { 157 fprintf (stderr, "ERROR: failed to read images\n"); 158 exit (2); 159 } 156 160 157 161 // update additional metadata -
trunk/Ohana/src/dvomerge/src/help.c
r27583 r29001 4 4 fprintf (stderr, "USAGE: dvomerge (input1) and (input2) to (output)\n"); 5 5 fprintf (stderr, " OR: dvomerge (input) into (output)\n"); 6 fprintf (stderr, " [-region Rmin Rmax Dmin Dmax]\n"); 6 7 exit (2); 7 8 } … … 10 11 11 12 fprintf (stderr, "USAGE: dvoconvert (input) to (output)\n"); 13 14 exit (2); 15 } 16 17 void dvosecfilt_usage(void) { 18 19 fprintf (stderr, "USAGE: dvosecfilt (input) -photcodes (photcodes.txt)\n"); 12 20 13 21 exit (2); … … 57 65 } 58 66 67 void dvosecfilt_help (int argc, char **argv) { 68 69 /* check for help request */ 70 if (get_argument (argc, argv, "-help")) goto show_help; 71 if (get_argument (argc, argv, "-h")) goto show_help; 72 return; 73 74 show_help: 75 76 fprintf (stderr, "USAGE\n"); 77 fprintf (stderr, " dvosecfilt (input) (Nsecfilt)\n\n"); 78 79 fprintf (stderr, " change number of secfilt entries in photcode table (updates secfilt tables only)\n"); 80 81 fprintf (stderr, " optional flags:\n"); 82 fprintf (stderr, " -v : verbose mode\n"); 83 fprintf (stderr, " -help : this list\n"); 84 fprintf (stderr, " -h : this list\n\n"); 85 exit (2); 86 } 87
Note:
See TracChangeset
for help on using the changeset viewer.
