Changeset 39579
- Timestamp:
- May 26, 2016, 1:34:24 PM (10 years ago)
- Location:
- trunk/Ohana/src/delstar
- Files:
-
- 6 edited
-
include/delstar.h (modified) (2 diffs)
-
src/ConfigInit.c (modified) (1 diff)
-
src/args.c (modified) (4 diffs)
-
src/delete_duplicate_measures.c (modified) (10 diffs)
-
src/delstar.c (modified) (1 diff)
-
src/delstar_client.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/delstar/include/delstar.h
r39307 r39579 83 83 char *SINGLE_CPT; 84 84 85 int SKIP_IMAGES; 85 int SAVE_DUPLICATES; 86 int SKIP_IMAGES; 86 87 87 88 time_t START; … … 138 139 int args_client (int argc, char **argv); 139 140 141 void delstar_args_free (); 142 void delstar_client_args_free (); 143 140 144 void SortAveMeasMatch (off_t *MEAS, off_t *AVE, off_t N); 141 145 -
trunk/Ohana/src/delstar/src/ConfigInit.c
r34749 r39579 54 54 } 55 55 56 FreeConfigFile(); 56 57 free (config); 57 58 free (file); -
trunk/Ohana/src/delstar/src/args.c
r39307 r39579 194 194 SKIP_IMAGES = TRUE; // we do not need to load the images for -dup-measures 195 195 } 196 197 SAVE_DUPLICATES = FALSE; 198 if ((N = get_argument (argc, argv, "-save-duplicates"))) { 199 SAVE_DUPLICATES = TRUE; 200 remove_argument (N, &argc, argv); 201 } 202 196 203 if ((N = get_argument (argc, argv, "-fix-LAP"))) { 197 204 if (MODE != MODE_NONE) usage(); … … 316 323 } 317 324 325 void delstar_args_free () { 326 FREE (SINGLE_CPT); 327 FREE (IMAGENAME); 328 FREE (UNIQUER); 329 FREE (CATDIR); 330 FREE (EDGE_DELETIONS); 331 FREE (PHOTCODE_LIST); 332 FREE (IMSTATS_FILE); 333 } 334 318 335 int args_client (int argc, char **argv) { 319 336 … … 453 470 } 454 471 472 SAVE_DUPLICATES = FALSE; 473 if ((N = get_argument (argc, argv, "-save-duplicates"))) { 474 SAVE_DUPLICATES = TRUE; 475 remove_argument (N, &argc, argv); 476 } 477 455 478 MEASURE_EDGE_FILE = NULL; 456 479 if (MODE == MODE_FIX_LAP_EDGES) { … … 484 507 return (TRUE); 485 508 } 509 510 void delstar_client_args_free () { 511 FREE (CATDIR); 512 FREE (HOSTDIR); 513 FREE (SINGLE_CPT); 514 FREE (IMAGES); 515 FREE (PHOTCODE_LIST); 516 FREE (EDGE_DELETIONS); 517 FREE (MEASURE_EDGE_FILE); 518 FREE (IMSTATS_FILE); 519 } 520 -
trunk/Ohana/src/delstar/src/delete_duplicate_measures.c
r38986 r39579 31 31 if (PARALLEL && !HOST_ID) { 32 32 int status = delete_duplicate_measures_parallel (skylist); 33 34 SkyTableFree (sky); 35 SkyListFree (skylist); 36 FreePhotcodeTable (); 37 33 38 return status; 34 39 } … … 79 84 dvo_catalog_free (&catalog); 80 85 } 86 87 SkyTableFree (sky); 88 SkyListFree (skylist); 89 FreePhotcodeTable (); 90 81 91 return TRUE; 82 92 } … … 117 127 table->hosts[i].pathname = tmppath; 118 128 119 char command[1024];120 s nprintf (command, 1024, "delstar_client -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -dup-measures",129 char *command = NULL; 130 strextend (&command, "delstar_client -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -dup-measures", 121 131 table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, 122 132 UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax); 123 133 124 char tmpline[1024];125 if (VERBOSE ) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline);}126 if ( VERBOSE2) { snprintf (tmpline, 1024, "%s -vv", command); strcpy (command, tmpline); }127 if ( SINGLE_CPT) { snprintf (tmpline, 1024, "%s -cpt %s", command, SINGLE_CPT); strcpy (command, tmpline);}128 if ( UPDATE) { snprintf (tmpline, 1024, "%s -update", command); strcpy (command, tmpline);}134 if (VERBOSE) { strextend (&command, "-v"); } 135 if (VERBOSE2) { strextend (&command, "-vv"); } 136 if (SINGLE_CPT) { strextend (&command, "-cpt %s", SINGLE_CPT); } 137 if (UPDATE) { strextend (&command, "-update"); } 138 if (SAVE_DUPLICATES) { strextend (&command, "-save-duplicates"); } 129 139 130 140 fprintf (stderr, "command: %s\n", command); 131 141 132 if (PARALLEL_MANUAL) continue; 142 if (PARALLEL_MANUAL) { 143 free (command); 144 continue; 145 } 133 146 134 147 if (PARALLEL_SERIAL) { … … 148 161 table->hosts[i].pid = pid; // save for future reference 149 162 } 163 free (command); 150 164 } 151 165 … … 157 171 HostTableWaitJobsGetIO (table, __FILE__, __LINE__, VERBOSE); 158 172 } 173 174 FreeHostTable(table); 159 175 160 176 return TRUE; … … 211 227 memset (duplicates, 0, sizeof(int) * Nmeasure); 212 228 229 for (i = 0; i < Naverage; i++) { 230 averageNmeas[i] = 0; 231 averageDmeas[i] = -1; 232 } 233 213 234 // make an array of the full IDs 214 235 for (i = 0; i < Nmeasure; i++) { … … 236 257 } 237 258 259 FILE *fsave = NULL; 260 if (SAVE_DUPLICATES) { 261 char savename[DVO_MAX_PATH]; 262 snprintf (savename, DVO_MAX_PATH, "%s.save", catalog->filename); 263 struct stat filestat; 264 int myStatus = stat (savename, &filestat); 265 if (myStatus && (errno == ENOENT)) { 266 fsave = fopen (savename, "w"); 267 if (!fsave) { 268 fprintf (stderr, "problem opening file %s for output\n", savename); 269 } 270 } else { 271 if (!myStatus) { 272 fprintf (stderr, "file %s exists: will not overwrite\n", savename); 273 } 274 } 275 } 276 238 277 // mark the measures to be dropped 239 278 for (i = 0; i < Nmeasure; i++) { … … 243 282 off_t N = measure[j].averef; 244 283 if (VERBOSE) fprintf (stderr, "0x%08x 0x%08x %8.4f %8.4f %5d\n", measure[j].imageID, measure[j].detID, average[N].R, average[N].D, measure[j].photcode); 245 } 284 if (fsave) { 285 fprintf (fsave, "0x%08x 0x%08x %8.4f %8.4f %5d\n", measure[j].imageID, measure[j].detID, average[N].R, average[N].D, measure[j].photcode); 286 } 287 } 288 289 if (fsave) fclose (fsave); 246 290 247 291 // set up the measure sequence lists … … 267 311 // n = measureRefOut[i] : measureOut[n] = measure[i] 268 312 ALLOCATE (measureAveOut, off_t, NmeasOut); 313 314 269 315 270 316 // count the number of measures for each averef … … 293 339 294 340 // generate the new average sequence, skipping entries with no measurements 341 // update 20160524 : keep entries with no measurements 295 342 off_t NaveOut = 0; 296 343 for (i = 0; i < Naverage; i++) { 297 if (averageNmeas[i] == 0) continue;344 // if (averageNmeas[i] == 0) continue; 298 345 averageSeqOut[NaveOut] = i; 299 346 averageRefOut[i] = NaveOut; -
trunk/Ohana/src/delstar/src/delstar.c
r38441 r39579 27 27 case MODE_DUP_MEASURES: 28 28 if (!delete_duplicate_measures ()) exit (1); 29 delstar_args_free (); 30 ohana_memcheck (TRUE); 31 ohana_memdump (TRUE); 29 32 exit (0); 30 33 break; -
trunk/Ohana/src/delstar/src/delstar_client.c
r35758 r39579 23 23 } 24 24 if (!delete_duplicate_image_measures (imageID)) exit (1); 25 delstar_client_args_free (); 26 ohana_memcheck (TRUE); 27 ohana_memdump (TRUE); 25 28 exit (0); 26 29 break; 27 30 case MODE_DUP_MEASURES: 28 31 if (!delete_duplicate_measures ()) exit (1); 32 delstar_client_args_free (); 33 ohana_memcheck (TRUE); 34 ohana_memdump (TRUE); 29 35 exit (0); 30 36 break;
Note:
See TracChangeset
for help on using the changeset viewer.
