Changeset 35721
- Timestamp:
- Jun 28, 2013, 2:01:13 PM (13 years ago)
- Location:
- branches/eam_branches/ipp-20130509/Ohana/src/delstar
- Files:
-
- 5 edited
-
include/delstar.h (modified) (3 diffs)
-
src/ImageOpsFixLAP.c (modified) (3 diffs)
-
src/args.c (modified) (2 diffs)
-
src/delete_fix_LAP.c (modified) (5 diffs)
-
src/delstar.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130509/Ohana/src/delstar/include/delstar.h
r35713 r35721 77 77 78 78 char *PHOTCODE_LIST; 79 char *UNIQUER; 79 80 80 81 int MODE; 81 enum {MODE_NONE, MODE_IMAGENAME, MODE_IMAGEFILE, MODE_TIME, MODE_ORPHAN, MODE_MISSED, MODE_PHOTCODES, MODE_DUP_IMAGES, MODE_DUP_MEASURES, MODE_FIX_LAP };82 enum {MODE_NONE, MODE_IMAGENAME, MODE_IMAGEFILE, MODE_TIME, MODE_ORPHAN, MODE_MISSED, MODE_PHOTCODES, MODE_DUP_IMAGES, MODE_DUP_MEASURES, MODE_FIX_LAP, MODE_FIX_LAP_STATS}; 82 83 83 84 char DateKeyword[64], DateMode[64], UTKeyword[64], MJDKeyword[64], JDKeyword[64]; … … 151 152 int delete_fix_LAP_measures (off_t *measureDrop, Catalog *catalog, ImageSubset *image, off_t Nimage); 152 153 int delete_fix_LAP_parallel (SkyList *sky, ImageSubset *image, off_t Nimage); 154 int delete_fix_LAP_setstats (ImageSubset *image, off_t Nimage); 153 155 154 156 void initImageIndex (ImageSubset *image, off_t Nimage_init); … … 166 168 int ImageValidLoad(char *filename); 167 169 void SummaryImageStats (ImageSubset *image, off_t Nimage_comp); 170 void SummaryImageStats_Full (Image *image, off_t Nimage_comp); 168 171 void BumpInvalidImage (int Seq); 169 172 void BumpValidImage (int Seq); -
branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/ImageOpsFixLAP.c
r35713 r35721 253 253 254 254 int Nfixed = 0; 255 int Nphu = 0; 256 int Nexp = 0; 257 int Nstk = 0; 255 258 int Nskip = 0; 256 259 int Nbad_1 = 0; … … 258 261 259 262 for (i = 0; i < Nimage_comp; i++) { 260 if (image[i].photcode == 0) continue; // skip images with 0 photcode (eg, PHU) 263 if (image[i].photcode == 0) { 264 Nphu ++; 265 continue; // skip images with 0 photcode (eg, PHU) 266 } 267 268 if ((image[i].photcode > 10000) && (image[i].photcode < 10600)) Nexp ++; 269 if ((image[i].photcode >= 11000) && (image[i].photcode <= 11600)) Nstk ++; 261 270 262 271 if (Nimage_valid[i] + Nimage_invalid[i] == 0) Nskip ++; … … 270 279 } 271 280 272 fprintf (stderr, "Nfixed: %d, Nskip %d, Ndrop (>1%%) %d, Ndrop (>5%%) %d\n", Nfixed, Nskip, Nbad_1, Nbad_2); 281 fprintf (stderr, "Nimage: "OFF_T_FMT"\n", Nimage_comp); 282 fprintf (stderr, "Nfixed: %d\n", Nfixed); 283 fprintf (stderr, "Nphu: %d\n", Nphu); 284 fprintf (stderr, "Nexp: %d\n", Nexp); 285 fprintf (stderr, "Nstk: %d\n", Nstk); 286 fprintf (stderr, "Nskip: %d\n", Nskip); 287 fprintf (stderr, "Ndrop (>1%%): %d\n", Nbad_1); 288 fprintf (stderr, "Ndrop (>5%%): %d\n", Nbad_2); 289 } 290 291 void SummaryImageStats_Full (Image *image, off_t Nimage_comp) { 292 293 off_t i; 294 295 // let's report the following: 296 // Nimages with corrected image IDs 297 // Nimages with Nsum / Nstar < 0.95 298 // Nimages with Nsum / Nstar < 0.99 299 300 int Nfixed = 0; 301 int Nphu = 0; 302 int Nexp = 0; 303 int Nstk = 0; 304 int Nskip = 0; 305 int Nbad_1 = 0; 306 int Nbad_2 = 0; 307 308 BuildChipMatch (image, Nimage); 309 310 for (i = 0; i < Nimage_comp; i++) { 311 if (image[i].photcode == 0) { 312 Nphu ++; 313 continue; // skip images with 0 photcode (eg, PHU) 314 } 315 316 if ((image[i].photcode > 10000) && (image[i].photcode < 10600)) Nexp ++; 317 if ((image[i].photcode >= 11000) && (image[i].photcode <= 11600)) Nstk ++; 318 319 float found_ratio = (Nimage_valid[i] + Nimage_invalid[i]) / (float) image[i].nstar; 320 321 if ((Nimage_valid[i] + Nimage_invalid[i] == 0) || (found_ratio < 0.995)) { 322 double r, d; 323 if (!FindMosaicForImage (image, Nimage, i)) { 324 fprintf (stderr, "failed to get astrometry for %s\n", image[i].name); 325 } else { 326 if (!strcmp(&image[i].coords.ctype[4], "-DIS")) { 327 XY_to_RD (&r, &d, 0.0, 0.0, &image[i].coords); 328 } else { 329 XY_to_RD (&r, &d, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords); 330 } 331 } 332 char *date = ohana_sec_to_date (image[i].tzero); 333 fprintf (stderr, "skip : %s %d %10.6f %10.6f %5.3f %s\n", date, image[i].photcode, r, d, found_ratio, image[i].name); 334 free (date); 335 Nskip ++; 336 } 337 338 if (Nimage_invalid[i] > 0) Nfixed ++; 339 340 341 if (found_ratio < 0.99) Nbad_1 ++; 342 if (found_ratio < 0.95) Nbad_2 ++; 343 } 344 345 fprintf (stderr, "Nimage: "OFF_T_FMT"\n", Nimage_comp); 346 fprintf (stderr, "Nfixed: %d\n", Nfixed); 347 fprintf (stderr, "Nphu: %d\n", Nphu); 348 fprintf (stderr, "Nexp: %d\n", Nexp); 349 fprintf (stderr, "Nstk: %d\n", Nstk); 350 fprintf (stderr, "Nskip: %d\n", Nskip); 351 fprintf (stderr, "Ndrop (>1%%): %d\n", Nbad_1); 352 fprintf (stderr, "Ndrop (>5%%): %d\n", Nbad_2); 273 353 } 274 354 -
branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/args.c
r35713 r35721 71 71 } 72 72 73 // we should never delete the images before the measures (or we won't know what to delete)74 // -image-only is for testing73 // We should generally not delete the images before the measures (or we won't know what 74 // to delete). -image-only is for testing, -image-only-force -update WILL delete the images 75 75 IMAGE_ONLY = FALSE; 76 76 if ((N = get_argument (argc, argv, "-image-only"))) { 77 77 IMAGE_ONLY = TRUE; 78 78 UPDATE = FALSE; 79 remove_argument (N, &argc, argv); 80 } 81 if ((N = get_argument (argc, argv, "-image-only-force"))) { 82 IMAGE_ONLY = TRUE; 79 83 remove_argument (N, &argc, argv); 80 84 } … … 179 183 if (MODE != MODE_NONE) usage(); 180 184 MODE = MODE_FIX_LAP; 185 remove_argument (N, &argc, argv); 186 } 187 UNIQUER = NULL; 188 if ((N = get_argument (argc, argv, "-fix-LAP-imstats"))) { 189 if (MODE != MODE_NONE) usage(); 190 MODE = MODE_FIX_LAP_STATS; 191 remove_argument (N, &argc, argv); 192 UNIQUER = strcreate (argv[N]); 181 193 remove_argument (N, &argc, argv); 182 194 } -
branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/delete_fix_LAP.c
r35713 r35721 23 23 } 24 24 25 // this is needed in the master and client jobs (in master, just so Nimage is set in ImageOpsFixLAP.c) 26 initImageIndex (image, Nimage); 27 25 28 // launch the remote jobs 26 29 if (PARALLEL && !HOST_ID) { … … 28 31 return status; 29 32 } 30 31 initImageIndex (image, Nimage);32 33 33 34 // delete detections from region … … 170 171 171 172 for (i = 0; i < table->Nhosts; i++) { 172 while (!ImageValidLoad (table->hosts[i].results)) { 173 if (!table->hosts[i].results) continue; 174 if (!ImageValidLoad (table->hosts[i].results)) { 175 fprintf (stderr, "failed to read data from %s\n", table->hosts[i].hostname); 176 } 177 } 178 179 return TRUE; 180 } 181 182 // CATDIR is supplied globally 183 int delete_fix_LAP_setstats (ImageSubset *image, off_t Nimage) { 184 185 // load the current sky table (layout of all SkyRegions) 186 SkyTable *sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, TRUE, -1, VERBOSE); 187 if (!sky) { 188 fprintf (stderr, "ERROR running loading sky table from %s\n", CATDIR); 189 exit (2); 190 } 191 SkyTableSetFilenames (sky, CATDIR, "cpt"); 192 193 // determine the populated SkyRegions overlapping the requested area (default depth) 194 SkyList *skylist = SINGLE_CPT ? SkyRegionByCPT (sky, SINGLE_CPT) : SkyListByPatch (sky, -1, &UserPatch); 195 if (!skylist) { 196 fprintf (stderr, "ERROR setting up skylist for %s\n", CATDIR); 197 exit (2); 198 } 199 fprintf (stderr, "setup sky\n"); 200 201 // this is needed in the master and client jobs (in master, just so Nimage is set in ImageOpsFixLAP.c) 202 initImageIndex (image, Nimage); 203 fprintf (stderr, "make index\n"); 204 205 // write out the subset table of image information 206 char imageFile[512]; 207 snprintf (imageFile, 512, "%s/delstar.fixLAP.%s.dat", CATDIR, UNIQUER); 208 209 // load the list of hosts 210 HostTable *table = HostTableLoad (CATDIR, sky->hosts); 211 if (!table) { 212 fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR); 213 exit (1); 214 } 215 216 int i; 217 for (i = 0; i < table->Nhosts; i++) { 218 219 // ensure that the paths are absolute path names 220 char *tmppath = abspath (table->hosts[i].pathname, DVO_MAX_PATH); 221 free (table->hosts[i].pathname); 222 table->hosts[i].pathname = tmppath; 223 224 ALLOCATE (table->hosts[i].results, char, 1024); 225 snprintf (table->hosts[i].results, 1024, "%s/delstar.fixLAP.imstats.%s.dat", table->hosts[i].pathname, UNIQUER); 226 227 fprintf (stderr, "read %s\n", table->hosts[i].results); 228 if (!ImageValidLoad (table->hosts[i].results)) { 173 229 fprintf (stderr, "failed to read data from %s\n", table->hosts[i].hostname); 174 230 } … … 517 573 } 518 574 measure[j].imageID = imageID; 519 BumpInvalidImage ( imageN);575 BumpInvalidImage (Seq); 520 576 Ninvalid ++; 521 577 continue; … … 568 624 } 569 625 measure[j].imageID = imageID; 570 BumpInvalidImage ( imageN);626 BumpInvalidImage (Seq); 571 627 Ninvalid ++; 572 628 continue; -
branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/delstar.c
r35713 r35721 46 46 break; 47 47 } 48 case MODE_FIX_LAP_STATS: { 49 off_t Nimage; 50 Image *image = gfits_table_get_Image (&db.ftable, &Nimage, &db.swapped); 51 if (!image) { 52 fprintf (stderr, "ERROR: failed to read images\n"); 53 exit (2); 54 } 55 // dvo_image_unlock (&db); 56 fprintf (stderr, "read images\n"); 57 58 // the imageSubset here is a reduced set of fields, not a reduced set of images 59 ImageSubset *subset = ImagesToSubset (image, Nimage); 60 fprintf (stderr, "make subset\n"); 61 62 if (!delete_fix_LAP_setstats (subset, Nimage)) exit (1); 63 SummaryImageStats_Full (image, Nimage); 64 65 exit (0); 66 break; 67 } 48 68 case MODE_IMAGEFILE: 49 69 delete_imagefile (&db);
Note:
See TracChangeset
for help on using the changeset viewer.
