Changeset 32347 for trunk/psModules/src/objects/pmPSF.c
- Timestamp:
- Sep 6, 2011, 1:02:53 PM (15 years ago)
- Location:
- trunk/psModules/src/objects
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects
- Property svn:ignore
-
old new 5 5 *.la 6 6 *.lo 7 pmSourceIO_CMF_PS1_V1.c 8 pmSourceIO_CMF_PS1_V2.c 9 pmSourceIO_CMF_PS1_V3.c
-
- Property svn:ignore
-
trunk/psModules/src/objects/pmPSF.c
r31451 r32347 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.
Note:
See TracChangeset
for help on using the changeset viewer.
