Changeset 40525
- Timestamp:
- Aug 31, 2018, 9:32:10 AM (8 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/dvo/avselect.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/avselect.c
r40524 r40525 8 8 * loop over the catalogs 9 9 * 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 11 11 */ 12 12 13 13 int avselect (int argc, char **argv) { 14 14 15 15 off_t i, j, n, m; 16 16 int N, Ncat, Npts, NPTS, last, Nfields, Nsecfilt, Ninvec; … … 83 83 84 84 // init locally static variables (time refs) 85 dbExtractAveragesInit (); 85 dbExtractAveragesInit (); 86 86 87 87 RAvec = NULL; … … 138 138 targv[targc+1] = CoordsFile; // this gets freed with targv 139 139 targc += 2; 140 140 141 141 // if needed, add the index vector to the args list 142 142 if (IDXvec) { … … 145 145 targv[targc+1] = strcreate (IDXvec[0].name); 146 146 targc += 2; 147 } 147 } 148 148 if (RADvec) { 149 149 REALLOCATE (targv, char *, targc + 2); … … 151 151 targv[targc+1] = strcreate (RADvec[0].name); 152 152 targc += 2; 153 } 153 } 154 154 155 155 // I need to pass the RA & DEC vectors to the remote clients... 156 156 int status = HostTableParallelOps (skylist, targc, targv, RESULT_FILE, TRUE, 0, VERBOSE); 157 157 if (vec) free (vec); 158 158 159 159 // free up targv 160 160 for (i = 0; i < targc; i++) { … … 226 226 227 227 if (VERBOSE) gprint (GP_ERR, "trying %s ("OFF_T_FMT" of "OFF_T_FMT")\n", catalog.filename, i, skylist[0].Nregions); 228 228 229 229 // an error exit status here is a significant error 230 230 if (!dvo_catalog_open (&catalog, NULL, FALSE, "r")) { … … 259 259 260 260 // reset counters for saved fields, extract fields 261 dbExtractAveragesInitAve (); 261 dbExtractAveragesInitAve (); 262 262 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]); 264 264 } 265 265 266 266 // set resulting values 267 267 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 } 273 273 } 274 274 // set (optional) IDXvec and RADvec 275 275 if (IDXvec) { 276 IDXvec[0].elements.Int[Npts] = result[j].Nseq;;276 IDXvec[0].elements.Int[Npts] = result[j].Nseq;; 277 277 } 278 278 if (RADvec) { 279 RADvec[0].elements.Flt[Npts] = result[j].Roff;;279 RADvec[0].elements.Flt[Npts] = result[j].Roff;; 280 280 } 281 281 … … 283 283 Npts++; 284 284 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 } 295 295 } 296 296 } … … 345 345 346 346 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"); 348 348 gprint (GP_ERR, " OR: avselect -coords (filename.fits) (RADIUS) field[,field,field...]\n"); 349 349 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"); 350 352 351 353 if ((argc > N + 1) && !strcasecmp (argv[N+1], "fields")) { 354 gprint (GP_ERR, " NOTE: the list below is incomplete\n"); 355 352 356 gprint (GP_ERR, " RA : right ascension (J2000) [degrees]\n"); 353 357 gprint (GP_ERR, " DEC : declination [degrees]\n");
Note:
See TracChangeset
for help on using the changeset viewer.
