Changeset 35263 for trunk/Ohana/src/opihi/dvo/mmatch.c
- Timestamp:
- Mar 7, 2013, 9:51:07 AM (13 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130306/Ohana (added) merged: 35244-35246,35248-35259,35261-35262
- Property svn:mergeinfo changed
-
trunk/Ohana/src/opihi
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130306/Ohana/src/opihi (added) merged: 35244,35246,35249-35250,35258
- Property svn:mergeinfo changed
-
trunk/Ohana/src/opihi/dvo/mmatch.c
r34749 r35263 1 1 # include "dvoshell.h" 2 int field_needs_images (dbField *field); 2 3 3 4 /* This function uses the 'find_match' algorithm to select the objects of interest. … … 48 49 } 49 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 50 59 int PARALLEL = FALSE; 51 60 if ((N = get_argument (argc, argv, "-parallel"))) { … … 72 81 73 82 // init locally static variables (time refs) 74 dbExtractMeasuresInit(); 83 // HOST_ID tells library if operation is on remote client or not 84 dbExtractMeasuresInit(HOST_ID); 85 86 // parse the fields to be extracted and returned 87 int first = 3; 88 if (CoordsFile) { 89 first = 1; 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 } 75 104 76 105 // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results … … 122 151 targc += 2; 123 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 } 124 167 125 168 // call the remote client … … 153 196 remove_argument (1, &argc, argv); 154 197 155 // parse the fields to be extracted and returned156 fields = dbCmdlineFields (argc, argv, DVO_TABLE_MEASURE, &last, &Nfields);157 if (fields == NULL) goto help;158 if ((Nfields == 0) || (last != argc)) {159 dbFreeFields (fields, Nfields);160 dvo_catalog_free (&catalog);161 goto help;162 }163 164 // load image data if needed (for fields listed below)165 int loadImages = FALSE;166 int mosaicMode = FALSE;167 for (i = 0; !loadImages && (i < Nfields); i++) {168 if (!MEASURE_HAS_XCCD) {169 // I'm keeping this code because it gives a way of handling dvo dbs that don't have170 // measure.xccd if we need it171 if (fields[i].ID == MEAS_XCCD) loadImages = TRUE;172 if (fields[i].ID == MEAS_YCCD) loadImages = TRUE;173 }174 if (fields[i].ID == MEAS_XMOSAIC) loadImages = mosaicMode = TRUE;175 if (fields[i].ID == MEAS_YMOSAIC) loadImages = mosaicMode = TRUE;176 if (fields[i].ID == MEAS_EXTERN_ID) loadImages = mosaicMode = TRUE;177 if (fields[i].ID == MEAS_FLAT) loadImages = mosaicMode = TRUE;178 if (fields[i].ID == MEAS_CENTER_OFFSET) loadImages = mosaicMode = TRUE;179 }180 181 198 // use the whole sky (since we select random points around the sky) 182 199 SkyRegionSelection selection; 183 200 selection.useDisplay = FALSE; 184 201 selection.useSkyregion = FALSE; 185 if (loadImages && !SetImageSelection (mosaicMode, &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 } 186 210 187 211 /* load regions which contain all supplied RA,DEC coordinates */ … … 318 342 if (invec) FreeVectorArray (invec, Ninvec); 319 343 dbFreeFields (fields, Nfields); 344 FreeImageSelection (); 345 FreeImageMetadataSelection (); 320 346 SkyListFree (skylist); 321 347 return (TRUE); … … 326 352 if (invec) FreeVectorArray (invec, Ninvec); 327 353 dbFreeFields (fields, Nfields); 354 FreeImageSelection (); 355 FreeImageMetadataSelection (); 328 356 SkyListFree (skylist); 329 357 return (FALSE);
Note:
See TracChangeset
for help on using the changeset viewer.
