Changeset 20035
- Timestamp:
- Oct 9, 2008, 3:04:50 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotChoosePSF.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotChoosePSF.c
r20002 r20035 441 441 bool psphotPSFstats (pmReadout *readout, psMetadata *recipe, pmPSF *psf) { 442 442 443 double FWHM_X, FWHM_Y; 444 443 445 psEllipseShape shape; 444 446 psEllipseAxes axes; … … 451 453 PS_ASSERT_PTR_NON_NULL(image, false); 452 454 453 // construct a normalized PSF model at this coordinate (Io = 1.0) 454 pmModel *modelPSF = pmModelFromPSFforXY (psf, 0.5*image->numCols, 0.5*image->numRows, 1.0); 455 if (modelPSF == NULL) { 456 psError(PSPHOT_ERR_PSF, false, "Failed to estimate PSF model at image centre"); 457 return false; 458 } 459 455 // XXXX A Serious hack: the psf might not be determined in the field center. 456 // for the moment, just try a few locations until it is defined! 457 458 pmModel *modelPSF = NULL; 459 for (int ix = -1; ix <= +1; ix ++) { 460 for (int iy = -1; iy <= +1; iy ++) { 461 462 // use the center of the center pixel of the image 463 float xc = (0.5 + 0.3*ix)*image->numCols + image->col0 + 0.5; 464 float yc = (0.5 + 0.3*ix)*image->numRows + image->row0 + 0.5; 465 466 // create modelPSF from this model 467 modelPSF = pmModelFromPSFforXY (psf, xc, yc, 1.0); 468 if (modelPSF) goto got_model; 469 } 470 } 471 psAssert (modelPSF, "Failed to estimate PSF model at image center (psf is invalid everywhere?)"); 472 473 got_model: 460 474 // get the model full-width at half-max 461 doubleFWHM_X = 2*modelPSF->modelRadius (modelPSF->params, 0.5);475 FWHM_X = 2*modelPSF->modelRadius (modelPSF->params, 0.5); 462 476 463 477 // XXX make sure this is consistent with the re-definition of PM_PAR_SXX … … 467 481 axes = psEllipseShapeToAxes (shape, 20.0); 468 482 469 doubleFWHM_Y = FWHM_X * (axes.minor / axes.major);483 FWHM_Y = FWHM_X * (axes.minor / axes.major); 470 484 471 485 psMetadataAddF32 (recipe, PS_LIST_TAIL, "FWHM_X", PS_META_REPLACE, "PSF FWHM Major axis", FWHM_X);
Note:
See TracChangeset
for help on using the changeset viewer.
