Changeset 17270
- Timestamp:
- Apr 1, 2008, 3:22:14 PM (18 years ago)
- Location:
- trunk/pstamp/src
- Files:
-
- 3 edited
-
ppstampArguments.c (modified) (4 diffs)
-
ppstampMakeStamp.c (modified) (5 diffs)
-
ppstampParseCamera.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/src/ppstampArguments.c
r16239 r17270 21 21 fprintf(stderr, "\n"); 22 22 fprintf(stderr, "Optional arguments:\n"); 23 fprintf(stderr, " -chip chipName selects chip (only used with -pixcenter)\n"); 23 fprintf(stderr, " [-chip chipName] selects chip (only used with -pixcenter)\n"); 24 fprintf(stderr, " [-astrom astrom.cmp] : provide an alternative astrometry calibration\n"); 24 25 fprintf(stderr, "\n"); 25 26 … … 60 61 } 61 62 62 63 63 if (!gotCenter) { 64 64 psError(PSTAMP_ERR_ARGUMENTS, true, "must specify center of region of interest\n"); … … 77 77 } 78 78 79 pmConfigFileSetsMD(config->arguments, &argc, argv, "ASTROM", "-astrom", "-astromlist"); 80 79 81 // the input file is a required argument; if not found, we will exit 80 82 bool status = pmConfigFileSetsMD (config->arguments, &argc, argv, "INPUT", "-file", "-list"); … … 83 85 usage(); 84 86 } 87 85 88 86 89 // finally the output file -
trunk/pstamp/src/ppstampMakeStamp.c
r17052 r17270 381 381 // is completely contained on a single chip 382 382 383 static ppstampOverlap findROI(ppstampOptions *options, pmFPAview *view, pmFPAfile *input, pmChip *chip, 384 pmAstromObj *center) 383 static ppstampOverlap findROI(ppstampOptions *options, pmFPAview *view, 384 pmFPAfile *input, pmFPAfile *astrom, bool bilevelAstrometry, 385 pmChip *chip, pmAstromObj *center) 385 386 { 386 387 psString chipName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); … … 392 393 393 394 // set up the astrometry 394 pmHDU *hdu = pm HDUFromChip(chip);395 pmHDU *hdu = pmFPAviewThisHDU(view, astrom->fpa); 395 396 PS_ASSERT_PTR_NON_NULL(hdu, 1) 396 397 PS_ASSERT_PTR_NON_NULL(hdu->header, 1) 397 398 398 // for some reason these are getting initialized to garbag 399 input->fpa->fromTPA = 0; 400 input->fpa->toTPA = 0; 401 input->fpa->toSky = 0; 402 chip->toFPA = 0; 403 chip->fromFPA = 0; 404 405 if (!pmAstromReadWCS(input->fpa, chip, hdu->header, 1.0)) { 406 // we can live without WCS if the ROI is specified in pixels 407 408 if (options->roip.celestialCenter || options->roip.celestialRange) { 409 psError(PSTAMP_ERR_DATA, false, "Failed to Read WCS, cannot proceed\n"); 410 psFree(chipBounds); 411 return PSTAMP_ERROR; 399 // we can live without astrometry if the ROI is completely specified in pixel coordinates 400 bool mustHaveAstrometry = false; 401 if (options->roip.celestialCenter || options->roip.celestialRange) { 402 mustHaveAstrometry = true; 403 } 404 if (bilevelAstrometry) { 405 if (!pmAstromReadBilevelChip (chip, hdu->header) && mustHaveAstrometry) { 406 psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel chip astrometry for input FPA."); 407 return false; 408 } 409 } else { 410 // we use a default FPA pixel scale of 1.0 411 if (!pmAstromReadWCS (input->fpa, chip, hdu->header, 1.0) && mustHaveAstrometry) { 412 psError(PS_ERR_UNKNOWN, false, "Unable to read WCS astrometry for input FPA."); 413 return false; 412 414 } 413 415 } … … 478 480 bool returnval = false;; 479 481 bool foundOverlap = false; 480 pmAstromObj *center = pmAstromObjAlloc();481 482 482 483 pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "PPSTAMP.INPUT"); 483 484 if (!status) { 484 psError(PS_ERR_UNKNOWN, true, "Can't find input data!\n"); 485 psFree(center); 485 psError(PS_ERR_UNKNOWN, true, "Can't find input file!\n"); 486 return false; 487 } 488 489 pmFPAfile *astrom = psMetadataLookupPtr(&status, config->files, "PSWARP.ASTROM"); 490 if (!status) { 491 psError(PS_ERR_UNKNOWN, true, "Can't find input astrometry!\n"); 492 return false; 493 } 494 if (!astrom) { 495 astrom = input; 496 } else if (astrom->camera != input->camera) { 497 psError(PS_ERR_UNKNOWN, true, "Input camera and astrometry camera do not match"); 486 498 return false; 487 499 } … … 492 504 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 493 505 psError(PS_ERR_UNKNOWN, false, "Failed to load input."); 494 psFree(center);495 506 psFree (view); 496 507 return false; 497 508 } 509 bool bilevelAstrometry = false; 510 pmHDU *phu = pmFPAviewThisPHU(view, astrom->fpa); 511 if (phu) { 512 char *ctype = psMetadataLookupStr(NULL, phu->header, "CTYPE1"); 513 if (ctype) { 514 bilevelAstrometry = !strcmp (&ctype[4], "-DIS"); 515 } 516 } 517 if (bilevelAstrometry) { 518 if (!pmAstromReadBilevelMosaic(input->fpa, phu->header)) { 519 psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel mosaic astrometry for input FPA."); 520 psFree(view); 521 return false; 522 } 523 } 498 524 499 525 // Loop over the chips and find the one that contains the center 526 pmAstromObj *center = pmAstromObjAlloc(); 500 527 pmChip *chip; 501 528 while ((chip = pmFPAviewNextChip(view, input->fpa, 1)) != NULL) { … … 512 539 } 513 540 514 ppstampOverlap overlap = findROI(options, view, input, chip, center);541 ppstampOverlap overlap = findROI(options, view, input, astrom, bilevelAstrometry, chip, center); 515 542 516 543 switch (overlap) { -
trunk/pstamp/src/ppstampParseCamera.c
r16593 r17270 34 34 } 35 35 36 // XXX: create a filerule for PPSTAMP.ASTROM 37 pmFPAfile *astrom = pmFPAfileDefineFromArgs(&status, config, "PSWARP.ASTROM", "ASTROM"); 38 if (!status) { 39 psError(PS_ERR_UNKNOWN, false, "failed to find astrom definitiion"); 40 return NULL; 41 } 42 if (astrom) { 43 psLogMsg ("ppstamp", 3, "using supplied astrometry\n"); 44 } else { 45 psLogMsg ("ppstamp", 3, "using header astrometry\n"); 46 } 47 36 48 #ifdef notyet 37 49 // add recipe options supplied on command line … … 55 67 } 56 68 57 // TODO: only do the workaround if the file level is chip, skycells should be fine69 // XXX: TODO: only do the workaround if the file level is chip, skycells should be fine 58 70 if (!strcmp(config->cameraName, "MEGACAM")) { 59 71 // workaround bug 986 and related
Note:
See TracChangeset
for help on using the changeset viewer.
