IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35721


Ignore:
Timestamp:
Jun 28, 2013, 2:01:13 PM (13 years ago)
Author:
eugene
Message:

add mode to reload the image stats and write summary info; add option to force -image-only but not -update

Location:
branches/eam_branches/ipp-20130509/Ohana/src/delstar
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130509/Ohana/src/delstar/include/delstar.h

    r35713 r35721  
    7777
    7878char *PHOTCODE_LIST;
     79char *UNIQUER;
    7980
    8081int    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};
     82enum {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};
    8283
    8384char DateKeyword[64], DateMode[64], UTKeyword[64], MJDKeyword[64], JDKeyword[64];
     
    151152int delete_fix_LAP_measures (off_t *measureDrop, Catalog *catalog, ImageSubset *image, off_t Nimage);
    152153int delete_fix_LAP_parallel (SkyList *sky, ImageSubset *image, off_t Nimage);
     154int delete_fix_LAP_setstats (ImageSubset *image, off_t Nimage);
    153155
    154156void initImageIndex (ImageSubset *image, off_t Nimage_init);
     
    166168int ImageValidLoad(char *filename);
    167169void SummaryImageStats (ImageSubset *image, off_t Nimage_comp);
     170void SummaryImageStats_Full (Image *image, off_t Nimage_comp);
    168171void BumpInvalidImage (int Seq);
    169172void BumpValidImage (int Seq);
  • branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/ImageOpsFixLAP.c

    r35713 r35721  
    253253
    254254  int Nfixed = 0;
     255  int Nphu   = 0;
     256  int Nexp   = 0;
     257  int Nstk   = 0;
    255258  int Nskip  = 0;
    256259  int Nbad_1 = 0;
     
    258261
    259262  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 ++;
    261270
    262271    if (Nimage_valid[i] + Nimage_invalid[i] == 0) Nskip ++;
     
    270279  }
    271280
    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
     291void 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);
    273353}
    274354
  • branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/args.c

    r35713 r35721  
    7171  }
    7272
    73   // we should never delete the images before the measures (or we won't know what to delete)
    74   // -image-only is for testing
     73  // 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
    7575  IMAGE_ONLY = FALSE;
    7676  if ((N = get_argument (argc, argv, "-image-only"))) {
    7777    IMAGE_ONLY = TRUE;
    7878    UPDATE = FALSE;
     79    remove_argument (N, &argc, argv);
     80  }
     81  if ((N = get_argument (argc, argv, "-image-only-force"))) {
     82    IMAGE_ONLY = TRUE;
    7983    remove_argument (N, &argc, argv);
    8084  }
     
    179183    if (MODE != MODE_NONE) usage();
    180184    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]);
    181193    remove_argument (N, &argc, argv);
    182194  }
  • branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/delete_fix_LAP.c

    r35713 r35721  
    2323  }
    2424
     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
    2528  // launch the remote jobs
    2629  if (PARALLEL && !HOST_ID) {
     
    2831    return status;
    2932  }
    30 
    31   initImageIndex (image, Nimage);
    3233
    3334  // delete detections from region
     
    170171
    171172  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
     183int 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)) {
    173229      fprintf (stderr, "failed to read data from %s\n", table->hosts[i].hostname);
    174230    }
     
    517573        }
    518574        measure[j].imageID = imageID;
    519         BumpInvalidImage (imageN);
     575        BumpInvalidImage (Seq);
    520576        Ninvalid ++;
    521577        continue;
     
    568624        }
    569625        measure[j].imageID = imageID;
    570         BumpInvalidImage (imageN);
     626        BumpInvalidImage (Seq);
    571627        Ninvalid ++;
    572628        continue;
  • branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/delstar.c

    r35713 r35721  
    4646        break;
    4747      }
     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      }
    4868    case MODE_IMAGEFILE:
    4969      delete_imagefile (&db);
Note: See TracChangeset for help on using the changeset viewer.