Changeset 40488
- Timestamp:
- Jun 27, 2018, 3:58:54 PM (8 years ago)
- Location:
- trunk/Ohana/src/uniphot/src
- Files:
-
- 4 edited
-
cam_zpt_correction.c (modified) (4 diffs)
-
initialize_setphot.c (modified) (1 diff)
-
match_camcorr_to_images.c (modified) (2 diffs)
-
setphot.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/uniphot/src/cam_zpt_correction.c
r39288 r40488 100 100 char field[256]; 101 101 double value; 102 102 103 103 snprintf (field, 256, "TS_%03d", i); 104 104 if (!gfits_scan (phu, field, "%lf", 1, &value)) return FALSE; 105 105 cam->tstart[i] = ohana_mjd_to_sec(value); 106 106 107 107 snprintf (field, 256, "TE_%03d", i); 108 108 if (!gfits_scan (phu, field, "%lf", 1, &value)) return FALSE; … … 174 174 if (!flat_id) return 0.0; 175 175 176 myAssert (flat_id > 0, "flat_id out of range"); 177 myAssert (flat_id <= cam->Nvalues, "flat_id out of range"); 178 176 // myAssert (flat_id > 0, "flat_id out of range"); 177 // myAssert (flat_id <= cam->Nvalues, "flat_id out of range"); 178 if ((flat_id < 0)||(flat_id > cam->Nvalues)) { return 0.0; } 179 179 180 // validate the flat_id (not out of range?) 180 181 // NOTE: we are setting the ID to be the sequence + 1 (match_camcorr_to_images.c:39) … … 285 286 // table->offset[seq][ix][iy] with dM values for image[seq] 286 287 288 // Set up HSC/GPC1 distinguishing limits 289 290 int minCodeGPC1 = 10000; 291 int maxCodeGPC1 = 10576; 292 293 int minCodeHSC = 20000; 294 int maxCodeHSC = 26111; 295 296 int isGPC1 = FALSE; 297 int isHSC = FALSE; 298 287 299 // loop over the flatcorr images and match from image[seq] to newcorr: 288 300 for (i = 0; i < flatcorr->Nimage; i++) { … … 301 313 int photcode = flatcorr->image[i].photcode; 302 314 315 if ((photcode >= minCodeGPC1)&&(photcode <= maxCodeGPC1)) { 316 isGPC1 = TRUE; 317 isHSC = FALSE; 318 } 319 else if ((photcode >= minCodeHSC)&&(photcode <= maxCodeHSC)) { 320 isGPC1 = FALSE; 321 isHSC = TRUE; 322 } 323 if (!(isGPC1) && !(isHSC)) { continue; } 324 325 int iy, ix, filter; 326 327 303 328 // find the chip and filter from photcode: 304 int iy = photcode % 10; 305 int ix = (int)(photcode / 10) % 10; 306 int filter = (int)(photcode / 100) % 10; 329 if (isGPC1) { 330 iy = photcode % 10; 331 ix = (int)(photcode / 10) % 10; 332 filter = (int)(photcode / 100) % 10; 333 } 334 else if (isHSC) { 335 iy = 0; 336 ix = (int) photcode % 112; 337 filter = (int)(photcode / 1000) % 10; 338 } 307 339 308 340 myAssert (ix < newcorr->Nx, "oops"); -
trunk/Ohana/src/uniphot/src/initialize_setphot.c
r39926 r40488 217 217 218 218 219 if (argc !=2) {219 if (argc > 2) { 220 220 fprintf (stderr, "USAGE: setphot (zptfile) [options]\n"); 221 221 fprintf (stderr, " options:\n"); -
trunk/Ohana/src/uniphot/src/match_camcorr_to_images.c
r39288 r40488 14 14 // season comes from the date/time 15 15 16 int minCode = 10000; 17 int maxCode = 10576; 16 int minCodeGPC1 = 10000; 17 int maxCodeGPC1 = 10576; 18 19 int minCodeHSC = 20000; 20 int maxCodeHSC = 26111; 18 21 19 22 int Nmissed = 0; 23 24 int isGPC1 = FALSE; 25 int isHSC = FALSE; 20 26 21 27 for (i = 0; i < Nimage; i++) { 22 28 if (!image[i].photcode) continue; // skip PHU images 23 29 24 if (image[i].photcode < minCode) continue; // skip non-gpc1-chip images 25 if (image[i].photcode > maxCode) continue; // skip non-gpc1-chip images 30 if ((image[i].photcode >= minCodeGPC1)&&(image[i].photcode <= maxCodeGPC1)) { 31 isGPC1 = TRUE; 32 isHSC = FALSE; 33 } 34 else if ((image[i].photcode >= minCodeHSC)&&(image[i].photcode <= maxCodeHSC)) { 35 isGPC1 = FALSE; 36 isHSC = TRUE; 37 } 26 38 39 if (!(isGPC1) && !(isHSC)) { continue; } 40 27 41 int found = FALSE; 28 42 for (j = 0; !found && (j < camcorr->Nseason); j++) { … … 30 44 if (image[i].tzero > camcorr->tstop[j]) continue; 31 45 46 int seq; 32 47 int photcode = image[i].photcode; 33 int iy = photcode % 10; 34 int ix = (int)(photcode / 10) % 10; 35 int filter = (int)(photcode / 100) % 10; 48 49 if (isGPC1) { 50 int iy = photcode % 10; 51 int ix = (int)(photcode / 10) % 10; 52 int filter = (int)(photcode / 100) % 10; 53 54 seq = ix + iy * camcorr->Nx + filter * camcorr->Nchips + j * camcorr->Nflats; 55 } 56 else if (isHSC) { 57 int filter = (int)(photcode / 1000) % 10; 58 int ix = photcode - 20000 - filter * 1000; 59 60 seq = ix + filter * camcorr->Nchips + j * camcorr->Nflats; 61 } 36 62 37 63 // we add one so photom_map_id = 0 can mean no map 38 int seq = ix + iy * camcorr->Nx + filter * camcorr->Nchips + j * camcorr->Nflats;39 64 image[i].photom_map_id = seq + 1; 40 65 found = TRUE; -
trunk/Ohana/src/uniphot/src/setphot.c
r39288 r40488 21 21 if (db.dbstate == LCK_EMPTY) Shutdown ("ERROR: No images in catalog %s (1)", db.filename); 22 22 23 fprintf (stderr, "this program needs to be fixed to allow a zpt lookup table\n"); 24 exit (3); 25 23 26 if (UBERCAL) { 24 27 zpts = load_zpt_ubercal (argv[1], &Nzpts, &flatcorrTable); … … 37 40 } 38 41 camcorr = merge_flatcorr_and_camcorr (&flatcorrTable, rawcorr); 39 42 40 43 char newflatfile[DVO_MAX_PATH]; 41 44 size = snprintf (newflatfile, DVO_MAX_PATH, "%s/flatfield.fits", CATDIR); … … 43 46 CamPhotomCorrectionSave (camcorr, newflatfile); 44 47 } else { 45 zpts = load_zpt_table (argv[1], &Nzpts);48 // zpts = load_zpt_table (argv[1], &Nzpts); 46 49 } 47 50 48 if (!zpts) Shutdown ("failed to load zero points, or empty table"); 51 if ((CAM_PHOTOM_FILE)&&(!camcorr)) { 52 CamPhotomCorrection *rawcorr = CamPhotomCorrectionLoad(CAM_PHOTOM_FILE); 53 if (!rawcorr) { 54 fprintf (stderr, "failed to load camera-static flat-field correction\n"); 55 exit (2); 56 } 57 camcorr = rawcorr; 58 char newflatfile[DVO_MAX_PATH]; 59 int size = snprintf (newflatfile, DVO_MAX_PATH, "%s/flatfield.fits", CATDIR); 60 assert (size < DVO_MAX_PATH); 61 CamPhotomCorrectionSave (camcorr, newflatfile); 62 63 // zpts = load_zpt_table (argv[1], &Nzpts); 64 } 65 66 67 // if (!zpts) Shutdown ("failed to load zero points, or empty table"); 49 68 50 69 // load images … … 52 71 if (!UPDATE) dvo_image_unlock (&db); 53 72 54 match_zpts_to_images (image, Nimage, zpts, Nzpts);73 // match_zpts_to_images (image, Nimage, zpts, Nzpts); 55 74 56 if (UBERCAL) {75 // if (UBERCAL) { 57 76 // we are going to deprecate the flatcorr imaage lookup 58 77 // match_flatcorr_to_images (image, Nimage, &flatcorrTable); 59 match_camcorr_to_images (image, Nimage, camcorr);60 }78 match_camcorr_to_images (image, Nimage, camcorr); 79 // } 61 80 62 81 if (!IMAGES_ONLY) {
Note:
See TracChangeset
for help on using the changeset viewer.
