Changeset 35765
- Timestamp:
- Jul 3, 2013, 2:24:26 PM (13 years ago)
- Location:
- trunk/Ohana/src/dvomerge
- Files:
-
- 11 edited
- 2 copied
-
. (modified) (1 prop)
-
include/dvomerge.h (modified) (2 diffs)
-
src/args.c (modified) (7 diffs)
-
src/dvomerge.c (modified) (2 diffs)
-
src/dvomergeImageIDs.c (modified) (1 diff)
-
src/dvomergeUpdate.c (modified) (2 diffs)
-
src/dvomergeUpdate_catalogs.c (modified) (10 diffs)
-
src/dvomergeUpdate_threaded.c (modified) (2 diffs)
-
src/dvomerge_client.c (modified) (1 diff)
-
test (modified) (1 prop)
-
test/dvomerge.parallel-input.sh (copied) (copied from branches/eam_branches/ipp-20130509/Ohana/src/dvomerge/test/dvomerge.parallel-input.sh )
-
test/dvomerge.parallel-parallel.sh (copied) (copied from branches/eam_branches/ipp-20130509/Ohana/src/dvomerge/test/dvomerge.parallel-parallel.sh )
-
test/dvomerge.parallel.sh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/dvomerge
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130509/Ohana/src/dvomerge (added) merged: 35594,35597,35619,35699,35705,35720,35745,35749
- Property svn:mergeinfo changed
-
trunk/Ohana/src/dvomerge/include/dvomerge.h
r35590 r35765 24 24 char *HOSTDIR; 25 25 26 int PARALLEL_INPUT; 27 26 28 int VERBOSE; 27 29 int VERIFY; 30 int VERIFY_CATALOG_ONLY; 31 int IMAGES_ONLY; 28 32 char CATDIR[256]; 29 33 char GSCFILE[256]; … … 36 40 char *ALTERNATE_PHOTCODE_FILE; 37 41 int REPLACE_BY_PHOTCODE; 42 int FORCE_MERGE; 38 43 39 44 char *SINGLE_CPT; -
trunk/Ohana/src/dvomerge/src/args.c
r35590 r35765 15 15 /* verify merge status of output tables, but do not modify */ 16 16 VERIFY = FALSE; 17 VERIFY_CATALOG_ONLY = FALSE; 17 18 if ((N = get_argument (*argc, argv, "-verify"))) { 18 19 VERIFY = TRUE; … … 21 22 if ((N = get_argument (*argc, argv, "-check-only"))) { 22 23 VERIFY = TRUE; 24 remove_argument (N, argc, argv); 25 } 26 if ((N = get_argument (*argc, argv, "-verify-catalogs"))) { 27 VERIFY = TRUE; 28 VERIFY_CATALOG_ONLY = TRUE; 29 remove_argument (N, argc, argv); 30 } 31 32 /* extra error messages */ 33 IMAGES_ONLY = FALSE; 34 if ((N = get_argument (*argc, argv, "-images-only"))) { 35 IMAGES_ONLY = TRUE; 23 36 remove_argument (N, argc, argv); 24 37 } … … 28 41 remove_argument (N, argc, argv); 29 42 ALTERNATE_PHOTCODE_FILE = strcreate(argv[N]); 43 remove_argument (N, argc, argv); 44 } 45 46 // merge even if header claims db has already been merged 47 FORCE_MERGE = FALSE; 48 if ((N = get_argument (*argc, argv, "-force-merge"))) { 49 FORCE_MERGE = TRUE; 30 50 remove_argument (N, argc, argv); 31 51 } … … 63 83 } 64 84 85 // is the input database a parallel db? 86 PARALLEL_INPUT = FALSE; 87 if ((N = get_argument (*argc, argv, "-parallel-input"))) { 88 PARALLEL_INPUT = TRUE; 89 remove_argument (N, argc, argv); 90 } 91 92 // is the output database a parallel db? 65 93 PARALLEL = FALSE; 66 94 if ((N = get_argument (*argc, argv, "-parallel"))) { … … 102 130 PARALLEL_MANUAL = FALSE; 103 131 PARALLEL_SERIAL = FALSE; 132 IMAGES_ONLY = FALSE; 133 134 // is the input database a parallel db? 135 PARALLEL_INPUT = FALSE; 136 if ((N = get_argument (*argc, argv, "-parallel-input"))) { 137 PARALLEL_INPUT = TRUE; 138 remove_argument (N, argc, argv); 139 } 104 140 105 141 HOST_ID = 0; … … 134 170 if ((N = get_argument (*argc, argv, "-check-only"))) { 135 171 VERIFY = TRUE; 172 remove_argument (N, argc, argv); 173 } 174 if ((N = get_argument (*argc, argv, "-verify-catalogs"))) { 175 VERIFY = TRUE; 176 VERIFY_CATALOG_ONLY = TRUE; 177 remove_argument (N, argc, argv); 178 } 179 180 // merge even if header claims db has already been merged 181 FORCE_MERGE = FALSE; 182 if ((N = get_argument (*argc, argv, "-force-merge"))) { 183 FORCE_MERGE = TRUE; 136 184 remove_argument (N, argc, argv); 137 185 } … … 227 275 } 228 276 277 // is the output database a parallel db? 229 278 PARALLEL = FALSE; 230 279 if ((N = get_argument (*argc, argv, "-parallel"))) { -
trunk/Ohana/src/dvomerge/src/dvomerge.c
r35590 r35765 14 14 exit (3); 15 15 } 16 if (IMAGES_ONLY) { 17 fprintf (stderr, "ERROR : dvomerge (input1) and (input2) into (output) : not compatible with '-images-only'\n"); 18 exit (5); 19 } 16 20 dvomergeCreate (argc, argv); 17 21 } else { … … 19 23 fprintf (stderr, "WARNING / ERROR : dvomerge (input) into (output) from (list) : VERIFY mode not implemented\n"); 20 24 exit (3); 25 } 26 if (IMAGES_ONLY) { 27 fprintf (stderr, "ERROR : dvomerge (input) input (output) from (list) : not compatible with '-images-only'\n"); 28 exit (5); 21 29 } 22 30 dvomergeFromList (argc, argv); -
trunk/Ohana/src/dvomerge/src/dvomergeImageIDs.c
r34405 r35765 87 87 int status; 88 88 89 if (VERIFY && VERIFY_CATALOG_ONLY) return TRUE; 90 89 91 /*** load input1/Images.dat ***/ 90 92 sprintf (ImageCat, "%s/Images.dat", input); -
trunk/Ohana/src/dvomerge/src/dvomergeUpdate.c
r35590 r35765 22 22 if (strcasecmp (argv[4], "continue")) dvomerge_usage(); 23 23 CONTINUE = TRUE; 24 if (IMAGES_ONLY) { 25 fprintf (stderr, "-images-only is not compatible with the 'continue' option\n"); 26 exit (5); 27 } 24 28 } 25 29 if (VERIFY) CONTINUE = TRUE; … … 79 83 } else { 80 84 dvomergeImagesUpdate (&IDmap, input, output); 85 if (IMAGES_ONLY) exit (0); 81 86 } 82 87 -
trunk/Ohana/src/dvomerge/src/dvomergeUpdate_catalogs.c
r35590 r35765 19 19 int status = dvomergeUpdate_parallel (input, output, outsky, IDmap); 20 20 return status; 21 } 22 23 // load the list of hosts 24 HostTable *table_input = NULL; 25 if (PARALLEL_INPUT) { 26 table_input = HostTableLoad (input, inlist->hosts); 27 if (!table_input) { 28 fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", inlist->hosts, input); 29 exit (1); 30 } 31 32 // ensure we have absolute paths for hostdirs 33 for (i = 0; i < table_input->Nhosts; i++) { 34 char *tmppath = abspath (table_input->hosts[i].pathname, DVO_MAX_PATH); 35 free (table_input->hosts[i].pathname); 36 table_input->hosts[i].pathname = tmppath; 37 } 21 38 } 22 39 … … 25 42 if (!inlist[0].regions[i][0].table) continue; 26 43 if (VERBOSE) fprintf (stderr, "input: %s\n", inlist[0].regions[i][0].name); 44 45 // in a parallel context, we need to re-map the input filename 46 char *filename_input = strcreate (inlist[0].filename[i]); 47 if (PARALLEL_INPUT) { 48 49 int hostID_input = inlist[0].regions[i]->hostID; 50 int table_index = table_input->index[hostID_input]; 51 char *hostdir_input = table_input->hosts[table_index].pathname; 52 53 // set the parameters which guide catalog open/load/create 54 char hostfile_input[DVO_MAX_PATH]; 55 snprintf (hostfile_input, DVO_MAX_PATH, "%s/%s.cpt", hostdir_input, inlist[0].regions[i]->name); 56 free (filename_input); 57 filename_input = strcreate (hostfile_input); 58 } 27 59 28 60 // SkyListByBounds will return neighbor catalogs if the boundaries exactly match (due to rounding). Since the regions are not infinitely small, … … 45 77 OutputStatusFree (outstat, outlist->Nregions); 46 78 SkyListFree (outlist); 79 free (filename_input); 47 80 continue; 48 81 } 49 82 50 83 // get stats for history check, skip input catalog if file not found (NULL inStats) 51 dmhObjectStats *inStats = dmhObjectStatsRead ( inlist[0].filename[i]);84 dmhObjectStats *inStats = dmhObjectStatsRead (filename_input); 52 85 if (!inStats) { 53 if (VERBOSE) fprintf (stderr, "skipping %s, empty \n", inlist[0].filename[i]); 54 OutputStatusFree (outstat, outlist->Nregions); 55 SkyListFree (outlist); 86 if (VERBOSE) fprintf (stderr, "skipping %s, empty \n", filename_input); 87 OutputStatusFree (outstat, outlist->Nregions); 88 SkyListFree (outlist); 89 free (filename_input); 56 90 continue; 57 91 } … … 75 109 missed = (missed || outstat[j].missed); 76 110 } 77 if (! missed) {78 if (VERBOSE || VERIFY) fprintf (stderr, "skipping %s, already merged\n", inlist[0].filename[i]);111 if (!FORCE_MERGE && !missed) { 112 if (VERBOSE || VERIFY) fprintf (stderr, "skipping %s, already merged\n", filename_input); 79 113 OutputStatusFree (outstat, outlist->Nregions); 80 114 dmhObjectStatsFree (inStats); 81 115 SkyListFree (outlist); 116 free (filename_input); 82 117 continue; 83 118 } 84 119 if (VERIFY) { 85 fprintf (stderr, "%s NOT merged\n", inlist[0].filename[i]); 120 fprintf (stderr, "%s NOT merged\n", filename_input); 121 OutputStatusFree (outstat, outlist->Nregions); 122 dmhObjectStatsFree (inStats); 123 SkyListFree (outlist); 124 free (filename_input); 86 125 continue; 87 126 } 88 127 89 128 // read the input catalog 90 LoadCatalog (&incatalog, &inlist[0].regions[i][0], inlist[0].filename[i], "r", NsecfiltInput);129 LoadCatalog (&incatalog, &inlist[0].regions[i][0], filename_input, "r", NsecfiltInput); 91 130 92 131 // skip empty input catalogs … … 97 136 dmhObjectStatsFree (inStats); 98 137 SkyListFree (outlist); 138 free (filename_input); 99 139 continue; 100 140 } … … 106 146 107 147 // skip if we have already done the merge 108 if (! outstat[j].missed) continue;148 if (!FORCE_MERGE && !outstat[j].missed) continue; 109 149 110 150 if (VERBOSE) fprintf (stderr, "output : %s\n", outlist[0].regions[j][0].name); … … 121 161 outcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 122 162 123 dmhObjectAdd (outstat[j].history, &outcatalog.header, inStats); 163 if (outstat[i].missed) { 164 dmhObjectAdd (outstat[j].history, &outcatalog.header, inStats); 165 } 124 166 125 167 if (!dvo_catalog_backup (&outcatalog, TRUE)) { … … 150 192 dmhObjectStatsFree (inStats); 151 193 194 free (filename_input); 152 195 dvo_catalog_unlock (&incatalog); 153 196 dvo_catalog_free (&incatalog); … … 167 210 snprintf (IDmapFilename, DVO_MAX_PATH, "%s/IDmap.fits", absoutput); 168 211 169 // save IDmap information 170 if (!IDmapSave (IDmapFilename, IDmap)) { 171 fprintf (stderr, "ERROR: failure to save the image ID map\n"); 172 exit (1); 212 if (!VERIFY_CATALOG_ONLY) { 213 // save IDmap information 214 if (!IDmapSave (IDmapFilename, IDmap)) { 215 fprintf (stderr, "ERROR: failure to save the image ID map\n"); 216 exit (1); 217 } 173 218 } 174 219 … … 196 241 197 242 char tmpline[DVO_MAX_PATH]; 198 if (VERBOSE) { snprintf (tmpline, DVO_MAX_PATH, "%s -v", command); strcpy (command, tmpline); } 199 if (VERIFY) { snprintf (tmpline, DVO_MAX_PATH, "%s -verify", command); strcpy (command, tmpline); } 200 if (REPLACE_BY_PHOTCODE) { snprintf (tmpline, DVO_MAX_PATH, "%s -replace", command); strcpy (command, tmpline); } 243 if (VERBOSE) { snprintf (tmpline, DVO_MAX_PATH, "%s -v", command); strcpy (command, tmpline); } 244 if (VERIFY) { snprintf (tmpline, DVO_MAX_PATH, "%s -verify", command); strcpy (command, tmpline); } 245 if (VERIFY_CATALOG_ONLY) { snprintf (tmpline, DVO_MAX_PATH, "%s -verify-catalogs", command); strcpy (command, tmpline); } 246 if (REPLACE_BY_PHOTCODE) { snprintf (tmpline, DVO_MAX_PATH, "%s -replace", command); strcpy (command, tmpline); } 247 if (PARALLEL_INPUT) { snprintf (tmpline, DVO_MAX_PATH, "%s -parallel-input", command); strcpy (command, tmpline); } 248 if (FORCE_MERGE) { snprintf (tmpline, DVO_MAX_PATH, "%s -force-merge", command); strcpy (command, tmpline); } 201 249 202 250 fprintf (stderr, "command: %s\n", command); -
trunk/Ohana/src/dvomerge/src/dvomergeUpdate_threaded.c
r35590 r35765 124 124 if (strcasecmp (argv[4], "continue")) dvomerge_usage(); 125 125 CONTINUE = TRUE; 126 if (IMAGES_ONLY) { 127 fprintf (stderr, "-images-only is not compatible with the 'continue' option\n"); 128 exit (5); 129 } 126 130 } 127 131 … … 183 187 } else { 184 188 dvomergeImagesUpdate (&IDmap, input, output); 189 if (IMAGES_ONLY) exit (0); 185 190 } 186 191 -
trunk/Ohana/src/dvomerge/src/dvomerge_client.c
r33963 r35765 55 55 snprintf (IDmapFilename, DVO_MAX_PATH, "%s/IDmap.fits", absoutput); 56 56 57 // save IDmap information 58 IDmap = IDmapLoad (IDmapFilename); 59 if (!IDmap) { 60 fprintf (stderr, "ERROR: failure to save the image ID map\n"); 61 exit (1); 57 if (!VERIFY_CATALOG_ONLY) { 58 // save IDmap information 59 IDmap = IDmapLoad (IDmapFilename); 60 if (!IDmap) { 61 fprintf (stderr, "ERROR: failure to save the image ID map\n"); 62 exit (1); 63 } 62 64 } 63 65 -
trunk/Ohana/src/dvomerge/test
- Property svn:ignore
-
old new 4 4 catdir.merge.p2 5 5 catdir.merge.p3 6 catdir.2mass.input 7 catdir.2mass.input.p1 8 catdir.2mass.input.p2 9 catdir.2mass.input.p3 10 catdir.grizy.output 11 catdir.grizy.output.p1 12 catdir.grizy.output.p2 13 catdir.grizy.output.p3
-
- Property svn:ignore
-
trunk/Ohana/src/dvomerge/test/dvomerge.parallel.sh
r33963 r35765 1 1 #!/bin/csh -f 2 2 3 rm -rf catdir.merge 4 rsync - auv catdir.2mass/ catdir.merge/3 rm -rf catdir.merge catdir.merge.p? 4 rsync --exclude=.svn -auv catdir.2mass/ catdir.merge/ 5 5 cp HostTable.dat catdir.merge/ 6 6 dvodist -out catdir.merge 7 rm -rf catdir.merge/n???? 8 7 9 dvomerge -parallel catdir.grizy into catdir.merge 10 dvomerge -parallel catdir.grizy into catdir.merge -verify
Note:
See TracChangeset
for help on using the changeset viewer.
