Changeset 37377
- Timestamp:
- Sep 8, 2014, 2:43:46 PM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140904/Ohana/src/libdvo
- Files:
-
- 24 edited
-
include/dvo.h (modified) (1 diff)
-
src/ImageMetadata.c (modified) (1 diff)
-
src/ImageOps.c (modified) (2 diffs)
-
src/ImageSelection.c (modified) (2 diffs)
-
src/coordops.c (modified) (4 diffs)
-
src/dbExtractImages.c (modified) (8 diffs)
-
src/dbExtractMeasures.c (modified) (2 diffs)
-
src/dvo_convert.c (modified) (3 diffs)
-
src/dvo_convert_PS1_DEV_1.c (modified) (2 diffs)
-
src/dvo_convert_PS1_DEV_2.c (modified) (2 diffs)
-
src/dvo_convert_PS1_DEV_3.c (modified) (2 diffs)
-
src/dvo_convert_PS1_REF.c (modified) (2 diffs)
-
src/dvo_convert_PS1_V1.c (modified) (2 diffs)
-
src/dvo_convert_PS1_V2.c (modified) (2 diffs)
-
src/dvo_convert_PS1_V3.c (modified) (2 diffs)
-
src/dvo_convert_PS1_V4.c (modified) (2 diffs)
-
src/dvo_convert_PS1_V5.c (modified) (2 diffs)
-
src/dvo_convert_elixir.c (modified) (2 diffs)
-
src/dvo_convert_loneos.c (modified) (2 diffs)
-
src/dvo_convert_panstarrs_DEV_0.c (modified) (2 diffs)
-
src/dvo_convert_panstarrs_DEV_1.c (modified) (2 diffs)
-
src/dvo_image.c (modified) (3 diffs)
-
src/dvo_util.c (modified) (1 diff)
-
src/mosaic_astrom.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/include/dvo.h
r37356 r37377 948 948 void dvo_image_create (FITS_DB *db, double ZeroPoint); 949 949 950 int gfits_table_set_Image (FTable *ftable); 951 int gfits_table_mkheader_Image (Header *header); 952 Image *gfits_table_get_Image (FTable *ftable, off_t *Ndata, char *swapped); 953 950 954 /* flatcorr APIs */ 951 955 FlatCorrectionTable *FlatCorrectionLoad (char *filename, int VERBOSE); -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/ImageMetadata.c
r37035 r37377 156 156 // assign the storage arrays 157 157 for (i = 0; i < Nimage; i++) { 158 int Nmosaic = FindMosaicForImage (image, Nimage, i); 159 if (!Nmosaic) continue; 160 Nmosaic --; 158 if (!image[i].coords.mosaic) continue; 161 159 imageID[i] = image[i].imageID; 162 160 externID[i] = image[i].externID; 163 crval1[i] = image[Nmosaic].coords.crval1; 164 crval2[i] = image[Nmosaic].coords.crval2; 165 166 theta[i] = DEG_RAD*atan2(image[Nmosaic].coords.pc1_2, image[Nmosaic].coords.pc1_1); 161 Coords *mosaic = image[i].coords.mosaic; 162 163 crval1[i] = mosaic->crval1; 164 crval2[i] = mosaic->crval2; 165 166 theta[i] = DEG_RAD*atan2(mosaic->pc1_2, mosaic->pc1_1); 167 167 168 168 Mcal[i] = image[i].Mcal; -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/ImageOps.c
r34088 r37377 55 55 if (TimeSelect && ((image[i].tzero < tzero) || (image[i].tzero+image[i].trate*image[i].NY > tzero + trange))) continue; 56 56 if (selection->useDisplay) { 57 if (!FindMosaicForImage (image, Nimage, i)) continue;58 57 // first check if region center is in image 59 58 status = RD_to_XY (&X, &Y, Rmid, graph.coords.crval2, &image[i].coords); … … 89 88 } 90 89 if (selection->useSkyregion) { 91 if (!FindMosaicForImage (image, Nimage, i)) continue;92 90 /* project this image to screen display coords */ 93 91 x[0] = 0; y[0] = 0; -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/ImageSelection.c
r36490 r37377 64 64 } 65 65 if (m == -1) return (NULL); 66 if (!FindMosaicForImage (image, Nimage, m)) return (NULL);67 66 return (&image[m]); 68 67 } … … 85 84 } 86 85 if (m == -1) return (NULL); 87 if (!FindMosaicForImage (image, Nimage, m)) return (NULL);88 86 return (&image[m]); 89 87 } -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/coordops.c
r36490 r37377 3 3 /* note that Coords.ctype carries the DEC (ctype2) value */ 4 4 5 // this was previously coded not-thread-safe: I've added the mosaic link directly to the Coords structure 6 # if (0) 5 7 static Coords mosaic; 6 8 static int gotMosaic = FALSE; … … 19 21 return (TRUE); 20 22 } 23 # endif 21 24 22 25 int XY_to_LM (double *L, double *M, double x, double y, Coords *coords) { … … 78 81 /* mosaic astrometry : WRP is chip astrometry; apply mosaic (DIS) term */ 79 82 if (proj == PROJ_WRP) { 80 if (!gotMosaic) return (FALSE); 81 XY_to_RD (ra, dec, L, M, &mosaic); 83 if (!coords->mosaic) { 84 myAbort ("missing mosaic element"); 85 return (FALSE); 86 } 87 XY_to_RD (ra, dec, L, M, coords->mosaic); 82 88 } 83 89 return (TRUE); … … 208 214 if (mode == PROJ_MODE_CARTESIAN) { 209 215 if (proj == PROJ_WRP) { 210 if (!gotMosaic) return (FALSE); 211 RD_to_XY (L, M, ra, dec, &mosaic); 216 if (!coords->mosaic) { 217 myAbort ("missing mosaic element"); 218 return (FALSE); 219 } 220 RD_to_XY (L, M, ra, dec, coords->mosaic); 212 221 return (TRUE); 213 222 } -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dbExtractImages.c
r37035 r37377 59 59 time_t t; 60 60 dbValue value; 61 off_t Nmosaic;62 61 63 62 value.Flt = NAN; … … 68 67 case IMAGE_RA: 69 68 if (!haveCelestial) { 70 if (!FindMosaicForImage (image, Nimage, N)) return value;71 69 if (!strcmp(&image[N].coords.ctype[4], "-DIS")) { 72 70 x = 0.0; … … 83 81 case IMAGE_DEC: 84 82 if (!haveCelestial) { 85 if (!FindMosaicForImage (image, Nimage, N)) return value;86 83 if (!strcmp(&image[N].coords.ctype[4], "-DIS")) { 87 84 x = 0.0; … … 99 96 if (!haveGalactic) { 100 97 if (!haveCelestial) { 101 if (!FindMosaicForImage (image, Nimage, N)) return value;102 98 if (!strcmp(&image[N].coords.ctype[4], "-DIS")) { 103 99 x = 0.0; … … 118 114 if (!haveGalactic) { 119 115 if (!haveCelestial) { 120 if (!FindMosaicForImage (image, Nimage, N)) return value;121 116 if (!strcmp(&image[N].coords.ctype[4], "-DIS")) { 122 117 x = 0.0; … … 137 132 if (!haveEcliptic) { 138 133 if (!haveCelestial) { 139 if (!FindMosaicForImage (image, Nimage, N)) return value;140 134 if (!strcmp(&image[N].coords.ctype[4], "-DIS")) { 141 135 x = 0.0; … … 156 150 if (!haveEcliptic) { 157 151 if (!haveCelestial) { 158 if (!FindMosaicForImage (image, Nimage, N)) return value;159 152 if (!strcmp(&image[N].coords.ctype[4], "-DIS")) { 160 153 x = 0.0; … … 269 262 270 263 case IMAGE_FWHM_MEDIAN: 271 if (!(Nmosaic = FindMosaicForImage (image, Nimage, N))) return value; 272 Nmosaic --; // XXX kind of a hack: FindMosaicForImage returns 0 or the mosaic seq number + 1 273 value.Flt = (image[Nmosaic].fwhm_x + image[Nmosaic].fwhm_y) / 50.0; 264 if (!image[N].parent) return value; 265 value.Flt = (image[N].parent->fwhm_x + image[N].parent->fwhm_y) / 50.0; 274 266 break; 275 267 case IMAGE_FWHM_MAJ_MEDIAN: 276 if (!(Nmosaic = FindMosaicForImage (image, Nimage, N))) return value; 277 Nmosaic --; // XXX kind of a hack: FindMosaicForImage returns 0 or the mosaic seq number + 1 278 value.Flt = image[Nmosaic].fwhm_x / 25.0; 268 if (!image[N].parent) return value; 269 value.Flt = image[N].parent->fwhm_x / 25.0; 279 270 break; 280 271 case IMAGE_FWHM_MIN_MEDIAN: 281 if (!(Nmosaic = FindMosaicForImage (image, Nimage, N))) return value; 282 Nmosaic --; // XXX kind of a hack: FindMosaicForImage returns 0 or the mosaic seq number + 1 283 value.Flt = image[Nmosaic].fwhm_y / 25.0; 272 if (!image[N].parent) return value; 273 value.Flt = image[N].parent->fwhm_y / 25.0; 284 274 break; 285 275 -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dbExtractMeasures.c
r37246 r37377 581 581 case MEAS_XMOSAIC: /* offset relative to exposure center in camera coords */ 582 582 if (!haveMosaicMeas) { 583 if (REMOTE_CLIENT) { 584 mosaic = MatchMosaicMetadata (measure[0].imageID); 585 } else { 586 // fprintf (stderr, "non-parallel Xmos broken\n"); 587 // abort(); 588 // mosaic = MatchMosaic (measure[0].t, measure[0].photcode); 589 mosaic = MatchMosaicMetadata (measure[0].imageID); 590 } 583 mosaic = MatchMosaicMetadata (measure[0].imageID); 591 584 if (mosaic == NULL) break; 592 585 double Rm = measure[0].R; … … 598 591 case MEAS_YMOSAIC: /* OK */ 599 592 if (!haveMosaicMeas) { 600 if (REMOTE_CLIENT) { 601 mosaic = MatchMosaicMetadata (measure[0].imageID); 602 } else { 603 // fprintf (stderr, "non-parallel Xmos broken\n"); 604 // abort(); 605 // mosaic = MatchMosaic (measure[0].t, measure[0].photcode); 606 mosaic = MatchMosaicMetadata (measure[0].imageID); 607 } 593 mosaic = MatchMosaicMetadata (measure[0].imageID); 608 594 if (mosaic == NULL) break; 609 595 double Rm = measure[0].R; -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert.c
r37246 r37377 643 643 return (TRUE); } 644 644 645 if (!strcmp (extname, "DVO_IMAGE")) {646 Image *image;647 image = gfits_table_get_Image (ftable, &Nimage, NULL);648 if (!image) {649 fprintf (stderr, "ERROR: failed to read images\n");650 exit (2);651 }652 *format = DVO_FORMAT_INTERNAL;653 return (TRUE);654 }655 656 645 CONVERT_FORMAT ("DVO_IMAGE_ELIXIR", ELIXIR, Elixir); 657 646 CONVERT_FORMAT ("DVO_IMAGE_LONEOS", LONEOS, Loneos); … … 690 679 /* convert from the internal format */ 691 680 switch (format) { 692 case DVO_FORMAT_INTERNAL: {693 gfits_convert_Image ((Image *) ftable[0].buffer, sizeof(Image), Nimage);694 break; }695 696 681 FORMAT_CASE (ELIXIR, Elixir); 697 682 FORMAT_CASE (LONEOS, Loneos); … … 744 729 /* convert from the internal format */ 745 730 switch (format) { 746 case DVO_FORMAT_INTERNAL: {747 for (i = 0; i < Nrow; i++) {748 gfits_convert_Image ((Image *) vtable[0].buffer[i], sizeof(Image), 1);749 }750 return (TRUE); }751 752 731 FORMAT_CASE (ELIXIR, Elixir); 753 732 FORMAT_CASE (LONEOS, Loneos); -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c
r37246 r37377 219 219 220 220 for (i = 0; i < Nvalues; i++) { 221 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 221 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 222 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 223 out[i].coords.mosaic = NULL; 224 out[i].coords.imageMap = NULL; 222 225 223 226 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN … … 287 290 288 291 for (i = 0; i < Nvalues; i++) { 289 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 292 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 293 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 290 294 291 295 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c
r37246 r37377 214 214 215 215 for (i = 0; i < Nvalues; i++) { 216 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 216 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 217 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 218 out[i].coords.mosaic = NULL; 219 out[i].coords.imageMap = NULL; 217 220 218 221 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN … … 279 282 280 283 for (i = 0; i < Nvalues; i++) { 281 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 284 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 285 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 282 286 283 287 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_3.c
r37055 r37377 18 18 19 19 for (i = 0; i < Nvalues; i++) { 20 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 20 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 21 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 22 out[i].coords.mosaic = NULL; 23 out[i].coords.imageMap = NULL; 21 24 22 25 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN … … 78 81 79 82 for (i = 0; i < Nvalues; i++) { 80 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 83 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 84 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 81 85 82 86 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_REF.c
r37035 r37377 145 145 146 146 for (i = 0; i < Nvalues; i++) { 147 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 147 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 148 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 149 out[i].coords.mosaic = NULL; 150 out[i].coords.imageMap = NULL; 148 151 149 152 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN … … 208 211 209 212 for (i = 0; i < Nvalues; i++) { 210 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 213 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 214 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 211 215 212 216 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c
r37246 r37377 238 238 239 239 for (i = 0; i < Nvalues; i++) { 240 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 240 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 241 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 242 out[i].coords.mosaic = NULL; 243 out[i].coords.imageMap = NULL; 241 244 242 245 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN … … 302 305 303 306 for (i = 0; i < Nvalues; i++) { 304 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 307 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 308 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 305 309 306 310 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_V2.c
r37246 r37377 249 249 250 250 for (i = 0; i < Nvalues; i++) { 251 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 251 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 252 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 253 out[i].coords.mosaic = NULL; 254 out[i].coords.imageMap = NULL; 252 255 253 256 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN … … 313 316 314 317 for (i = 0; i < Nvalues; i++) { 315 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 318 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 319 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 316 320 317 321 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_V3.c
r37246 r37377 259 259 260 260 for (i = 0; i < Nvalues; i++) { 261 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 261 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 262 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 263 out[i].coords.mosaic = NULL; 264 out[i].coords.imageMap = NULL; 262 265 263 266 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN … … 323 326 324 327 for (i = 0; i < Nvalues; i++) { 325 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 328 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 329 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 326 330 327 331 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c
r37246 r37377 299 299 300 300 for (i = 0; i < Nvalues; i++) { 301 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 301 // this is only save because the initial 120 bytes in Coords match CoordsDisk 302 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 303 out[i].coords.mosaic = NULL; 304 out[i].coords.imageMap = NULL; 302 305 303 306 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN … … 363 366 364 367 for (i = 0; i < Nvalues; i++) { 365 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 368 // this is only save because the initial 120 bytes in Coords match CoordsDisk 369 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 366 370 367 371 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c
r37356 r37377 676 676 677 677 for (i = 0; i < Nvalues; i++) { 678 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 678 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 679 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 680 out[i].coords.mosaic = NULL; 681 out[i].coords.imageMap = NULL; 679 682 680 683 // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN … … 741 744 742 745 for (i = 0; i < Nvalues; i++) { 743 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 746 // this is only save because the initial 120 bytes in Coords match CoordsDisk 747 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 744 748 745 749 // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_elixir.c
r37035 r37377 210 210 211 211 for (i = 0; i < Nvalues; i++) { 212 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 212 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 213 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 214 out[i].coords.mosaic = NULL; 215 out[i].coords.imageMap = NULL; 213 216 214 217 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN … … 280 283 281 284 for (i = 0; i < Nvalues; i++) { 282 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 285 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 286 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 283 287 284 288 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_loneos.c
r37035 r37377 188 188 189 189 for (i = 0; i < Nvalues; i++) { 190 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 190 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 191 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 192 out[i].coords.mosaic = NULL; 193 out[i].coords.imageMap = NULL; 191 194 192 195 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN … … 259 262 260 263 for (i = 0; i < Nvalues; i++) { 261 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 264 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 265 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 262 266 263 267 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c
r37035 r37377 227 227 228 228 for (i = 0; i < Nvalues; i++) { 229 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 229 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 230 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 231 out[i].coords.mosaic = NULL; 232 out[i].coords.imageMap = NULL; 230 233 231 234 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN … … 297 300 298 301 for (i = 0; i < Nvalues; i++) { 299 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 302 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 303 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 300 304 301 305 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c
r37035 r37377 227 227 228 228 for (i = 0; i < Nvalues; i++) { 229 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 229 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 230 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 231 out[i].coords.mosaic = NULL; 232 out[i].coords.imageMap = NULL; 230 233 231 234 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN … … 297 300 298 301 for (i = 0; i < Nvalues; i++) { 299 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 302 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 303 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 300 304 301 305 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_image.c
r37035 r37377 200 200 201 201 gfits_create_matrix (&db[0].header, &db[0].matrix); 202 gfits_table_set_Image (&db[0].ftable , NULL, 0);202 gfits_table_set_Image (&db[0].ftable); 203 203 204 204 gfits_modify (&db[0].header, "NIMAGES", "%d", 1, 0); … … 207 207 dvo_image_createID (&db[0].header); 208 208 209 if (db[0].format == DVO_FORMAT_INTERNAL) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "INTERNAL");209 // if (db[0].format == DVO_FORMAT_INTERNAL) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "INTERNAL"); 210 210 if (db[0].format == DVO_FORMAT_LONEOS) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "LONEOS"); 211 211 if (db[0].format == DVO_FORMAT_ELIXIR) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "ELIXIR"); … … 267 267 } 268 268 269 int gfits_table_set_Image (FTable *ftable) { 270 271 Header *header; 272 273 header = ftable[0].header; 274 275 gfits_table_mkheader_Image (header); 276 277 /* create table */ 278 if (!gfits_create_table (header, ftable)) return (FALSE); 279 280 return (TRUE); 281 } 282 283 int gfits_table_mkheader_Image (Header *header) { 284 285 /* create table header */ 286 if (!gfits_create_table_header (header, "BINTABLE", "DVO_IMAGE")) return (FALSE); 287 288 /* define table layout */ 289 /** TABLE DEFINITION **/ 290 gfits_define_bintable_column (header, "D", "CRVAL1", "coordinate at reference pixel", "", 1.0, 0.0); 291 gfits_define_bintable_column (header, "D", "CRVAL2", "coordinate at reference pixel", "", 1.0, 0.0); 292 # if (0) 293 gfits_define_bintable_column (header, "E", "CRPIX1", "coordinate of reference pixel", "", 1.0, 0.0); 294 gfits_define_bintable_column (header, "E", "CRPIX2", "coordinate of reference pixel", "", 1.0, 0.0); 295 gfits_define_bintable_column (header, "E", "CDELT1", "degrees per pixel", "", 1.0, 0.0); 296 gfits_define_bintable_column (header, "E", "CDELT2", "degrees per pixel", "", 1.0, 0.0); 297 gfits_define_bintable_column (header, "E", "PC1_1", "rotation matrix", "", 1.0, 0.0); 298 gfits_define_bintable_column (header, "E", "PC1_2", "rotation matrix", "", 1.0, 0.0); 299 gfits_define_bintable_column (header, "E", "PC2_1", "rotation matrix", "", 1.0, 0.0); 300 gfits_define_bintable_column (header, "E", "PC2_2", "rotation matrix", "", 1.0, 0.0); 301 gfits_define_bintable_column (header, "14E", "POLYTERMS", "higher order warping terms", "", 1.0, 0.0); 302 gfits_define_bintable_column (header, "15A", "CTYPE", "coordinate type", "", 1.0, 0.0); 303 gfits_define_bintable_column (header, "A", "NPOLYTERMS", "order of polynomial", "", 1.0, 0.0); 304 gfits_define_bintable_column (header, "8B", "MOSAIC", "pointer to parent mosaic", "", 1.0, 0.0); 305 gfits_define_bintable_column (header, "8B", "IMAGE_MAP", "pointer to image map", "", 1.0, 0.0); 306 gfits_define_bintable_column (header, "J", "TZERO", "readout time (row 0)", "", 1.0, 0.0); 307 gfits_define_bintable_column (header, "J", "NSTAR", "number of stars on image", "", 1.0, 0.0); 308 gfits_define_bintable_column (header, "E", "SECZ", "airmass", "mag", 1.0, 0.0); 309 gfits_define_bintable_column (header, "I", "NX", "image width", "", 1.0, 0.0); 310 gfits_define_bintable_column (header, "I", "NY", "image height", "", 1.0, 0.0); 311 gfits_define_bintable_column (header, "E", "APMIFIT", "aperture correction", "mag", 1.0, 0.0); 312 gfits_define_bintable_column (header, "E", "DAPMIFIT", "apmifit error", "mag", 1.0, 0.0); 313 gfits_define_bintable_column (header, "E", "MCAL", "calibration mag", "mag", 1.0, 0.0); 314 gfits_define_bintable_column (header, "E", "DMCAL", "error on Mcal", "mag", 1.0, 0.0); 315 gfits_define_bintable_column (header, "I", "XM", "image chisq", "10*log(value)", 1.0, 0.0); 316 gfits_define_bintable_column (header, "I", "PHOTCODE", "identifier for CCD,", "", 1.0, 0.0); 317 gfits_define_bintable_column (header, "E", "EXPTIME", "exposure time", "seconds", 1.0, 0.0); 318 gfits_define_bintable_column (header, "E", "ST", "sidereal time of exposure", "", 1.0, 0.0); 319 gfits_define_bintable_column (header, "E", "LAT", "observatory latitude", "degrees", 1.0, 0.0); 320 gfits_define_bintable_column (header, "E", "RA_CENTER", "image center", "degrees", 1.0, 0.0); 321 gfits_define_bintable_column (header, "E", "DEC_CENTER", "image center", "degrees", 1.0, 0.0); 322 gfits_define_bintable_column (header, "E", "RADIUS", "image radius", "degrees", 1.0, 0.0); 323 gfits_define_bintable_column (header, "E", "REF_COLOR_BLUE", "median astrometry ref color", "", 1.0, 0.0); 324 gfits_define_bintable_column (header, "E", "REF_COLOR_RED", "median astrometry ref color", "", 1.0, 0.0); 325 gfits_define_bintable_column (header, "117A", "NAME", "name of original image ", "", 1.0, 0.0); 326 gfits_define_bintable_column (header, "B", "DETECTION_LIMIT", "detection limit", "10*mag", 1.0, 0.0); 327 gfits_define_bintable_column (header, "B", "SATURATION_LIMIT", "saturation limit", "10*mag", 1.0, 0.0); 328 gfits_define_bintable_column (header, "B", "CERROR", "astrometric error", "50*arcsec", 1.0, 0.0); 329 gfits_define_bintable_column (header, "B", "FWHM_X", "PSF x width", "25*arcsec", 1.0, 0.0); 330 gfits_define_bintable_column (header, "B", "FWHM_Y", "PSF y width", "25*arcsec", 1.0, 0.0); 331 gfits_define_bintable_column (header, "B", "TRATE", "scan rate", "100 usec/pixel", 1.0, 0.0); 332 gfits_define_bintable_column (header, "B", "CCDNUM", "CCD ID number", "", 1.0, 0.0); 333 gfits_define_bintable_column (header, "J", "FLAGS", "image quality flags", "", 1.0, 0.0); 334 gfits_define_bintable_column (header, "J", "IMAGE_ID", "internal image ID", "", 1.0, 0.0); 335 gfits_define_bintable_column (header, "J", "PARENT_ID", "associated ref image", "", 1.0, 0.0); 336 gfits_define_bintable_column (header, "J", "EXTERN_ID", "external image ID", "", 1.0, 0.0); 337 gfits_define_bintable_column (header, "I", "SOURCE_ID", "analysis source ID", "", 1.0, 0.0); 338 gfits_define_bintable_column (header, "I", "NLINK_ASTROM", "mean number of matched measurements for astrometry", "", 1.0, 0.0); 339 gfits_define_bintable_column (header, "I", "NLINK_PHOTOM", "mean number of matched measurements for astrometry", "", 1.0, 0.0); 340 gfits_define_bintable_column (header, "I", "UBERCAL_DIST", "distance to nearest ubercal image", "", 1.0, 0.0); 341 gfits_define_bintable_column (header, "E", "XPIX_SYS_ERR", "systematic astrometry error in X", "", 1.0, 0.0); 342 gfits_define_bintable_column (header, "E", "YPIX_SYS_ERR", "systematic astrometry error in Y", "", 1.0, 0.0); 343 gfits_define_bintable_column (header, "E", "MAG_SYS_ERR", "systematic photometry error", "", 1.0, 0.0); 344 gfits_define_bintable_column (header, "I", "N_FIT_ASTROM", "number of stars used for astrometry cal", "", 1.0, 0.0); 345 gfits_define_bintable_column (header, "I", "N_FIT_PHOTOM", "number of stars used for photometry cal", "", 1.0, 0.0); 346 gfits_define_bintable_column (header, "J", "PHOTOM_MAP_ID", "reference to 2D zero point map", "", 1.0, 0.0); 347 gfits_define_bintable_column (header, "J", "ASTROM_MAP_ID", "reference to 2D astrometry map", "", 1.0, 0.0); 348 gfits_define_bintable_column (header, "8B", "PARENT", "pointer to parent mosaic (not save to disk)", "", 1.0, 0.0); 349 # endif 350 351 return (TRUE); 352 } 353 354 /* return internal structure representation */ 355 Image *gfits_table_get_Image (FTable *ftable, off_t *Ndata, char *swapped) { 356 357 int Ncols; 358 Image *data; 359 360 Ncols = ftable[0].header[0].Naxis[0]; 361 if (Ncols != 384) { 362 fprintf (stderr, "ERROR: mis-match in table size: width is %d but should be %d bytes\n", Ncols, 384); 363 return NULL; 364 } 365 366 *Ndata = ftable[0].header[0].Naxis[1]; 367 data = (Image *) ftable[0].buffer; 368 369 if (!swapped) { 370 myAbort ("invalid to call this without suppying 'swapped'"); 371 } 372 if (*swapped == FALSE) { 373 myAbort ("invalid for table to be swapped"); 374 } 375 376 return (data); 377 } 378 -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_util.c
r33030 r37377 145 145 if ((image->externID == externID) && (image->sourceID == sourceID)) { 146 146 BuildChipMatch(dvoConfig->images, dvoConfig->nImages); 147 if (FindMosaicForImage(dvoConfig->images, dvoConfig->nImages, i)) { 148 return image; 149 } else { 150 fprintf(stderr, "FindMosaicForImage failed\n"); 151 return NULL; 152 } 147 return image; 153 148 } 154 149 } -
branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/mosaic_astrom.c
r29938 r37377 1 1 # include <dvo.h> 2 3 // the block of code below was used to define the chip->mosaic relationship before this 4 // was assigned to the coords value 2 5 3 6 off_t getDISentry (e_time start, e_time stop, e_time *startMos, off_t *indexMos, off_t Nmosaic); 4 7 void SortDISindex (e_time *S, off_t *I, off_t N); 8 9 # if (0) 5 10 6 11 /* chip-match table: j = ChipMatch[i], images[j] is DIS for images[i] WRP */ … … 93 98 } 94 99 95 int BuildChipMatch_old (Image *images, off_t Nimages) { 100 // this is a very old version of BuildChipMatch which does not use bisection 101 int BuildChipMatch_nosort (Image *images, off_t Nimages) { 96 102 97 103 off_t i, j, NDIS; … … 140 146 } 141 147 142 int BuildChipMatch (Image *images, off_t Nimages) { 148 // this is an old version of BuildChipMatch which stores the results here in a local static variable 149 int BuildChipMatch_static (Image *images, off_t Nimages) { 143 150 144 151 off_t i, j, NDIS; … … 198 205 return (TRUE); 199 206 } 200 207 # endif 208 209 int BuildChipMatch (Image *images, off_t Nimages) { 210 211 off_t i, j, NDIS; 212 213 off_t Ndis = 0; 214 off_t *DISentry = NULL; 215 e_time *DIStzero = NULL; 216 217 if (DISentry != NULL) free (DISentry); 218 if (DIStzero != NULL) free (DIStzero); 219 220 // allocate containers for DIS indexing 221 Ndis = 0; 222 NDIS = 100; 223 ALLOCATE (DISentry, off_t, NDIS); 224 ALLOCATE (DIStzero, e_time, NDIS); 225 226 // find all DIS images, save tzero (& photcode?) 227 for (i = 0; i < Nimages; i++) { 228 if (strcmp(&images[i].coords.ctype[4], "-DIS")) continue; 229 DISentry[Ndis] = i; 230 DIStzero[Ndis] = images[i].tzero; 231 Ndis ++; 232 if (Ndis >= NDIS) { 233 NDIS += 100; 234 REALLOCATE (DISentry, off_t, NDIS); 235 REALLOCATE (DIStzero, e_time, NDIS); 236 } 237 } 238 239 // sort the index, start, and stop by the start times: 240 SortDISindex (DIStzero, DISentry, Ndis); 241 242 /* find all matched WRP images */ 243 for (i = 0; i < Nimages; i++) { 244 images[i].parent = NULL; // reset to NULL 245 images[i].coords.mosaic = NULL; // reset to NULL 246 if (strcmp(&images[i].coords.ctype[4], "-WRP")) continue; // only define link for WRP coords 247 248 j = getDISentry (images[i].tzero, images[i].tzero + (int) images[i].exptime, DIStzero, DISentry, Ndis); 249 if (j == -1) { 250 fprintf (stderr, "WARNING: can't find matching mosaic \n"); 251 continue; 252 } 253 if (j >= Nimages) myAbort("invalid DIS entry"); 254 images[i].parent = &images[j]; 255 images[i].coords.mosaic = &images[j].coords; 256 } 257 return (TRUE); 258 } 259 260 // use bisection to find the overlapping mosaic 201 261 off_t getDISentry (e_time start, e_time stop, e_time *startMos, off_t *indexMos, off_t Nmosaic) { 202 203 // use bisection to find the overlapping mosaic204 262 205 263 off_t Nlo, Nhi, N;
Note:
See TracChangeset
for help on using the changeset viewer.
