Changeset 33156
- Timestamp:
- Jan 26, 2012, 5:20:00 AM (14 years ago)
- Location:
- branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src
- Files:
-
- 3 edited
-
load_zpt_table.c (modified) (7 diffs)
-
setphot.c (modified) (1 diff)
-
update_catalog_setphot.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/load_zpt_table.c
r33137 r33156 73 73 int CHIP_DY; 74 74 75 FILE *f;76 77 f = fopen (filename, "r");75 *nzpts = 0; 76 77 FILE *f = fopen (filename, "r"); 78 78 if (!f) { 79 79 fprintf (stderr, "ERROR: cannot open zpt table file %s\n", filename); … … 178 178 ftable.header = &theader; 179 179 for (nfilter = 0; nfilter < NFILTER; nfilter++) { 180 // *** load the ZERO POINT table *** 181 180 182 // load data for this header 181 183 if (!gfits_load_header (f, &theader)) return (NULL); … … 202 204 zpts[i+Nzpts].time = ohana_mjd_to_sec(mjd[i]); 203 205 zpts[i+Nzpts].zpt = zp[i]; 204 // zpts[i+Nzpts].zpt_err = zperr[i]; 206 zpts[i+Nzpts].zpt_err = 0.0; 207 zpts[i+Nzpts].found = FALSE; 205 208 } 206 209 Nzpts += Nrow; 210 211 // *** load the flat-field correction image *** 207 212 208 213 // the image contains the flat-field corrections for a specific filter … … 211 216 if (!gfits_load_header (f, &header)) return (NULL); 212 217 213 if (!gfits_scan (& theader, "FILTER", "%s", 1, filter)) {218 if (!gfits_scan (&header, "FILTER", "%s", 1, filter)) { 214 219 fprintf (stderr, "cannot find FILTER in header of %s\n", filename); 215 220 fclose (f); … … 218 223 219 224 // read the fits table bytes 225 double *offset64 = NULL; 226 float *offset32 = NULL; 227 int use32 = TRUE; 228 220 229 if (!gfits_fread_matrix (f, &matrix, &header)) return (NULL); 221 assert (header.bitpix == -64); // hardwired as a double 222 double *offset = (double *) matrix.buffer; 230 switch (header.bitpix) { 231 case -32: // float 232 offset32 = (float *) matrix.buffer; 233 use32 = TRUE; 234 break; 235 case -64: // double 236 offset64 = (double *) matrix.buffer; 237 use32 = FALSE; 238 break; 239 default: 240 fprintf (stderr, "invalid bitpix for flat-field correction image: %d\n", header.bitpix); 241 exit (2); 242 } 223 243 224 244 for (nseason = 0; nseason < NSEASON; nseason++) { // seasons … … 244 264 for (ixc = 0; ixc < NCELL_X; ixc++) { 245 265 if (ix > 3) { 266 // XXX I think this is backwards : chips ix < 4 should be flipped 246 267 seq = nfilter*NSEASON*NCHIP_X*NCHIP_Y*NCELL_X*NCELL_Y + nseason*NCHIP_X*NCHIP_Y*NCELL_X*NCELL_Y + (iy*NCELL_Y + NCELL_Y - 1 - iyc)*NCHIP_X*NCELL_X + (ix*NCELL_X + NCELL_X - 1 - ixc); 247 268 } else { … … 251 272 flatcorrTable->corr[seq].x = ixc; 252 273 flatcorrTable->corr[seq].y = iyc; 253 flatcorrTable->corr[seq].offset = offset[seq]; 274 if (use32) { 275 flatcorrTable->corr[seq].offset = offset32[seq]; 276 } else { 277 flatcorrTable->corr[seq].offset = offset64[seq]; 278 } 254 279 flatcorrTable->corr[seq].ID = corrID; 255 280 } -
branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/setphot.c
r33133 r33156 34 34 zpts = load_zpt_table (argv[1], &Nzpts); 35 35 } 36 37 if (!zpts) Shutdown ("failed to load zero points, or empty table"); 36 38 37 39 // load images -
branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/update_catalog_setphot.c
r33133 r33156 94 94 } 95 95 96 catalog[0].measure[m].Mcal = Mcal +Mcal_offset;96 catalog[0].measure[m].Mcal = Mcal - Mcal_offset; 97 97 catalog[0].measure[m].dMcal = dMcal; 98 98
Note:
See TracChangeset
for help on using the changeset viewer.
