- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/Ohana
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/Ohana merged eligible /branches/eam_branches/Ohana.20100407 27635-27772 /branches/pap_delete/Ohana 27530-27595
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/simtest_nebulous_branches/Ohana/src/addstar/src/ReadImageHeader.c
r24988 r27840 5 5 int ReadImageHeader (Header *header, Image *image, int photcode) { 6 6 7 int Nastro, ccdnum,hour, min, Nx, Ny, haveNx, haveNy, sourceID;7 int Nastro, hour, min, Nx, Ny, haveNx, haveNy, sourceID; 8 8 double tmp, sec, Cerror, ZeroPt, FWHM_X, FWHM_Y; 9 char *c, photname[64], line[80] ;9 char *c, photname[64], line[80], ccdnum[64]; 10 10 PhotCode *photcodeData = NULL; 11 11 … … 85 85 } 86 86 87 { 87 { 88 88 double R, D; 89 89 /* sanity check on the image coordinates */ … … 94 94 } 95 95 } 96 96 97 97 /* CERROR in data file is in arcsec */ 98 98 if (!gfits_scan (header, "CERROR", "%lf", 1, &tmp)) tmp = 1.0; 99 99 image[0].cerror = tmp * 50.0; 100 100 101 101 /* get photcode from header */ 102 102 if (photcode == 0) { … … 112 112 photcode = photcodeData[0].code; 113 113 } 114 if (photcode == 0) { 114 if (photcode == 0) { 115 115 fprintf (stderr, "no valid photcode is supplied\n"); 116 116 return (FALSE); … … 122 122 gfits_scan (header, ExptimeKeyword, "%lf", 1, &tmp); 123 123 image[0].exptime = tmp; 124 124 125 125 /*** why are we no longer using APMIFIT?? ***/ 126 126 tmp = 0; … … 172 172 if (gfits_scan (header, AirmassKeyword, "%lf", 1, &tmp)) { 173 173 image[0].secz = tmp; 174 } 175 176 if (!gfits_scan (header, CCDNumKeyword, "%d", 1, &ccdnum)) { 177 image[0].ccdnum = 0xff; 178 } else { 179 image[0].ccdnum = ccdnum; 174 } 175 176 if (!gfits_scan (header, CCDNumKeyword, "%s", 1, ccdnum)) { 177 fprintf (stderr, "CCDNumKeyword %s not found\n", CCDNumKeyword); 178 return FALSE; 179 } else { 180 // CCDNumKeyword (EXTNAME) is a string yet we need an integer 181 // RULE: ccdnum is the value of the first string of digits in CCDNumKeyword 182 // For example: ccdnum(XY42.hdr) = 42, ccdnum(XY01.hdr) = 1 183 // if no digits occur, then we assume there is only one ccd 184 char *p = ccdnum; 185 // get rid of any leading non-digit characters 186 while (*p && !isdigit(*p)) p++; 187 if (*p) { 188 image[0].ccdnum = atoi(p); 189 } else { 190 image[0].ccdnum = 0; 191 } 180 192 } 181 193 … … 187 199 } else { 188 200 if (sourceID > 0xffff) { 189 fprintf (stderr, "image source ID is surprisingly large: %d, skipping\n", sourceID); 201 fprintf (stderr, "image source ID is surprisingly large: %d, skipping\n", sourceID); 190 202 return (FALSE); 191 203 } … … 196 208 // 0 - 32 so it would fit in an unsigned int. This is also needed because some programs like 197 209 // sextractor will put in an arbitrary zero point that we need to understand to get back to 198 // instrumental mags. 210 // instrumental mags. 199 211 gfits_scan (header, "ZERO_PT", "%lf", 1, &ZeroPt); 200 212 if (ZeroPt != GetZeroPoint()) { 201 fprintf (stderr, "inconsistent zero point values: image: %f, config: %f\n", ZeroPt, GetZeroPoint()); 202 return (FALSE); 203 } 204 205 // if it exists, find the 213 fprintf (stderr, "WARNING: inconsistent zero point values: image: %f, config: %f\n", ZeroPt, GetZeroPoint()); 214 } 215 216 // in this case, lookup and apply the zero point measured for this chip 206 217 if (!strcasecmp(ZERO_POINT_OPTION, "CHIP_HEADER")) { 207 218 float ZPT_OBS; 208 219 if (!photcodeData || !gfits_scan (header, "ZPT_OBS", "%f", 1, &ZPT_OBS)) { 209 fprintf (stderr, "zero point not supplied in header\n");210 ZERO_POINT_OFFSET = 0.0;220 fprintf (stderr, "zero point not supplied in header\n"); 221 ZERO_POINT_OFFSET = 0.0; 211 222 } else { 212 ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZPT_OBS; 213 } 223 ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZPT_OBS; 224 } 225 } 226 227 // in this case, lookup and apply the zero point measured for the exposure 228 if (!strcasecmp(ZERO_POINT_OPTION, "PHU_HEADER")) { 229 if (!photcodeData) { 230 fprintf (stderr, "photcode data not supplied for this chip\n"); 231 ZERO_POINT_OFFSET = 0.0; 232 } else { 233 ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZERO_POINT_OFFSET; 234 } 214 235 } 215 236 … … 221 242 /* find expected number of stars */ 222 243 if (!gfits_scan (header, "NSTARS", "%d", 1, &image[0].nstar) && !NO_STARS) { 223 fprintf (stderr, "can't get NSTARS from header\n"); 224 return (FALSE); 244 fprintf (stderr, "WARNING: can't get NSTARS from header (TEXT mode will be invalid)\n"); 225 245 } 226 246
Note:
See TracChangeset
for help on using the changeset viewer.
