Changeset 35263 for trunk/Ohana/src/opihi
- Timestamp:
- Mar 7, 2013, 9:51:07 AM (13 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 9 edited
-
. (modified) (1 prop)
-
src/opihi (modified) (1 prop)
-
src/opihi/cmd.astro (modified) (1 prop)
-
src/opihi/cmd.data (modified) (1 prop)
-
src/opihi/dvo/dvo_client.c (modified) (2 diffs)
-
src/opihi/dvo/mextract.c (modified) (8 diffs)
-
src/opihi/dvo/mmatch.c (modified) (7 diffs)
-
src/opihi/dvo/mmextract.c (modified) (4 diffs)
-
src/opihi/dvo/test/mmatch.sh (modified) (2 diffs)
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/cmd.astro
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/Ohana/src/opihi/cmd.data
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/Ohana/src/opihi/dvo/dvo_client.c
r33963 r35263 39 39 remove_argument (N, argc, argv); 40 40 } 41 if (!HOST_ID) { 42 fprintf (stderr, "ERROR: dvo_client requires a -hostID value\n"); 43 exit (3); 44 } 41 45 42 46 HOSTDIR = NULL; … … 45 49 HOSTDIR = strcreate (argv[N]);; 46 50 remove_argument (N, argc, argv); 51 } 52 if (!HOSTDIR) { 53 fprintf (stderr, "ERROR: dvo_client requires a -hostdir value\n"); 54 exit (3); 47 55 } 48 56 -
trunk/Ohana/src/opihi/dvo/mextract.c
r34749 r35263 1 1 # include "dvoshell.h" 2 3 int field_needs_images (dbField *field) { 4 // the image subset table requires imageID for all fields 5 6 if (!MEASURE_HAS_XCCD) { 7 // I'm keeping this code because it gives a way of handling dvo dbs that don't have 8 // measure.xccd if we need it 9 if (field->ID == MEAS_XCCD) return TRUE; // full astrometry per chip (120 bytes!) 10 if (field->ID == MEAS_YCCD) return TRUE; // full astrometry per chip (120 bytes!) 11 } 12 if (field->ID == MEAS_XMOSAIC) return TRUE; // crval1,2 only 13 if (field->ID == MEAS_YMOSAIC) return TRUE; // crval1,2 only 14 if (field->ID == MEAS_EXTERN_ID) return TRUE; // externID 15 if (field->ID == MEAS_FLAT) return TRUE; // Mcal 16 if (field->ID == MEAS_CENTER_OFFSET) return TRUE; // 0.5*NX, 0.5*NY 17 if (field->ID == MEAS_EXPNAME_AS_INT) return TRUE; // expname (or as int) 18 if (field->ID == MEAS_AIRMASS) return TRUE; // airmass 19 return FALSE; 20 } 2 21 3 22 int mextract (int argc, char **argv) { … … 5 24 off_t i, j, k, m; // used for counter averages and measures 6 25 int n, N, Npts, NPTS, last, next, state, Nfields, Nreturn, Ncstack, Nstack; 7 int Nsecfilt, VERBOSE, loadImages , mosaicMode;26 int Nsecfilt, VERBOSE, loadImages; 8 27 char **cstack, name[1024]; 9 28 dbValue *values; … … 33 52 remove_argument (N, &argc, argv); 34 53 VERBOSE = TRUE; 54 } 55 56 char *imageMetadataFile = FALSE; 57 if ((N = get_argument (argc, argv, "-image-metadata"))) { 58 remove_argument (N, &argc, argv); 59 imageMetadataFile = strcreate (argv[N]); 60 remove_argument (N, &argc, argv); 35 61 } 36 62 … … 66 92 67 93 // init locally static variables (time refs) 68 dbExtractMeasuresInit(); 94 // HOST_ID tells library if operation is on remote client or not 95 dbExtractMeasuresInit(HOST_ID); 69 96 70 97 // command-line is of the form: mextract field,field, field [where (field op value)...] … … 106 133 if ((skylist = SelectRegions (selection)) == NULL) goto escape; 107 134 135 // load image data if needed (for fields listed below) 136 loadImages = FALSE; 137 for (i = 0; !loadImages && (i < Nfields); i++) { 138 loadImages = field_needs_images (&fields[i]); 139 } 140 108 141 // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results 109 142 if (PARALLEL && !HOST_ID) { 110 int status = HostTableParallelOps (argc, argv, RESULT_FILE, TRUE, 0, VERBOSE); 143 144 // Image Metadata for remote queries: 145 // 1) figure out if we need any image metadata 146 // 2) load the images and generate a subset table with just the fields of interest 147 // 3) add the input subset filename to the dvo_client command 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 158 if (loadImages) { 159 Image *image; 160 off_t Nimage; 161 if ((image = LoadImagesDVO (&Nimage)) == NULL) goto escape; 162 163 char *filename = abspath("image.metadata.fits", DVO_MAX_PATH); 164 ImageMetadataSave (filename, image, Nimage); 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); 111 174 112 175 dbFreeFields (fields, Nfields); … … 116 179 dvo_catalog_free (&catalog); 117 180 181 // free up targv 182 for (i = 0; i < targc; i++) { 183 free (targv[i]); 184 } 185 free (targv); 186 118 187 return status; 119 188 } 120 189 121 // load image data if needed (for fields listed below) 122 loadImages = FALSE; 123 mosaicMode = FALSE; 124 for (i = 0; !loadImages && (i < Nfields); i++) { 125 if (!MEASURE_HAS_XCCD) { 126 // I'm keeping this code because it gives a way of handling dvo dbs that don't have 127 // measure.xccd if we need it 128 if (fields[i].ID == MEAS_XCCD) loadImages = TRUE; 129 if (fields[i].ID == MEAS_YCCD) loadImages = TRUE; 130 } 131 if (fields[i].ID == MEAS_XMOSAIC) loadImages = mosaicMode = TRUE; 132 if (fields[i].ID == MEAS_YMOSAIC) loadImages = mosaicMode = TRUE; 133 if (fields[i].ID == MEAS_EXTERN_ID) loadImages = mosaicMode = TRUE; 134 if (fields[i].ID == MEAS_FLAT) loadImages = mosaicMode = TRUE; 135 if (fields[i].ID == MEAS_CENTER_OFFSET) loadImages = mosaicMode = TRUE; 136 } 137 if (loadImages && !SetImageSelection (mosaicMode, selection)) goto escape; 190 if (loadImages) { 191 if (HOST_ID) { 192 if (!SetImageMetadataSelection (imageMetadataFile)) goto escape; 193 } else { 194 if (!SetImageSelection (TRUE, selection)) goto escape; 195 } 196 } 138 197 139 198 /* create storage vector */ … … 251 310 free (stack); 252 311 FreeImageSelection (); 312 FreeImageMetadataSelection (); 253 313 SkyListFree (skylist); 254 314 FreeSkyRegionSelection (selection); … … 264 324 free (stack); 265 325 FreeImageSelection (); 326 FreeImageMetadataSelection (); 266 327 SkyListFree (skylist); 267 328 FreeSkyRegionSelection (selection); -
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); -
trunk/Ohana/src/opihi/dvo/mmextract.c
r30612 r35263 1 1 # include "dvoshell.h" 2 int field_needs_images (dbField *field); 2 3 3 4 int mmextract (int argc, char **argv) { … … 7 8 int Nfields, Nreturn, Nreturn_base, Ncstack1, Ncstack2, Nstack1, Nstack2; 8 9 int Nwhere, Iwhere, Nmatch, Imatch, NTABLE, Nt1, Nt2, n1, n2; 9 int Nsecfilt, VERBOSE, loadImages , mosaicMode;10 int Nsecfilt, VERBOSE, loadImages; 10 11 char **cstack1, **cstack2, name1[1024], name2[1024]; 11 12 dbValue *values, **table1, **table2; … … 45 46 46 47 // init locally static variables (time refs) 47 dbExtractMeasuresInit( );48 dbExtractMeasuresInit(HOST_ID); 48 49 49 50 // parse skyregion options … … 137 138 // load image data if needed (for fields listed below) 138 139 loadImages = FALSE; 139 mosaicMode = FALSE;140 140 for (i = 0; !loadImages && (i < Nfields); i++) { 141 if (fields[i].ID == MEAS_XCCD) loadImages = TRUE; 142 if (fields[i].ID == MEAS_YCCD) loadImages = TRUE; 143 if (fields[i].ID == MEAS_XMOSAIC) loadImages = mosaicMode = TRUE; 144 if (fields[i].ID == MEAS_YMOSAIC) loadImages = mosaicMode = TRUE; 145 } 146 if (loadImages && !SetImageSelection (mosaicMode, selection)) goto escape; 141 loadImages = field_needs_images (&fields[i]); 142 } 143 if (loadImages && !SetImageSelection (TRUE, selection)) goto escape; 147 144 148 145 /* create storage vector */ -
trunk/Ohana/src/opihi/dvo/test/mmatch.sh
r34464 r35263 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.
