IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35707


Ignore:
Timestamp:
Jun 24, 2013, 5:19:54 PM (13 years ago)
Author:
eugene
Message:

added delete -dup-measures option

Location:
branches/eam_branches/ipp-20130509/Ohana/src/delstar
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130509/Ohana/src/delstar/Makefile

    r35416 r35707  
    3030$(SRC)/delete_imagefile.$(ARCH).o \
    3131$(SRC)/delete_duplicate_images.$(ARCH).o \
     32$(SRC)/delete_duplicate_measures.$(ARCH).o \
    3233$(SRC)/delete_image_photcodes.$(ARCH).o \
    3334$(SRC)/delete_photcodes.$(ARCH).o \
     
    4849$(SRC)/args.$(ARCH).o             \
    4950$(SRC)/delete_duplicate_images.$(ARCH).o \
     51$(SRC)/delete_duplicate_measures.$(ARCH).o \
    5052$(SRC)/delete_photcodes.$(ARCH).o \
    5153$(SRC)/delete_photcodes_single.$(ARCH).o \
  • branches/eam_branches/ipp-20130509/Ohana/src/delstar/include/delstar.h

    r35416 r35707  
    5252int          HOST_ID;
    5353char        *HOSTDIR;
     54char        *SINGLE_CPT;
    5455
    5556int SKIP_IMAGES;
     
    6263
    6364int    MODE;
    64 enum {MODE_NONE, MODE_IMAGENAME, MODE_IMAGEFILE, MODE_TIME, MODE_ORPHAN, MODE_MISSED, MODE_PHOTCODES, MODE_DUP_IMAGES};
     65enum {MODE_NONE, MODE_IMAGENAME, MODE_IMAGEFILE, MODE_TIME, MODE_ORPHAN, MODE_MISSED, MODE_PHOTCODES, MODE_DUP_IMAGES, MODE_DUP_MEASURES};
    6566
    6667char DateKeyword[64], DateMode[64], UTKeyword[64], MJDKeyword[64], JDKeyword[64];
     
    109110void SortAveMeasMatch (off_t *MEAS, off_t *AVE, off_t N);
    110111
    111 int delete_photcodes (int hostID, char *hostpath);
     112int delete_photcodes ();
    112113int delete_photcodes_parallel (SkyList *sky);
    113114int delete_photcodes_catalog (Catalog *catalog, PhotCode **photcodes, int Nphotcodes);
     
    115116int delete_photcodes_single (char *cptname);
    116117
    117 int delete_duplicate_images (int hostID, char *hostpath, FITS_DB *db);
    118 int delete_duplicate_image_measures (int hostID, char *hostpath, IndexArray *imageID);
     118int delete_duplicate_images (FITS_DB *db);
     119int delete_duplicate_image_measures (IndexArray *imageID);
    119120int delete_duplicate_image_measures_parallel (SkyList *sky, IndexArray *imageID);
    120121int delete_duplicate_image_measures_catalog (Catalog *catalog, IndexArray *imageID);
     
    125126IndexArray *ImageIDLoad(char *filename);
    126127int ImageIDSave(char *filename, IndexArray *imageID);
     128
     129int delete_duplicate_measures ();
     130int delete_duplicate_measures_parallel (SkyList *sky);
     131int delete_duplicate_measures_catalog (Catalog *catalog);
     132
  • branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/args.c

    r35416 r35707  
    1111  fprintf (stderr, "  delstar -photcodes (list) : delete by photcode\n\n");
    1212  fprintf (stderr, "  delstar -dup-images : delete duplicate images (by externID)\n\n");
     13  fprintf (stderr, "  delstar -dup-measures : delete duplicate measures (by imageID + detID)\n\n");
    1314  fprintf (stderr, "  optional flags:\n");
    1415  fprintf (stderr, "  -v               : verbose mode\n");
    1516  fprintf (stderr, "  -photcode (code) : restrict by photcode\n");
    16   fprintf (stderr, "  -update : apply changes (-dup-images only)\n");
     17  fprintf (stderr, "  -update : apply changes (-dup-images or -dup-measures only)\n");
    1718  fprintf (stderr, "  -image-details : list info about the deleted images (-dup-images only)\n");
    1819  fprintf (stderr, "  -image-only : only examine the image table (changes are NOT saved; -dup-images only)\n");
     
    7980  }
    8081
     82  SINGLE_CPT = NULL;
     83  if ((N = get_argument (argc, argv, "-cpt"))) {
     84    remove_argument (N, &argc, argv);
     85    SINGLE_CPT = strcreate (argv[N]);
     86    remove_argument (N, &argc, argv);
     87  }
     88
    8189  // region of interest
    8290  UserPatch.Rmin = 0;
     
    104112  // XXX for the moment, make this selection manual.  it needs to be automatic
    105113  // based on the state of the SkyTable
     114  HOST_ID = 0;
    106115  PARALLEL = FALSE;
    107116  if ((N = get_argument (argc, argv, "-parallel"))) {
     
    159168    if (MODE != MODE_NONE) usage();
    160169    MODE = MODE_DUP_IMAGES;
     170    remove_argument (N, &argc, argv);
     171  }
     172  if ((N = get_argument (argc, argv, "-dup-measures"))) {
     173    if (MODE != MODE_NONE) usage();
     174    MODE = MODE_DUP_MEASURES;
    161175    remove_argument (N, &argc, argv);
    162176  }
     
    303317  }
    304318
     319  SINGLE_CPT = NULL;
     320  if ((N = get_argument (argc, argv, "-cpt"))) {
     321    remove_argument (N, &argc, argv);
     322    SINGLE_CPT = strcreate (argv[N]);
     323    remove_argument (N, &argc, argv);
     324  }
     325
    305326  /* specify portion of the sky */
    306327  UserPatch.Rmin = 0;
     
    333354    remove_argument (N, &argc, argv);
    334355  }
     356  if ((N = get_argument (argc, argv, "-dup-measures"))) {
     357    if (MODE != MODE_NONE) usage();
     358    MODE = MODE_DUP_MEASURES;
     359    remove_argument (N, &argc, argv);
     360  }
    335361
    336362  if (MODE == MODE_NONE) delstar_client_usage ();
  • branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/delete_duplicate_images.c

    r35416 r35707  
    66// find & delete duplicate images
    77// duplicates based on externID (skip 0s)
    8 int delete_duplicate_images (int hostID, char *hostpath, FITS_DB *db) {
     8int delete_duplicate_images (FITS_DB *db) {
    99
    1010  off_t i, Nimage;
     
    2828
    2929  if (!IMAGE_ONLY) {
    30     delete_duplicate_image_measures (hostID, hostpath, imageID);
     30    delete_duplicate_image_measures (imageID);
    3131  }
    3232
     
    6363}
    6464
    65 int delete_duplicate_image_measures (int hostID, char *hostpath, IndexArray *imageID) {
     65int delete_duplicate_image_measures (IndexArray *imageID) {
    6666
    6767  int i;
     
    8383
    8484  // launch the remote jobs
    85   if (PARALLEL && !hostID) {
     85  if (PARALLEL && !HOST_ID) {
    8686    int status = delete_duplicate_image_measures_parallel (skylist, imageID);
    8787    return status;
     
    9292
    9393    // does this host ID match the desired location for the table?
    94     if (!HostTableTestHost(skylist[0].regions[i], hostID)) continue;
     94    if (!HostTableTestHost(skylist[0].regions[i], HOST_ID)) continue;
    9595
    9696    // set up the basic catalog info
    9797    char hostfile[1024];
    98     snprintf (hostfile, 1024, "%s/%s.cpt", hostpath, skylist[0].regions[i]->name);
    99     catalog.filename  = hostID ? hostfile : skylist[0].filename[i];
     98    snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name);
     99    catalog.filename  = HOST_ID ? hostfile : skylist[0].filename[i];
    100100    catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
    101101    catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
     
    241241  // mark the measures to be dropped
    242242  for (i = 0; i < Nmeasure; i++) {
     243    measureDrop[i] = 0;
    243244    if (measure[i].imageID == 0) continue;
    244245    off_t Ni = measure[i].imageID - imageID->minID;
  • branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/delete_photcodes.c

    r34844 r35707  
    11# include "delstar.h"
    22
    3 int delete_photcodes (int hostID, char *hostpath) {
     3int delete_photcodes () {
    44
    55  int i;
     
    2121
    2222  // launch the remote jobs
    23   if (PARALLEL && !hostID) {
     23  if (PARALLEL && !HOST_ID) {
    2424    int status = delete_photcodes_parallel (skylist);
    2525    return status;
     
    3434
    3535    // does this host ID match the desired location for the table?
    36     if (!HostTableTestHost(skylist[0].regions[i], hostID)) continue;
     36    if (!HostTableTestHost(skylist[0].regions[i], HOST_ID)) continue;
    3737
    3838    // set up the basic catalog info
    3939    char hostfile[1024];
    40     snprintf (hostfile, 1024, "%s/%s.cpt", hostpath, skylist[0].regions[i]->name);
    41     catalog.filename  = hostID ? hostfile : skylist[0].filename[i];
     40    snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name);
     41    catalog.filename  = HOST_ID ? hostfile : skylist[0].filename[i];
    4242    catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
    4343    catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
  • branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/delstar.c

    r35301 r35707  
    2121  switch (MODE) {
    2222    case MODE_DUP_IMAGES:
    23       if (!delete_duplicate_images (0, NULL, &db)) exit (1);
     23      if (!delete_duplicate_images (&db)) exit (1);
     24      exit (0);
     25      break;
     26    case MODE_DUP_MEASURES:
     27      if (!delete_duplicate_measures ()) exit (1);
    2428      exit (0);
    2529      break;
  • branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/delstar_client.c

    r35416 r35707  
    2222        exit (1);
    2323      }
    24       if (!delete_duplicate_image_measures (HOST_ID, HOSTDIR, imageID)) exit (1);
     24      if (!delete_duplicate_image_measures (imageID)) exit (1);
     25      exit (0);
     26      break;
     27    case MODE_DUP_MEASURES:
     28      if (!delete_duplicate_measures ()) exit (1);
    2529      exit (0);
    2630      break;
     
    3236      break;
    3337    case MODE_PHOTCODES:
    34       if (!delete_photcodes (HOST_ID, HOSTDIR)) {
     38      if (!delete_photcodes ()) {
    3539        fprintf (stderr, "failure deleting measurements from %s\n", HOSTDIR);
    3640        exit (1);
Note: See TracChangeset for help on using the changeset viewer.