Changeset 13898 for trunk/psModules/src/objects/pmPSF.c
- Timestamp:
- Jun 19, 2007, 4:22:26 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmPSF.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmPSF.c
r13803 r13898 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-06- 13 23:41:51$8 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-06-20 02:22:26 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 81 81 /***************************************************************************** 82 82 pmPSFAlloc (type): allocate a pmPSF. 83 83 84 84 NOTE: PSF model parameters which are not modeled on an image are set to NULL in psf->params. 85 85 86 86 These are normally: 87 87 88 88 X-center 89 89 Y-center … … 180 180 // set model parameters for this source based on PSF information 181 181 if (!modelFromPSFFunc (modelPSF, modelEXT, psf)) { 182 psError(PM_ERR_PSF, false, "Failed to set model params from PSF");183 psFree(modelPSF);184 return NULL;182 psError(PM_ERR_PSF, false, "Failed to set model params from PSF"); 183 psFree(modelPSF); 184 return NULL; 185 185 } 186 186 // XXX note that model->residuals is just a reference … … 245 245 // New Concept: the PSF modelling function fits the polarization terms e0, e1, e2: 246 246 247 // convert the parameters used in the fitted source model 247 // convert the parameters used in the fitted source model 248 248 // to the parameters used in the 2D PSF model 249 249 bool pmPSF_FitToModel (psF32 *fittedPar, float minMinorAxis) … … 257 257 psEllipseAxes axes; 258 258 if (psEllipsePolToAxes (pol, minMinorAxis, &axes) != PS_ERR_NONE) { 259 psError(PM_ERR_PSF, false, "Failed to convert e[012] (%g,%g,%g) to axes",260 pol.e0, pol.e1, pol.e2);261 return false;259 psError(PM_ERR_PSF, false, "Failed to convert e[012] (%g,%g,%g) to axes", 260 pol.e0, pol.e1, pol.e2); 261 return false; 262 262 } 263 263 psEllipseShape shape = psEllipseAxesToShape (axes); … … 279 279 shape.sy = modelPar[PM_PAR_SYY] / M_SQRT2; 280 280 shape.sxy = modelPar[PM_PAR_SXY]; 281 281 282 282 psEllipsePol pol = psEllipseShapeToPol (shape); 283 283 284 284 return pol; 285 285 } … … 297 297 298 298 if ((shape.sx == 0) || (shape.sy == 0)) { 299 axes.major = 0.0;300 axes.minor = 0.0;301 axes.theta = 0.0;299 axes.major = 0.0; 300 axes.minor = 0.0; 301 axes.theta = 0.0; 302 302 } else { 303 // XXX this is not really consistent with the model fit range above304 axes = psEllipseShapeToAxes (shape, maxAR);305 } 306 303 // XXX this is not really consistent with the model fit range above 304 axes = psEllipseShapeToAxes (shape, maxAR); 305 } 306 307 307 return axes; 308 308 } … … 313 313 { 314 314 if ((axes.major <= 0) || (axes.minor <= 0)) { 315 modelPar[PM_PAR_SXX] = 0.0;316 modelPar[PM_PAR_SYY] = 0.0;317 modelPar[PM_PAR_SXY] = 0.0;318 return true;319 } 320 315 modelPar[PM_PAR_SXX] = 0.0; 316 modelPar[PM_PAR_SYY] = 0.0; 317 modelPar[PM_PAR_SXY] = 0.0; 318 return true; 319 } 320 321 321 psEllipseShape shape = psEllipseAxesToShape (axes); 322 322 … … 478 478 479 479 // we generate the growth curve for the center of the image with the specified psf model 480 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore )480 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore, psMaskType maskVal, psMaskType mark) 481 481 { 482 482 … … 526 526 // no need to mask the source here 527 527 // XXX should we measure this for the analytical model only or the full model? 528 pmModelAdd (image, NULL, model, PM_MODEL_OP_FULL );528 pmModelAdd (image, NULL, model, PM_MODEL_OP_FULL, maskVal); 529 529 530 530 // loop over a range of source fluxes 531 531 // no need to interpolate since we have forced the object center 532 532 // to 0.5, 0.5 above 533 bool completeGrowthCurve = true; // do we have a complete curve of growth?533 bool completeGrowthCurve = true; // do we have a complete curve of growth? 534 534 for (int i = 0; i < psf->growth->radius->n; i++) { 535 535 … … 537 537 538 538 // mask the given aperture and measure the apMag 539 psImageKeepCircle (mask, xc, yc, radius, "OR", PM_MASK_MARK);540 if (!pmSourcePhotometryAper (&apMag, model, image, mask )) {541 psError(PM_ERR_PHOTOM, false, "Measuring apMag for radius == %g", radius);542 completeGrowthCurve = false;543 break;544 }545 546 // XXX since we re-mask on each pass, this could be dropped.547 psImageKeepCircle (mask, xc, yc, radius, "AND", PS_NOT_U8( PM_MASK_MARK));539 psImageKeepCircle (mask, xc, yc, radius, "OR", mark); 540 if (!pmSourcePhotometryAper (&apMag, model, image, mask, maskVal)) { 541 psError(PM_ERR_PHOTOM, false, "Measuring apMag for radius == %g", radius); 542 completeGrowthCurve = false; 543 break; 544 } 545 546 // XXX since we re-mask on each pass, this could be dropped. 547 psImageKeepCircle (mask, xc, yc, radius, "AND", PS_NOT_U8(mark)); 548 548 549 549 // the 'ignore' mode is for testing … … 556 556 557 557 if (completeGrowthCurve) { 558 psf->growth->apRef = psVectorInterpolate (psf->growth->radius, psf->growth->apMag, psf->growth->refRadius);559 psf->growth->apLoss = psf->growth->fitMag - psf->growth->apRef;558 psf->growth->apRef = psVectorInterpolate (psf->growth->radius, psf->growth->apMag, psf->growth->refRadius); 559 psf->growth->apLoss = psf->growth->fitMag - psf->growth->apRef; 560 560 } else { 561 psf->growth->apRef = NAN;562 psf->growth->apLoss = 0;561 psf->growth->apRef = NAN; 562 psf->growth->apLoss = 0; 563 563 } 564 564
Note:
See TracChangeset
for help on using the changeset viewer.
