- Timestamp:
- Aug 21, 2011, 10:21:07 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110710/psModules/src/objects
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110710/psModules/src/objects/pmPSF.c
r31451 r32151 281 281 // convert the parameters used in the fitted source model 282 282 // to the parameters used in the 2D PSF model 283 // XXX this function may be invalid for SERSIC, DEV, EXP models (SQRT2 not used?) 283 284 bool pmPSF_FitToModel (psF32 *fittedPar, float minMinorAxis) 284 285 { … … 307 308 // convert the PSF parameters used in the 2D PSF model fit into the 308 309 // parameters used in the source model 310 // XXX this function may be invalid for SERSIC, DEV, EXP models (SQRT2 not used?) 309 311 psEllipsePol pmPSF_ModelToFit (psF32 *modelPar) 310 312 { … … 329 331 // convert the parameters used in the fitted source model to the psEllipseAxes representation 330 332 // (major,minor,theta) 331 psEllipseAxes pmPSF_ModelToAxes (psF32 *modelPar, double maxAR )333 psEllipseAxes pmPSF_ModelToAxes (psF32 *modelPar, double maxAR, pmModelType type) 332 334 { 333 335 psEllipseShape shape; … … 336 338 axes.minor = NAN; 337 339 axes.theta = NAN; 338 // XXX: must assert non-NULL input parameter340 // XXX: must assert non-NULL input parameter 339 341 PS_ASSERT_PTR_NON_NULL(modelPar, axes); 340 342 341 shape.sx = modelPar[PM_PAR_SXX] / M_SQRT2; 342 shape.sy = modelPar[PM_PAR_SYY] / M_SQRT2; 343 shape.sxy = modelPar[PM_PAR_SXY]; 343 bool useReff = true; 344 useReff |= (type == pmModelClassGetType ("PS_MODEL_SERSIC")); 345 useReff |= (type == pmModelClassGetType ("PS_MODEL_DEV")); 346 useReff |= (type == pmModelClassGetType ("PS_MODEL_EXP")); 347 348 if (useReff) { 349 shape.sx = modelPar[PM_PAR_SXX]; 350 shape.sy = modelPar[PM_PAR_SYY]; 351 shape.sxy = modelPar[PM_PAR_SXY]; 352 } else { 353 shape.sx = modelPar[PM_PAR_SXX] / M_SQRT2; 354 shape.sy = modelPar[PM_PAR_SYY] / M_SQRT2; 355 shape.sxy = modelPar[PM_PAR_SXY]; 356 } 344 357 345 358 if ((shape.sx == 0) || (shape.sy == 0)) { … … 357 370 // convert the psEllipseAxes representation (major,minor,theta) to the parameters used in the 358 371 // fitted source model 359 bool pmPSF_AxesToModel (psF32 *modelPar, psEllipseAxes axes )372 bool pmPSF_AxesToModel (psF32 *modelPar, psEllipseAxes axes, pmModelType type) 360 373 { 361 374 PS_ASSERT_PTR_NON_NULL(modelPar, false); … … 370 383 psEllipseShape shape = psEllipseAxesToShape (axes); 371 384 372 modelPar[PM_PAR_SXX] = shape.sx * M_SQRT2; 373 modelPar[PM_PAR_SYY] = shape.sy * M_SQRT2; 374 modelPar[PM_PAR_SXY] = shape.sxy; 375 385 bool useReff = true; 386 useReff |= pmModelClassGetType ("PS_MODEL_SERSIC"); 387 useReff |= pmModelClassGetType ("PS_MODEL_DEV"); 388 useReff |= pmModelClassGetType ("PS_MODEL_EXP"); 389 390 if (useReff) { 391 modelPar[PM_PAR_SXX] = shape.sx; 392 modelPar[PM_PAR_SYY] = shape.sy; 393 modelPar[PM_PAR_SXY] = shape.sxy; 394 } else { 395 modelPar[PM_PAR_SXX] = shape.sx * M_SQRT2; 396 modelPar[PM_PAR_SYY] = shape.sy * M_SQRT2; 397 modelPar[PM_PAR_SXY] = shape.sxy; 398 } 376 399 return true; 377 400 } … … 438 461 # if (0) 439 462 psF32 *params = model->params->data.F32; // Model parameters 440 psEllipseAxes axes = pmPSF_ModelToAxes(params, MAX_AXIS_RATIO ); // Ellipse axes463 psEllipseAxes axes = pmPSF_ModelToAxes(params, MAX_AXIS_RATIO, model->type); // Ellipse axes 441 464 442 465 // Curiously, the minor axis can be larger than the major axis, so need to check. -
branches/eam_branches/ipp-20110710/psModules/src/objects/pmPSF.h
r31451 r32151 106 106 pmPSF *pmPSFBuildSimple (char *typeName, float sxx, float syy, float sxy, ...); 107 107 108 bool pmPSF_AxesToModel (psF32 *modelPar, psEllipseAxes axes );108 bool pmPSF_AxesToModel (psF32 *modelPar, psEllipseAxes axes, pmModelType type); 109 109 bool pmPSF_FitToModel (psF32 *fittedPar, float minMinorAxis); 110 110 111 111 psEllipsePol pmPSF_ModelToFit (psF32 *modelPar); 112 psEllipseAxes pmPSF_ModelToAxes (psF32 *modelPar, double maxAR );112 psEllipseAxes pmPSF_ModelToAxes (psF32 *modelPar, double maxAR, pmModelType type); 113 113 114 114 /// Calculate FWHM value from a PSF -
branches/eam_branches/ipp-20110710/psModules/src/objects/pmSourceIO_CMF_PS1_DV2.c
r31451 r32151 281 281 dPAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source->psfMagErr : NAN; 282 282 283 pmPSF_AxesToModel (PAR, axes );283 pmPSF_AxesToModel (PAR, axes, modelType); 284 284 285 285 float peakMag = psMetadataLookupF32 (&status, row, "PEAK_FLUX_AS_MAG"); … … 572 572 yErr = dPAR[PM_PAR_YPOS]; 573 573 574 axes = pmPSF_ModelToAxes (PAR, 20.0 );574 axes = pmPSF_ModelToAxes (PAR, 20.0, model->type); 575 575 576 576 row = psMetadataAlloc ();
Note:
See TracChangeset
for help on using the changeset viewer.
