IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 40525


Ignore:
Timestamp:
Aug 31, 2018, 9:32:10 AM (8 years ago)
Author:
eugene
Message:

add more info to USAGE line

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/avselect.c

    r40524 r40525  
    88   * loop over the catalogs
    99   * within a catalog, use the find_match code to find the matching coordinates
    10    * use dbExtractAverages to get the fields for the matched entry 
     10   * use dbExtractAverages to get the fields for the matched entry
    1111 */
    1212
    1313int avselect (int argc, char **argv) {
    14  
     14
    1515  off_t i, j, n, m;
    1616  int N, Ncat, Npts, NPTS, last, Nfields, Nsecfilt, Ninvec;
     
    8383
    8484  // init locally static variables (time refs)
    85   dbExtractAveragesInit (); 
     85  dbExtractAveragesInit ();
    8686
    8787  RAvec  = NULL;
     
    138138    targv[targc+1] = CoordsFile; // this gets freed with targv
    139139    targc += 2;
    140    
     140
    141141    // if needed, add the index vector to the args list
    142142    if (IDXvec) {
     
    145145      targv[targc+1] = strcreate (IDXvec[0].name);
    146146      targc += 2;
    147     }     
     147    }
    148148    if (RADvec) {
    149149      REALLOCATE (targv, char *, targc + 2);
     
    151151      targv[targc+1] = strcreate (RADvec[0].name);
    152152      targc += 2;
    153     }     
     153    }
    154154
    155155    // I need to pass the RA & DEC vectors to the remote clients...
    156156    int status = HostTableParallelOps (skylist, targc, targv, RESULT_FILE, TRUE, 0, VERBOSE);
    157157    if (vec) free (vec);
    158    
     158
    159159    // free up targv
    160160    for (i = 0; i < targc; i++) {
     
    226226
    227227    if (VERBOSE) gprint (GP_ERR, "trying %s ("OFF_T_FMT" of "OFF_T_FMT")\n", catalog.filename,  i,  skylist[0].Nregions);
    228      
     228
    229229    // an error exit status here is a significant error
    230230    if (!dvo_catalog_open (&catalog, NULL, FALSE, "r")) {
     
    259259
    260260      // reset counters for saved fields, extract fields
    261       dbExtractAveragesInitAve (); 
     261      dbExtractAveragesInitAve ();
    262262      for (n = 0; n < Nfields; n++) {
    263         values[n] = dbExtractAverages (average, secfilt, measure, lensobj, starpar, NULL, &fields[n]);
     263        values[n] = dbExtractAverages (average, secfilt, measure, lensobj, starpar, NULL, &fields[n]);
    264264      }
    265265
    266266      // set resulting values
    267267      for (n = 0; n < Nfields; n++) {
    268         if (vec[n][0].type == OPIHI_FLT) {
    269           vec[n][0].elements.Flt[Npts] = values[n].Flt;
    270         } else {
    271           vec[n][0].elements.Int[Npts] = values[n].Int;
    272         }
     268        if (vec[n][0].type == OPIHI_FLT) {
     269          vec[n][0].elements.Flt[Npts] = values[n].Flt;
     270        } else {
     271          vec[n][0].elements.Int[Npts] = values[n].Int;
     272        }
    273273      }
    274274      // set (optional) IDXvec and RADvec
    275275      if (IDXvec) {
    276         IDXvec[0].elements.Int[Npts] = result[j].Nseq;;
     276        IDXvec[0].elements.Int[Npts] = result[j].Nseq;;
    277277      }
    278278      if (RADvec) {
    279         RADvec[0].elements.Flt[Npts] = result[j].Roff;;
     279        RADvec[0].elements.Flt[Npts] = result[j].Roff;;
    280280      }
    281281
     
    283283      Npts++;
    284284      if (Npts >= NPTS) {
    285         NPTS += 2000;
    286         for (n = 0; n < Nfields; n++) {
    287           REALLOCATE (vec[n][0].elements.Flt, opihi_flt, NPTS);
    288         }
    289         if (IDXvec) {
    290           REALLOCATE (IDXvec[0].elements.Int, opihi_int, NPTS);
    291         }
    292         if (RADvec) {
    293           REALLOCATE (RADvec[0].elements.Flt, opihi_flt, NPTS);
    294         }
     285        NPTS += 2000;
     286        for (n = 0; n < Nfields; n++) {
     287          REALLOCATE (vec[n][0].elements.Flt, opihi_flt, NPTS);
     288        }
     289        if (IDXvec) {
     290          REALLOCATE (IDXvec[0].elements.Int, opihi_int, NPTS);
     291        }
     292        if (RADvec) {
     293          REALLOCATE (RADvec[0].elements.Flt, opihi_flt, NPTS);
     294        }
    295295      }
    296296    }
     
    345345
    346346 help:
    347   gprint (GP_ERR, "USAGE: avselect (RA) (DEC) (RADIUS) field[,field,field...]\n");
     347  gprint (GP_ERR, "USAGE: avselect (RA) (DEC) (RADIUS) field[,field,field...] [-index index] [-radius radius]\n");
    348348  gprint (GP_ERR, "   OR: avselect -coords (filename.fits) (RADIUS) field[,field,field...]\n");
    349349  gprint (GP_ERR, "   RADIUS is in arcseconds\n");
     350  gprint (GP_ERR, "   -index index : return an index into the input RA,DEC vectors (e.g, field[i] matches RA[index[i]])\n");
     351  gprint (GP_ERR, "   -radius radius : return the distance (in arcseconds) between the returned object and the matched coordinate\n");
    350352
    351353  if ((argc > N + 1) && !strcasecmp (argv[N+1], "fields")) {
     354    gprint (GP_ERR, "  NOTE: the list below is incomplete\n");
     355
    352356    gprint (GP_ERR, "  RA : right ascension (J2000) [degrees]\n");
    353357    gprint (GP_ERR, "  DEC : declination [degrees]\n");
Note: See TracChangeset for help on using the changeset viewer.