Changeset 28721
- Timestamp:
- Jul 27, 2010, 3:14:39 PM (16 years ago)
- Location:
- branches/eam_branches/ipp-20100621/Ohana/src/libdvo
- Files:
-
- 8 edited
-
include/dvo.h (modified) (1 diff)
-
src/LoadPhotcodesFITS.c (modified) (8 diffs)
-
src/cmf-ps1-v1-alt.c (modified) (1 diff)
-
src/coordops.c (modified) (6 diffs)
-
src/dvo_catalog_mef.c (modified) (1 diff)
-
src/dvo_catalog_split.c (modified) (2 diffs)
-
src/dvo_convert.c (modified) (9 diffs)
-
src/skyregion_io.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100621/Ohana/src/libdvo/include/dvo.h
r27817 r28721 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 -
branches/eam_branches/ipp-20100621/Ohana/src/libdvo/src/LoadPhotcodesFITS.c
r27580 r28721 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); -
branches/eam_branches/ipp-20100621/Ohana/src/libdvo/src/cmf-ps1-v1-alt.c
r28241 r28721 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 -
branches/eam_branches/ipp-20100621/Ohana/src/libdvo/src/coordops.c
r28674 r28721 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 **/ … … 44 49 } 45 50 51 if (mode == PROJ_MODE_CARTESIAN) { 52 *L += coords[0].crval1; 53 *M += coords[0].crval2; 54 } 55 46 56 return (TRUE); 47 57 } … … 63 73 /** Locally Cartesian Projections **/ 64 74 if (mode == PROJ_MODE_CARTESIAN) { 65 *ra = L + coords[0].crval1;66 *dec = M + coords[0].crval2;67 68 75 /* mosaic astrometry : WRP is chip astrometry; apply mosaic (DIS) term */ 69 76 if (proj == PROJ_WRP) { … … 182 189 183 190 double phi, theta; 184 double Lo, Mo;185 191 double sphi, cphi, stht, ctht; 186 192 double salp, calp, sdel, cdel, sdp, cdp; … … 200 206 if (proj == PROJ_WRP) { 201 207 if (!gotMosaic) return (FALSE); 202 RD_to_XY (&Lo, &Mo, ra, dec, &mosaic); 203 *L = (Lo - coords[0].crval1); 204 *M = (Mo - coords[0].crval2); 208 RD_to_XY (L, M, ra, dec, &mosaic); 205 209 return (TRUE); 206 210 } 207 *L = (ra - coords[0].crval1);208 *M = (dec - coords[0].crval2);211 *L = ra; 212 *M = dec; 209 213 return (TRUE); 210 214 } … … 309 313 double dX, dY, Lo, Mo, dL, dM; 310 314 double dLdX, dLdY, dMdX, dMdY, Do; 315 OhanaProjection proj; 316 OhanaProjectionMode mode; 317 318 proj = GetProjection (coords[0].ctype); 319 mode = GetProjectionMode (proj); 311 320 312 321 *x = 0; 313 322 *y = 0; 323 324 if (mode == PROJ_MODE_CARTESIAN) { 325 L -= coords[0].crval1; 326 M -= coords[0].crval2; 327 } 314 328 315 329 /* start with linear solution for X,Y */ -
branches/eam_branches/ipp-20100621/Ohana/src/libdvo/src/dvo_catalog_mef.c
r28241 r28721 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); -
branches/eam_branches/ipp-20100621/Ohana/src/libdvo/src/dvo_catalog_split.c
r28241 r28721 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); -
branches/eam_branches/ipp-20100621/Ohana/src/libdvo/src/dvo_convert.c
r28241 r28721 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); -
branches/eam_branches/ipp-20100621/Ohana/src/libdvo/src/skyregion_io.c
r27435 r28721 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.
