Changeset 35250
- Timestamp:
- Mar 6, 2013, 4:50:14 PM (13 years ago)
- Location:
- branches/eam_branches/ipp-20130306/Ohana/src/opihi/dvo
- Files:
-
- 3 edited
-
mextract.c (modified) (3 diffs)
-
mmatch.c (modified) (6 diffs)
-
test/mmatch.sh (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130306/Ohana/src/opihi/dvo/mextract.c
r35249 r35250 147 147 // 3) add the input subset filename to the dvo_client command 148 148 149 // allocate the temp array and copy all but (RA) (DEC) 150 int targc = 0; 151 char **targv = NULL; 152 ALLOCATE (targv, char *, argc); 153 for (i = 0; i < argc; i++) { 154 targv[targc] = strcreate (argv[i]); 155 targc ++; 156 } 157 149 158 if (loadImages) { 150 159 Image *image; … … 154 163 char *filename = abspath("image.metadata.fits", DVO_MAX_PATH); 155 164 ImageMetadataSave (filename, image, Nimage); 156 argc += 2; 157 argv[argc-2] = strcreate ("-image-metadata"); 158 argv[argc-1] = strcreate (filename); 159 } 160 161 int status = HostTableParallelOps (argc, argv, RESULT_FILE, TRUE, 0, VERBOSE); 165 166 REALLOCATE (targv, char *, targc + 2); 167 targv[targc+0] = strcreate ("-image-metadata"); 168 targv[targc+1] = strcreate (filename); 169 targc += 2; 170 } 171 172 // call the remote client 173 int status = HostTableParallelOps (targc, targv, RESULT_FILE, TRUE, 0, VERBOSE); 162 174 163 175 dbFreeFields (fields, Nfields); … … 167 179 dvo_catalog_free (&catalog); 168 180 169 if (loadImages) { 170 free (argv[argc-1]); 171 free (argv[argc-2]); 172 } 181 // free up targv 182 for (i = 0; i < targc; i++) { 183 free (targv[i]); 184 } 185 free (targv); 173 186 174 187 return status; -
branches/eam_branches/ipp-20130306/Ohana/src/opihi/dvo/mmatch.c
r35249 r35250 49 49 } 50 50 51 // load info about the images from a reduced-size file 52 char *imageMetadataFile = FALSE; 53 if ((N = get_argument (argc, argv, "-image-metadata"))) { 54 remove_argument (N, &argc, argv); 55 imageMetadataFile = strcreate (argv[N]); 56 remove_argument (N, &argc, argv); 57 } 58 51 59 int PARALLEL = FALSE; 52 60 if ((N = get_argument (argc, argv, "-parallel"))) { … … 75 83 // HOST_ID tells library if operation is on remote client or not 76 84 dbExtractMeasuresInit(HOST_ID); 85 86 // parse the fields to be extracted and returned 87 int first = 4; 88 if (CoordsFile) { 89 first = 2; 90 } 91 fields = dbCmdlineFields (argc-first, &argv[first], DVO_TABLE_MEASURE, &last, &Nfields); 92 if (fields == NULL) goto help; 93 if ((Nfields == 0) || (last != argc - first)) { 94 dbFreeFields (fields, Nfields); 95 dvo_catalog_free (&catalog); 96 goto help; 97 } 98 99 // load image data if needed (for fields listed below) 100 int loadImages = FALSE; 101 for (i = 0; !loadImages && (i < Nfields); i++) { 102 loadImages = field_needs_images (&fields[i]); 103 } 77 104 78 105 // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results … … 124 151 targc += 2; 125 152 } 153 154 if (loadImages) { 155 Image *image; 156 off_t Nimage; 157 if ((image = LoadImagesDVO (&Nimage)) == NULL) goto escape; 158 159 char *filename = abspath("image.metadata.fits", DVO_MAX_PATH); 160 ImageMetadataSave (filename, image, Nimage); 161 162 REALLOCATE (targv, char *, targc + 2); 163 targv[targc+0] = strcreate ("-image-metadata"); 164 targv[targc+1] = strcreate (filename); 165 targc += 2; 166 } 126 167 127 168 // call the remote client … … 155 196 remove_argument (1, &argc, argv); 156 197 157 // parse the fields to be extracted and returned158 fields = dbCmdlineFields (argc, argv, DVO_TABLE_MEASURE, &last, &Nfields);159 if (fields == NULL) goto help;160 if ((Nfields == 0) || (last != argc)) {161 dbFreeFields (fields, Nfields);162 dvo_catalog_free (&catalog);163 goto help;164 }165 166 // load image data if needed (for fields listed below)167 int loadImages = FALSE;168 for (i = 0; !loadImages && (i < Nfields); i++) {169 loadImages = field_needs_images (&fields[i]);170 }171 172 198 // use the whole sky (since we select random points around the sky) 173 199 SkyRegionSelection selection; 174 200 selection.useDisplay = FALSE; 175 201 selection.useSkyregion = FALSE; 176 if (loadImages && !SetImageSelection (TRUE, &selection)) goto escape; 202 203 if (loadImages) { 204 if (HOST_ID) { 205 if (!SetImageMetadataSelection (imageMetadataFile)) goto escape; 206 } else { 207 if (!SetImageSelection (TRUE, &selection)) goto escape; 208 } 209 } 177 210 178 211 /* load regions which contain all supplied RA,DEC coordinates */ … … 309 342 if (invec) FreeVectorArray (invec, Ninvec); 310 343 dbFreeFields (fields, Nfields); 344 FreeImageSelection (); 345 FreeImageMetadataSelection (); 311 346 SkyListFree (skylist); 312 347 return (TRUE); … … 317 352 if (invec) FreeVectorArray (invec, Ninvec); 318 353 dbFreeFields (fields, Nfields); 354 FreeImageSelection (); 355 FreeImageMetadataSelection (); 319 356 SkyListFree (skylist); 320 357 return (FALSE); -
branches/eam_branches/ipp-20130306/Ohana/src/opihi/dvo/test/mmatch.sh
r34464 r35250 10 10 $Ro = 2.59 11 11 $Do = 1.23 12 catdir /data/pikake.0/eugene/src/ipp-dev/Ohana/src/dvomerge/test/catdir.merge12 catdir catdir.merge 13 13 $Gname = g 14 14 $Rname = r … … 21 21 subset r_ave = $Rname if (ra > $Ro - 0.1) && (ra > $Ro + 0.1) && (dec > $Do - 0.1) && (dec < $Do + 0.1) 22 22 vectors 23 mmatch -v -parallel R D 1.0 RA DEC MAG PHOTCODE -index index 23 24 # mmatch -v -parallel R D 1.0 RA DEC MAG PHOTCODE -index index 25 mmatch -v -parallel R D 1.0 RA DEC MAG PHOTCODE externID mean_airmass -index index 24 26 25 27 reindex g_ave_match = g_ave using index
Note:
See TracChangeset
for help on using the changeset viewer.
