Changeset 29001 for trunk/Ohana/src/libdvo
- Timestamp:
- Aug 20, 2010, 12:05:07 PM (16 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 9 edited
-
. (modified) (1 prop)
-
src/libdvo/include/dvo.h (modified) (2 diffs)
-
src/libdvo/src/LoadPhotcodesFITS.c (modified) (8 diffs)
-
src/libdvo/src/cmf-ps1-v1-alt.c (modified) (1 diff)
-
src/libdvo/src/coordops.c (modified) (12 diffs)
-
src/libdvo/src/dvo_catalog_mef.c (modified) (1 diff)
-
src/libdvo/src/dvo_catalog_split.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert.c (modified) (9 diffs)
-
src/libdvo/src/skyregion_io.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
- Property svn:mergeinfo deleted
-
trunk/Ohana/src/libdvo/include/dvo.h
r28855 r29001 85 85 # define PHOT_MAG 0x06 /* generic magnitude; never stored */ 86 86 87 /* Image.code values. these are codes to note bad images */ 88 # define ID_IMAGE_NEW 0x0000 /* no nrphot attempted */ 89 # define ID_IMAGE_NOCAL 0x0001 /* used within nrphot to mean "don't apply fit" */ 90 # define ID_IMAGE_POOR 0x0002 /* relphot says image is bad */ 91 # define ID_IMAGE_SKIP 0x0004 /* external information image is bad */ 92 # define ID_IMAGE_FEW 0x0008 /* currently too few measurements for good value */ 87 /* Image.code values -- these values are 32 bit (as of PS1_V1) */ 88 typedef enum { 89 ID_IMAGE_NEW = 0x00000000, /* no calibrations yet attempted */ 90 ID_IMAGE_PHOTOM_NOCAL = 0x00000001, /* user-set value used within relphot: ignore */ 91 ID_IMAGE_PHOTOM_POOR = 0x00000002, /* relphot says image is bad (dMcal > limit) */ 92 ID_IMAGE_PHOTOM_SKIP = 0x00000004, /* user-set value: assert that this image has bad photometry */ 93 ID_IMAGE_PHOTOM_FEW = 0x00000008, /* currently too few measurements for photometry */ 94 ID_IMAGE_ASTROM_NOCAL = 0x00000010, /* user-set value used within relastro: ignore */ 95 ID_IMAGE_ASTROM_POOR = 0x00000020, /* relastro says image is bad (dR,dD > limit) */ 96 ID_IMAGE_ASTROM_FAIL = 0x00000040, /* relastro fit diverged, fit not applied */ 97 ID_IMAGE_ASTROM_SKIP = 0x00000080, /* user-set value: assert that this image has bad astrometry */ 98 ID_IMAGE_ASTROM_FEW = 0x00000100, /* currently too few measurements for astrometry */ 99 } DVOImageFlags; 93 100 94 101 /* Measure.flags values -- these values are 32 bit (as of PS1_V1) */ 95 102 typedef enum { 96 ID_MEAS_NOCAL = 0x000 1, // detection ignored for this analysis (photcode, time range) -- internal only97 ID_MEAS_POOR_PHOTOM = 0x000 2, // detection is photometry outlier98 ID_MEAS_SKIP_PHOTOM = 0x000 4, // detection was ignored for photometry measurement99 ID_MEAS_AREA = 0x000 8, // detection near image edge100 ID_MEAS_POOR_ASTROM = 0x00 10, // detection is astrometry outlier101 ID_MEAS_SKIP_ASTROM = 0x00 20, // detection was ignored for astrometry measurement102 ID_MEAS_USED_OBJ = 0x00 40, // detection was used during opdate objects103 ID_MEAS_USED_CHIP = 0x00 80, // detection was used during update chips104 ID_MEAS_BLEND_MEAS = 0x0 100, // detection is within radius of multiple objects105 ID_MEAS_BLEND_OBJ = 0x0 200, // multiple detections within radius of object106 ID_MEAS_UNDEF_3 = 0x0 400, // unused107 ID_MEAS_UNDEF_4 = 0x0 800, // unused108 ID_MEAS_BLEND_MEAS_X = 0x 1000, // detection is within radius of multiple objects across catalogs109 ID_MEAS_ARTIFACT = 0x 2000, // detection is thought to be non-astronomical110 ID_MEAS_UNDEF_5 = 0x 4000, // unused111 ID_MEAS_UNDEF_6 = 0x 8000, // unused103 ID_MEAS_NOCAL = 0x00000001, // detection ignored for this analysis (photcode, time range) -- internal only 104 ID_MEAS_POOR_PHOTOM = 0x00000002, // detection is photometry outlier 105 ID_MEAS_SKIP_PHOTOM = 0x00000004, // detection was ignored for photometry measurement 106 ID_MEAS_AREA = 0x00000008, // detection near image edge 107 ID_MEAS_POOR_ASTROM = 0x00000010, // detection is astrometry outlier 108 ID_MEAS_SKIP_ASTROM = 0x00000020, // detection was ignored for astrometry measurement 109 ID_MEAS_USED_OBJ = 0x00000040, // detection was used during opdate objects 110 ID_MEAS_USED_CHIP = 0x00000080, // detection was used during update chips 111 ID_MEAS_BLEND_MEAS = 0x00000100, // detection is within radius of multiple objects 112 ID_MEAS_BLEND_OBJ = 0x00000200, // multiple detections within radius of object 113 ID_MEAS_UNDEF_3 = 0x00000400, // unused 114 ID_MEAS_UNDEF_4 = 0x00000800, // unused 115 ID_MEAS_BLEND_MEAS_X = 0x00001000, // detection is within radius of multiple objects across catalogs 116 ID_MEAS_ARTIFACT = 0x00002000, // detection is thought to be non-astronomical 117 ID_MEAS_UNDEF_5 = 0x00004000, // unused 118 ID_MEAS_UNDEF_6 = 0x00008000, // unused 112 119 } DVOMeasureFlags; 113 120 … … 147 154 ID_STAR_USE_PM = 0x00100000, // proper motion used (not AVE or PAR) 148 155 ID_STAR_USE_PAR = 0x00200000, // parallax used (not AVE or PM) 156 ID_OBJ_EXT = 0x01000000, // extended in our data (eg, PS) 157 ID_OBJ_EXT_ALT = 0x02000000, // extended in external data (eg, 2MASS) 158 ID_OBJ_GOOD = 0x04000000, // good-quality measurement in our data (eg, PS) 159 ID_OBJ_GOOD_ALT = 0x08000000, // good-quality measurement in external data (eg, 2MASS) 149 160 } DVOAverageFlags; 150 161 -
trunk/Ohana/src/libdvo/src/LoadPhotcodesFITS.c
r27580 r29001 43 43 if (!strcmp (extname, "DVO_PHOTCODE")) { 44 44 PhotCode_Elixir *photcode_elixir = gfits_table_get_PhotCode_Elixir (&db.ftable, &Ncode, &db.swapped); 45 if (!photcode_elixir) { 46 fprintf (stderr, "ERROR: failed to read photcodes\n"); 47 exit (2); 48 } 45 49 photcode = PhotCode_Elixir_To_Internal (photcode_elixir, Ncode); 46 50 free (photcode_elixir); … … 49 53 if (!strcmp (extname, "DVO_PHOTCODE_ELIXIR")) { 50 54 PhotCode_Elixir *photcode_elixir = gfits_table_get_PhotCode_Elixir (&db.ftable, &Ncode, &db.swapped); 55 if (!photcode_elixir) { 56 fprintf (stderr, "ERROR: failed to read photcodes\n"); 57 exit (2); 58 } 51 59 photcode = PhotCode_Elixir_To_Internal (photcode_elixir, Ncode); 52 60 free (photcode_elixir); … … 55 63 if (!strcmp (extname, "DVO_PHOTCODE_PS1_DEV_1")) { 56 64 PhotCode_PS1_DEV_1 *photcode_ps1_dev_1 = gfits_table_get_PhotCode_PS1_DEV_1 (&db.ftable, &Ncode, &db.swapped); 65 if (!photcode_ps1_dev_1) { 66 fprintf (stderr, "ERROR: failed to read photcodes\n"); 67 exit (2); 68 } 57 69 photcode = PhotCode_PS1_DEV_1_To_Internal (photcode_ps1_dev_1, Ncode); 58 70 free (photcode_ps1_dev_1); … … 61 73 if (!strcmp (extname, "DVO_PHOTCODE_PS1_DEV_2")) { 62 74 PhotCode_PS1_DEV_2 *photcode_ps1_dev_2 = gfits_table_get_PhotCode_PS1_DEV_2 (&db.ftable, &Ncode, &db.swapped); 75 if (!photcode_ps1_dev_2) { 76 fprintf (stderr, "ERROR: failed to read photcodes\n"); 77 exit (2); 78 } 63 79 photcode = PhotCode_PS1_DEV_2_To_Internal (photcode_ps1_dev_2, Ncode); 64 80 free (photcode_ps1_dev_2); … … 67 83 if (!strcmp (extname, "DVO_PHOTCODE_PS1_DEV_3")) { 68 84 PhotCode_PS1_DEV_3 *photcode_ps1_dev_3 = gfits_table_get_PhotCode_PS1_DEV_3 (&db.ftable, &Ncode, &db.swapped); 85 if (!photcode_ps1_dev_3) { 86 fprintf (stderr, "ERROR: failed to read photcodes\n"); 87 exit (2); 88 } 69 89 photcode = PhotCode_PS1_DEV_3_To_Internal (photcode_ps1_dev_3, Ncode); 70 90 free (photcode_ps1_dev_3); … … 73 93 if (!strcmp (extname, "DVO_PHOTCODE_PS1_V1")) { 74 94 PhotCode_PS1_V1 *photcode_ps1_v1 = gfits_table_get_PhotCode_PS1_V1 (&db.ftable, &Ncode, &db.swapped); 95 if (!photcode_ps1_v1) { 96 fprintf (stderr, "ERROR: failed to read photcodes\n"); 97 exit (2); 98 } 75 99 photcode = PhotCode_PS1_V1_To_Internal (photcode_ps1_v1, Ncode); 76 100 free (photcode_ps1_v1); … … 79 103 if (!strcmp (extname, "DVO_PHOTCODE_PS1_V2")) { 80 104 PhotCode_PS1_V2 *photcode_ps1_v2 = gfits_table_get_PhotCode_PS1_V2 (&db.ftable, &Ncode, &db.swapped); 105 if (!photcode_ps1_v2) { 106 fprintf (stderr, "ERROR: failed to read photcodes\n"); 107 exit (2); 108 } 81 109 photcode = PhotCode_PS1_V2_To_Internal (photcode_ps1_v2, Ncode); 82 110 free (photcode_ps1_v2); … … 85 113 if (!strcmp (extname, "DVO_PHOTCODE_PS1_REF")) { 86 114 PhotCode_PS1_REF *photcode_ps1_ref = gfits_table_get_PhotCode_PS1_REF (&db.ftable, &Ncode, &db.swapped); 115 if (!photcode_ps1_ref) { 116 fprintf (stderr, "ERROR: failed to read photcodes\n"); 117 exit (2); 118 } 87 119 photcode = PhotCode_PS1_REF_To_Internal (photcode_ps1_ref, Ncode); 88 120 free (photcode_ps1_ref); -
trunk/Ohana/src/libdvo/src/cmf-ps1-v1-alt.c
r28241 r29001 14 14 if (ftable[0].header[0].Naxis[0] != 136) { 15 15 fprintf (stderr, "ERROR: wrong format for CMF_PS1_V1_Alt: "OFF_T_FMT" vs %d\n", ftable[0].header[0].Naxis[0], 136); 16 exit (2);16 return (NULL); 17 17 } 18 18 -
trunk/Ohana/src/libdvo/src/coordops.c
r28837 r29001 20 20 int XY_to_LM (double *L, double *M, double x, double y, Coords *coords) { 21 21 22 OhanaProjection proj; 23 OhanaProjectionMode mode; 22 24 double X, Y, X2, XY, Y2, X3, Y3; 25 26 proj = GetProjection (coords[0].ctype); 27 mode = GetProjectionMode (proj); 23 28 24 29 /** convert pixel coordinates to cartesian system **/ … … 45 50 } 46 51 52 if (mode == PROJ_MODE_CARTESIAN) { 53 *L += coords[0].crval1; 54 *M += coords[0].crval2; 55 } 56 47 57 return (TRUE); 48 58 } … … 64 74 /** Locally Cartesian Projections **/ 65 75 if (mode == PROJ_MODE_CARTESIAN) { 66 *ra = L + coords[0].crval1;67 *dec = M + coords[0].crval2;68 69 76 /* mosaic astrometry : WRP is chip astrometry; apply mosaic (DIS) term */ 70 77 if (proj == PROJ_WRP) { 71 78 if (!gotMosaic) return (FALSE); 72 XY_to_RD (ra, dec, *ra, *dec, &mosaic);79 XY_to_RD (ra, dec, L, M, &mosaic); 73 80 } 74 81 return (TRUE); … … 183 190 184 191 double phi, theta; 185 double Lo, Mo;186 192 double sphi, cphi, stht, ctht; 187 193 double salp, calp, sdel, cdel, sdp, cdp; … … 201 207 if (proj == PROJ_WRP) { 202 208 if (!gotMosaic) return (FALSE); 203 RD_to_XY (&Lo, &Mo, ra, dec, &mosaic); 204 *L = (Lo - coords[0].crval1); 205 *M = (Mo - coords[0].crval2); 209 RD_to_XY (L, M, ra, dec, &mosaic); 206 210 return (TRUE); 207 211 } 208 *L = (ra - coords[0].crval1);209 *M = (dec - coords[0].crval2);212 *L = ra; 213 *M = dec; 210 214 return (TRUE); 211 215 } … … 310 314 double dX, dY, Lo, Mo, dL, dM; 311 315 double dLdX, dLdY, dMdX, dMdY, Do; 316 OhanaProjection proj; 317 OhanaProjectionMode mode; 318 319 proj = GetProjection (coords[0].ctype); 320 mode = GetProjectionMode (proj); 312 321 313 322 *x = 0; 314 323 *y = 0; 324 325 if (mode == PROJ_MODE_CARTESIAN) { 326 L -= coords[0].crval1; 327 M -= coords[0].crval2; 328 } 315 329 316 330 /* start with linear solution for X,Y */ … … 422 436 } 423 437 438 enum {COORD_TYPE_NONE, COORD_TYPE_PC, COORD_TYPE_ROT, COORD_TYPE_CD, COORD_TYPE_LIN}; 439 424 440 int GetCoords (Coords *coords, Header *header) { 425 441 … … 428 444 double equinox; 429 445 char *ctype; 446 int mode; 430 447 431 448 rotate = 0.0; … … 437 454 strcpy (coords[0].ctype, "NONE"); 438 455 439 status = FALSE; 440 if (gfits_scan (header, "CTYPE2", "%s", 1, coords[0].ctype)) { 441 status = gfits_scan (header, "CRVAL1", "%lf", 1, &coords[0].crval1); 442 status &= gfits_scan (header, "CRPIX1", "%f", 1, &coords[0].crpix1); 443 status &= gfits_scan (header, "CRVAL2", "%lf", 1, &coords[0].crval2); 444 status &= gfits_scan (header, "CRPIX2", "%f", 1, &coords[0].crpix2); 445 446 if (gfits_scan (header, "CDELT1", "%f", 1, &coords[0].cdelt1)) { 447 status &= gfits_scan (header, "CDELT2", "%f", 1, &coords[0].cdelt2); 448 if (gfits_scan (header, "CROTA2", "%lf", 1, &rotate)) { 449 Lambda = coords[0].cdelt2 / coords[0].cdelt1; 450 coords[0].pc1_1 = cos(rotate*RAD_DEG); 451 coords[0].pc1_2 = -sin(rotate*RAD_DEG) * Lambda; 452 coords[0].pc2_1 = sin(rotate*RAD_DEG) / Lambda; 453 coords[0].pc2_2 = cos(rotate*RAD_DEG); 454 } 455 if (gfits_scan (header, "PC001001", "%f", 1, &coords[0].pc1_1)) { 456 status &= gfits_scan (header, "PC001002", "%f", 1, &coords[0].pc1_2); 457 status &= gfits_scan (header, "PC002001", "%f", 1, &coords[0].pc2_1); 458 status &= gfits_scan (header, "PC002002", "%f", 1, &coords[0].pc2_2); 459 } 456 mode = COORD_TYPE_NONE; 457 { 458 int haveCTYPE, haveCDELT, haveCROTA, haveCDij, havePCij, haveRAo; 459 float tmp; 460 char stmp[80]; 461 462 // there are a few different representations for scale and rotation. choose an appropriate 463 // set: (CDELTi + CROTAi), (CDELTi + PCij), (CDij), 464 465 haveCTYPE = gfits_scan (header, "CTYPE2", "%s", 1, stmp); 466 haveCDELT = gfits_scan (header, "CDELT1", "%f", 1, &tmp); 467 haveCROTA = gfits_scan (header, "CROTA1", "%f", 1, &tmp); 468 haveCDij = gfits_scan (header, "CD1_1", "%f", 1, &tmp); 469 havePCij = gfits_scan (header, "PC001001", "%f", 1, &tmp); 470 haveRAo = gfits_scan (header, "RA_O", "%f", 1, &tmp); 471 472 if (haveCTYPE && havePCij && haveCDELT) { mode = COORD_TYPE_PC; goto gotit; } 473 if (haveCTYPE && haveCROTA && haveCDELT) { mode = COORD_TYPE_ROT; goto gotit; } 474 if (haveCTYPE && haveCDij) { mode = COORD_TYPE_CD; goto gotit; } 475 if (haveRAo) { mode = COORD_TYPE_LIN; goto gotit; } 476 // fprintf (stderr, "no valid WCS keywords\n"); 477 return (FALSE); 478 } 479 480 gotit: 481 482 status = TRUE; 483 switch (mode) { 484 case COORD_TYPE_PC: 485 status &= gfits_scan (header, "CTYPE2", "%s", 1, coords[0].ctype); 486 status &= gfits_scan (header, "CRVAL1", "%lf", 1, &coords[0].crval1); 487 status &= gfits_scan (header, "CRPIX1", "%f", 1, &coords[0].crpix1); 488 status &= gfits_scan (header, "CRVAL2", "%lf", 1, &coords[0].crval2); 489 status &= gfits_scan (header, "CRPIX2", "%f", 1, &coords[0].crpix2); 490 491 status &= gfits_scan (header, "CDELT1", "%f", 1, &coords[0].cdelt1); 492 status &= gfits_scan (header, "CDELT2", "%f", 1, &coords[0].cdelt2); 493 status &= gfits_scan (header, "PC001001", "%f", 1, &coords[0].pc1_1); 494 status &= gfits_scan (header, "PC001002", "%f", 1, &coords[0].pc1_2); 495 status &= gfits_scan (header, "PC002001", "%f", 1, &coords[0].pc2_1); 496 status &= gfits_scan (header, "PC002002", "%f", 1, &coords[0].pc2_2); 460 497 461 498 /* set NPLYTERM based on header. if NPLYTERM is missing, it should have a … … 491 528 break; 492 529 } 493 } else { 494 if (gfits_scan (header, "CD1_1", "%f", 1, &coords[0].pc1_1)) { 495 status &= gfits_scan (header, "CD1_2", "%f", 1, &coords[0].pc1_2); 496 status &= gfits_scan (header, "CD2_1", "%f", 1, &coords[0].pc2_1); 497 status &= gfits_scan (header, "CD2_2", "%f", 1, &coords[0].pc2_2); 498 /* renormalize */ 499 scale = hypot (coords[0].pc1_1, coords[0].pc1_2); 500 coords[0].cdelt1 = coords[0].cdelt2 = scale; 501 coords[0].pc1_1 /= scale; 502 coords[0].pc1_2 /= scale; 503 coords[0].pc2_1 /= scale; 504 coords[0].pc2_2 /= scale; 505 } else { 506 status = FALSE; 507 } 508 } 509 } else { 510 /* some of my thesis data uses this simple linear model - convert on read? */ 511 if (gfits_scan (header, "RA_O", "%lf", 1, &coords[0].crval1)) { 512 status = gfits_scan (header, "RA_X", "%f", 1, &coords[0].pc1_1); 530 break; 531 532 case COORD_TYPE_ROT: 533 status &= gfits_scan (header, "CTYPE2", "%s", 1, coords[0].ctype); 534 status &= gfits_scan (header, "CRVAL1", "%lf", 1, &coords[0].crval1); 535 status &= gfits_scan (header, "CRPIX1", "%f", 1, &coords[0].crpix1); 536 status &= gfits_scan (header, "CRVAL2", "%lf", 1, &coords[0].crval2); 537 status &= gfits_scan (header, "CRPIX2", "%f", 1, &coords[0].crpix2); 538 539 status &= gfits_scan (header, "CDELT1", "%f", 1, &coords[0].cdelt1); 540 status &= gfits_scan (header, "CDELT2", "%f", 1, &coords[0].cdelt2); 541 542 status &= gfits_scan (header, "CROTA2", "%lf", 1, &rotate); 543 Lambda = coords[0].cdelt2 / coords[0].cdelt1; 544 coords[0].pc1_1 = cos(rotate*RAD_DEG); 545 coords[0].pc1_2 = -sin(rotate*RAD_DEG) * Lambda; 546 coords[0].pc2_1 = sin(rotate*RAD_DEG) / Lambda; 547 coords[0].pc2_2 = cos(rotate*RAD_DEG); 548 break; 549 550 case COORD_TYPE_CD: 551 status &= gfits_scan (header, "CTYPE2", "%s", 1, coords[0].ctype); 552 status &= gfits_scan (header, "CRVAL1", "%lf", 1, &coords[0].crval1); 553 status &= gfits_scan (header, "CRPIX1", "%f", 1, &coords[0].crpix1); 554 status &= gfits_scan (header, "CRVAL2", "%lf", 1, &coords[0].crval2); 555 status &= gfits_scan (header, "CRPIX2", "%f", 1, &coords[0].crpix2); 556 557 status &= gfits_scan (header, "CD1_1", "%f", 1, &coords[0].pc1_1); 558 status &= gfits_scan (header, "CD1_2", "%f", 1, &coords[0].pc1_2); 559 status &= gfits_scan (header, "CD2_1", "%f", 1, &coords[0].pc2_1); 560 status &= gfits_scan (header, "CD2_2", "%f", 1, &coords[0].pc2_2); 561 /* renormalize */ 562 scale = hypot (coords[0].pc1_1, coords[0].pc1_2); 563 coords[0].cdelt1 = coords[0].cdelt2 = scale; 564 coords[0].pc1_1 /= scale; 565 coords[0].pc1_2 /= scale; 566 coords[0].pc2_1 /= scale; 567 coords[0].pc2_2 /= scale; 568 break; 569 570 case COORD_TYPE_LIN: 571 /* some of my thesis data uses this simple linear model - convert on read? */ 572 status &= gfits_scan (header, "RA_O", "%lf", 1, &coords[0].crval1); 573 status &= gfits_scan (header, "RA_X", "%f", 1, &coords[0].pc1_1); 513 574 status &= gfits_scan (header, "RA_Y", "%f", 1, &coords[0].pc1_2); 514 575 status &= gfits_scan (header, "DEC_O", "%lf", 1, &coords[0].crval2); … … 518 579 coords[0].cdelt1 = coords[0].cdelt2 = 1.0; 519 580 strcpy (coords[0].ctype, "GENE"); 520 } 521 } 581 break; 582 } 583 522 584 if (status) { 523 585 if (!gfits_scan (header, "EQUINOX", "%lf", 1, &equinox)) { … … 530 592 } 531 593 } 594 532 595 if (!status) { 533 fprintf (stderr, "error getting all elements for coordinate mode %s\n", coords[0].ctype);596 // fprintf (stderr, "error getting all elements for coordinate mode %s\n", coords[0].ctype); 534 597 coords[0].crval1 = coords[0].crpix1 = coords[0].cdelt1 = 0.0; 535 598 coords[0].crval2 = coords[0].crpix2 = coords[0].cdelt2 = 0.0; -
trunk/Ohana/src/libdvo/src/dvo_catalog_mef.c
r28241 r29001 125 125 /* no conversions currently defined */ 126 126 catalog[0].missing = gfits_table_get_Missing (&ftable, &catalog[0].Nmissing, NULL); 127 if (!catalog[0].missing) { 128 fprintf (stderr, "ERROR: failed to read missing\n"); 129 exit (2); 130 } 127 131 if (Nmissing != catalog[0].Nmiss_disk) { 128 132 fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n", Nmissing, catalog[0].Nmiss_disk); -
trunk/Ohana/src/libdvo/src/dvo_catalog_split.c
r28241 r29001 285 285 /* no conversions currently defined : this just does the byte swap */ 286 286 catalog[0].missing = gfits_table_get_Missing (&ftable, &Nmissing, NULL); 287 if (!catalog[0].missing) { 288 fprintf (stderr, "ERROR: failed to read missing\n"); 289 exit (2); 290 } 287 291 if (Nmissing != catalog[0].Nmiss_disk) { 288 292 fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n", Nmissing, catalog[0].Nmiss_disk); … … 473 477 /* no conversions currently defined : this just does the byte swap */ 474 478 catalog[0].missing = gfits_table_get_Missing (&ftable, &Nmissing, NULL); 479 if (!catalog[0].missing) { 480 fprintf (stderr, "ERROR: failed to read missing\n"); 481 exit (2); 482 } 475 483 if (Nmissing != Nrows) { 476 484 fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n", Nmissing, Nrows); -
trunk/Ohana/src/libdvo/src/dvo_convert.c
r28241 r29001 32 32 Average_##TYPE *tmpAverage; \ 33 33 tmpAverage = gfits_table_get_Average_##TYPE (ftable, Naverage, NULL); \ 34 if (!tmpAverage) { \ 35 fprintf (stderr, "ERROR: failed to read averages\n"); \ 36 exit (2); \ 37 } \ 34 38 average = Average_##TYPE##_ToInternal (tmpAverage, *Naverage, primary); \ 35 39 free (tmpAverage); \ … … 39 43 if (!strcmp (extname, "DVO_AVERAGE")) { 40 44 average = gfits_table_get_Average (ftable, Naverage, NULL); 45 if (!average) { 46 fprintf (stderr, "ERROR: failed to read averages\n"); 47 exit (2); 48 } 41 49 *format = DVO_FORMAT_INTERNAL; 42 50 return (average); … … 111 119 Measure_##TYPE *tmpMeasure; \ 112 120 tmpMeasure = gfits_table_get_Measure_##TYPE (ftable, Nmeasure, NULL); \ 121 if (!tmpMeasure) { \ 122 fprintf (stderr, "ERROR: failed to read measures\n"); \ 123 exit (2); \ 124 } \ 113 125 measure = Measure_##TYPE##_ToInternal (tmpMeasure, *Nmeasure); \ 114 126 free (tmpMeasure); \ … … 118 130 if (!strcmp (extname, "DVO_MEASURE")) { 119 131 measure = gfits_table_get_Measure (ftable, Nmeasure, NULL); 132 if (!measure) { 133 fprintf (stderr, "ERROR: failed to read measures\n"); 134 exit (2); 135 } 120 136 *format = DVO_FORMAT_INTERNAL; 121 137 return (measure); … … 190 206 SecFilt_##TYPE *tmpSecFilt; \ 191 207 tmpSecFilt = gfits_table_get_SecFilt_##TYPE (ftable, Nsecfilt, NULL); \ 208 if (!tmpSecFilt) { \ 209 fprintf (stderr, "ERROR: failed to read secfilts\n"); \ 210 exit (2); \ 211 } \ 192 212 secfilt = SecFilt_##TYPE##_ToInternal (tmpSecFilt, *Nsecfilt); \ 193 213 free (tmpSecFilt); \ … … 197 217 if (!strcmp (extname, "DVO_SECFILT")) { 198 218 secfilt = gfits_table_get_SecFilt (ftable, Nsecfilt, NULL); 219 if (!secfilt) { 220 fprintf (stderr, "ERROR: failed to read secfilts\n"); 221 exit (2); 222 } 199 223 *format = DVO_FORMAT_INTERNAL; 200 224 return (secfilt); … … 263 287 Image_Elixir *tmpimage; 264 288 tmpimage = gfits_table_get_Image_Elixir (ftable, &Nimage, NULL); 289 if (!tmpimage) { 290 fprintf (stderr, "ERROR: failed to read images\n"); 291 exit (2); 292 } 265 293 ftable[0].buffer = (char *) Image_Elixir_ToInternal (tmpimage, Nimage); 266 294 free (tmpimage); … … 284 312 *format = DVO_FORMAT_##FORMAT; \ 285 313 tmpimage = gfits_table_get_Image_##TYPE (ftable, &Nimage, NULL); \ 314 if (!tmpimage) { \ 315 fprintf (stderr, "ERROR: failed to read images\n"); \ 316 exit (2); \ 317 } \ 286 318 ftable[0].buffer = (char *) Image_##TYPE##_ToInternal (tmpimage, Nimage); \ 287 319 free (tmpimage); \ … … 296 328 Image *image; 297 329 image = gfits_table_get_Image (ftable, &Nimage, NULL); 330 if (!image) { 331 fprintf (stderr, "ERROR: failed to read images\n"); 332 exit (2); 333 } 298 334 *format = DVO_FORMAT_INTERNAL; 299 335 return (TRUE); -
trunk/Ohana/src/libdvo/src/skyregion_io.c
r27435 r29001 40 40 ALLOCATE (skytable, SkyTable, 1); 41 41 skytable[0].regions = gfits_table_get_SkyRegion (&ftable, &skytable[0].Nregions, NULL); 42 if (!skytable[0].regions) { 43 fprintf (stderr, "ERROR: failed to read sky regions\n"); 44 exit (2); 45 } 46 42 47 ALLOCATE (skytable[0].filename, char *, skytable[0].Nregions); 43 48 for (i = 0; i < skytable[0].Nregions; i++) {
Note:
See TracChangeset
for help on using the changeset viewer.
