Changeset 35263
- Timestamp:
- Mar 7, 2013, 9:51:07 AM (13 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 20 edited
- 4 copied
-
. (modified) (1 prop)
-
src/addstar/Makefile (modified) (2 diffs)
-
src/addstar/include/addstar.h (modified) (2 diffs)
-
src/addstar/src/ImageIndex.c (copied) (copied from branches/eam_branches/ipp-20130306/Ohana/src/addstar/src/ImageIndex.c )
-
src/addstar/src/UpdateImageIDs.c (modified) (2 diffs)
-
src/addstar/test/simple.dvo (modified) (4 diffs)
-
src/dvomerge/test/HostTable.dat (modified) (1 diff)
-
src/libdvo/Makefile (modified) (1 diff)
-
src/libdvo/doc/image-searches.txt (copied) (copied from branches/eam_branches/ipp-20130306/Ohana/src/libdvo/doc/image-searches.txt )
-
src/libdvo/include/dvodb.h (modified) (3 diffs)
-
src/libdvo/src/ImageMetadata.c (copied) (copied from branches/eam_branches/ipp-20130306/Ohana/src/libdvo/src/ImageMetadata.c )
-
src/libdvo/src/ImageMetadataSelection.c (copied) (copied from branches/eam_branches/ipp-20130306/Ohana/src/libdvo/src/ImageMetadataSelection.c )
-
src/libdvo/src/ImageSelection.c (modified) (1 diff)
-
src/libdvo/src/dbExtractMeasures.c (modified) (6 diffs)
-
src/libdvo/src/dvosorts.c (modified) (1 diff)
-
src/libohana/src (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/addstar/Makefile
r34405 r35263 90 90 $(SRC)/GetFileMode.$(ARCH).o \ 91 91 $(SRC)/ReadImageHeader.$(ARCH).o \ 92 $(SRC)/ImageIndex.$(ARCH).o \ 92 93 $(SRC)/UpdateImageIDs.$(ARCH).o \ 93 94 $(SRC)/update_coords.$(ARCH).o \ … … 207 208 $(SRC)/ReadStarsTEXT.$(ARCH).o \ 208 209 $(SRC)/ReadStarsSDSS.$(ARCH).o \ 210 $(SRC)/ImageIndex.$(ARCH).o \ 209 211 $(SRC)/UpdateImageIDs.$(ARCH).o \ 210 212 $(SRC)/FilterStars.$(ARCH).o \ -
trunk/Ohana/src/addstar/include/addstar.h
r34405 r35263 56 56 char *refcat; 57 57 } DVO_DATA; 58 59 # define IDTYPE int 60 61 typedef struct { 62 IDTYPE Nimage; 63 IDTYPE minID; 64 IDTYPE maxID; 65 IDTYPE range; 66 IDTYPE *imageID; 67 IDTYPE *externID; 68 char *found; 69 } ImageIndex; 58 70 59 71 typedef struct sockaddr_in SockAddress; … … 275 287 int UpdateImageIDs (Stars *stars, unsigned int Nstars, Image *images, off_t Nimages); 276 288 289 int CheckDuplicateImageIDs (Image *images, off_t Nimages); 290 int ImageIndexFileInit (); 291 277 292 int LoadDataSDSS (FILE *f, char *file, Image **images, off_t *nvalid, Stars **stars, unsigned int *Nstars, Header **headers, off_t *extsize, HeaderSet *headerSets, off_t Nimages); 278 293 int LoadDataPMM (FILE *f, char *file, Image **images, off_t *nvalid, Stars **stars, unsigned int *Nstars); -
trunk/Ohana/src/addstar/src/UpdateImageIDs.c
r28248 r35263 18 18 if (VERBOSE) fprintf (stderr, "can't find %s, creating a new one\n", ImageCat); 19 19 dvo_image_create (&db, GetZeroPoint()); 20 isEmpty = TRUE; 20 ImageIndexFileInit (); 21 isEmpty = TRUE; 21 22 } else { 22 23 /* position to start of file */ … … 51 52 } 52 53 54 // set and update the imageID sequence 55 // the file holding the index is created above if this is an empty db 56 CheckDuplicateImageIDs (images, Nimages); 57 53 58 imageID += Nimages; 54 59 status = gfits_modify (&db.header, "IMAGEID", "%u", 1, imageID); -
trunk/Ohana/src/addstar/test/simple.dvo
r34405 r35263 52 52 exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time 01:00:00 -radec $RA $DEC -type $1 53 53 if ($TAP_VERBOSE) 54 echo exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 -quick-airmass 54 55 exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 -quick-airmass 55 56 else … … 68 69 69 70 for i 0 $testfields:n 71 if ($TAP_VERBOSE) echo $testfields:$i 70 72 list name -split $testfields:$i 71 73 if ("$name:0" == "SKIP") continue … … 337 339 PSF_INST_FLUX : SKIP # not ingested into DVO 338 340 PSF_INST_FLUX_SIG : SKIP # not ingested into DVO 339 AP_MAG _STANDARD: mag:aperinst # FAIL341 AP_MAG : mag:aperinst # FAIL 340 342 AP_MAG_RAW : SKIP # not ingested into DVO 341 343 AP_MAG_RADIUS : SKIP # not ingested into DVO … … 346 348 PEAK_FLUX_AS_MAG : SKIP # not ingested into DVO 347 349 SKY : sky 348 SKY_SIG : sky_err350 SKY_SIGMA : sky_err 349 351 PSF_CHISQ : psf_chisq 350 352 CR_NSIGMA : cr_nsigma -
trunk/Ohana/src/dvomerge/test/HostTable.dat
r33963 r35263 1 1 # Host Table for parallel DVO 2 2 # ID Hostname Catdir 3 1 pikakecatdir.merge.p14 2 pikakecatdir.merge.p25 3 pikakecatdir.merge.p33 1 localhost catdir.merge.p1 4 2 localhost catdir.merge.p2 5 3 localhost catdir.merge.p3 -
trunk/Ohana/src/libdvo/Makefile
r34260 r35263 98 98 $(SRC)/LoadImages.$(ARCH).o \ 99 99 $(SRC)/ImageSelection.$(ARCH).o \ 100 $(SRC)/ImageMetadataSelection.$(ARCH).o \ 101 $(SRC)/ImageMetadata.$(ARCH).o \ 100 102 $(SRC)/ImageOps.$(ARCH).o \ 101 103 $(SRC)/match_image.$(ARCH).o \ -
trunk/Ohana/src/libdvo/include/dvodb.h
r35237 r35263 298 298 } dbValue; 299 299 300 typedef struct { 301 double crval1; 302 double crval2; 303 unsigned int imageID; 304 unsigned int externID; 305 unsigned int expname; 306 float Mcal; 307 float secz; 308 float Xcenter; 309 float Ycenter; 310 } ImageMetadata; 311 300 312 Image *LoadImagesDVO PROTO((off_t *Nimage)); 301 313 void FreeImagesDVO PROTO((Image *images)); … … 346 358 int dbExtractMeasuresInitAve (void); 347 359 int dbExtractMeasuresInitMeas (void); 348 int dbExtractMeasuresInit ( void);360 int dbExtractMeasuresInit (int isRemoteClient); 349 361 350 362 int dbExtractAveragesInitTransform (CoordTransformSystem target); … … 363 375 #include "get_graphdata.h" 364 376 377 ImageMetadata *ImageMetadataLoad(char *filename, off_t *nimage); 378 int ImageMetadataSave(char *filename, Image *image, off_t Nimage); 379 380 int SetImageMetadataSelection (char *filename); 381 void FreeImageMetadataSelection (); 382 ImageMetadata *MatchImageMetadataDVO (unsigned int imageID); 383 Coords *MatchMosaicMetadata (unsigned int imageID); 384 off_t match_image_by_ID (ImageMetadata *image, off_t Nimage, unsigned int ID); 385 void sort_image_metadata (ImageMetadata *image, off_t Nimage); 386 365 387 # endif -
trunk/Ohana/src/libdvo/src/ImageSelection.c
r35260 r35263 68 68 } 69 69 70 Image *MatchImageDVO_old (unsigned int time, short int source, unsigned int imageID) { 71 72 int m = -1; 73 74 if ((imageID != 0) && (imageID < Nimage)) { 75 // imageID is in range for the array of images. If the table is still in order and 76 // no images have been deleted the index of the image we are looking for will be imageID - 1 77 // If this is the case, we have it. Otherwise we'll have to go search for it below 78 int guess = (int) imageID - 1; 79 if (image[guess].imageID == imageID) { 80 m = guess; 81 } 82 } 83 if (m == -1) { 84 m = match_image_subset (image, subset, Nsubset, time, source); 85 } 86 if (m == -1) return (NULL); 87 if (!FindMosaicForImage (image, Nimage, m)) return (NULL); 88 return (&image[m]); 89 } 90 70 91 Coords *MatchMosaic (unsigned int time, short int source) { 71 92 -
trunk/Ohana/src/libdvo/src/dbExtractMeasures.c
r35237 r35263 14 14 static CoordTransform *celestial_to_ecliptic = NULL; 15 15 16 static int REMOTE_CLIENT = FALSE; 17 16 18 static int haveGalacticAve = FALSE; 17 19 static double GLON_AVE = 0.0; … … 30 32 static double ELAT_MEAS = 0.0; 31 33 32 int dbExtractMeasuresInit () { 34 int dbExtractMeasuresInit (int isRemoteClient) { 35 REMOTE_CLIENT = isRemoteClient; 33 36 GetTimeFormat (&TimeReference, &TimeFormat); 34 37 return (TRUE); … … 335 338 break; 336 339 case MEAS_MEAN_AIRMASS: /* OK */ 337 { 340 if (REMOTE_CLIENT) { 341 ImageMetadata *image = MatchImageMetadataDVO (measure[0].imageID); 342 if (image == NULL) break; 343 value.Flt = image[0].secz; 344 } else { 338 345 Image *image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID); 339 346 if (image == NULL) break; 340 347 value.Flt = image[0].secz; 341 break; 342 }348 } 349 break; 343 350 case MEAS_AZ: /* OK */ 344 351 value.Flt = measure[0].az; … … 461 468 ra = average[0].R - measure[0].dR / 3600.0; 462 469 dec = average[0].D - measure[0].dD / 3600.0; 463 mosaic = MatchMosaic (measure[0].t, measure[0].photcode);470 mosaic = MatchMosaicMetadata (measure[0].imageID); 464 471 if (mosaic == NULL) break; 465 472 RD_to_XY (&x, &y, ra, dec, mosaic); … … 515 522 break; 516 523 case MEAS_EXTERN_ID: /* OK */ 517 { 518 Image *image; 519 image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID); 524 if (REMOTE_CLIENT) { 525 ImageMetadata *image = MatchImageMetadataDVO (measure[0].imageID); 520 526 if (image == NULL) break; 521 527 value.Int = image->externID; 528 } else { 529 Image *image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID); 530 if (image == NULL) break; 531 value.Int = image[0].externID; 522 532 } 523 533 break; 524 534 525 535 case MEAS_EXPNAME_AS_INT: 526 { 527 Image *image; 528 image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID); 536 if (REMOTE_CLIENT) { 537 ImageMetadata *image = MatchImageMetadataDVO (measure[0].imageID); 538 if (image == NULL) break; 539 value.Int = image->expname; 540 } else { 541 Image *image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID); 529 542 if (image == NULL) break; 530 543 // XXX very crude: if this matches oNNNNgNNNNo, then convert to an int … … 544 557 case MEAS_FLAT: /* OK */ 545 558 // flat = measure.Mcal - image.Mcal 546 { 547 Image *image; 548 image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID); 559 if (REMOTE_CLIENT) { 560 ImageMetadata *image = MatchImageMetadataDVO (measure[0].imageID); 549 561 if (image == NULL) break; 550 562 value.Flt = measure[0].Mcal - image[0].Mcal; 551 } 552 break; 553 563 } else { 564 Image *image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID); 565 if (image == NULL) break; 566 value.Flt = measure[0].Mcal - image[0].Mcal; 567 } 568 break; 569 570 // we have measure[0].Xccd,Yccd and image[0].NX,NY. Find the distance to the center 554 571 case MEAS_CENTER_OFFSET: /* OK */ 555 { 556 Image *image; 557 image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID); 558 if (image == NULL) break; 559 560 // we have measure[0].Xccd,Yccd and image[0].NX,NY. Find the distance to the center 561 572 if (REMOTE_CLIENT) { 573 ImageMetadata *image = MatchImageMetadataDVO (measure[0].imageID); 574 if (image == NULL) break; 575 float Xcenter = image[0].Xcenter; 576 float Ycenter = image[0].Ycenter; 577 float distance = hypot (measure[0].Xccd - Xcenter, measure[0].Yccd - Ycenter); 578 value.Flt = distance; 579 } else { 580 Image *image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID); 581 if (image == NULL) break; 562 582 // XXX we may hypotetically have images with -NX to +NX here (eg, projection center), but 563 583 // we do not get a detection from that type of image -
trunk/Ohana/src/libdvo/src/dvosorts.c
r27817 r35263 23 23 24 24 OHANA_SORT (N, COMPARE, SWAPFUNC); 25 26 # undef SWAPFUNC 27 # undef COMPARE 28 29 } 30 31 /* sort ImageMetadata array by image[i].imageID */ 32 void sort_image_metadata (ImageMetadata *image, off_t Nimage) { 33 34 # define SWAPFUNC(A,B){ ImageMetadata tmp; tmp = image[A]; image[A] = image[B]; image[B] = tmp; } 35 # define COMPARE(A,B)(image[A].imageID < image[B].imageID) 36 37 OHANA_SORT (Nimage, COMPARE, SWAPFUNC); 25 38 26 39 # undef SWAPFUNC -
trunk/Ohana/src/libohana/src
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130306/Ohana/src/libohana/src (added) merged: 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.
