Changeset 35644 for branches/eam_branches/ipp-20130509/psModules/src/objects/models/pmModel_SERSIC.c
- Timestamp:
- Jun 11, 2013, 9:15:36 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130509/psModules/src/objects/models/pmModel_SERSIC.c
r35560 r35644 125 125 126 126 // first, use Rmajor and index to find the central pixel flux (fraction of total flux) 127 psEllipseShape shape; 128 129 shape.sx = PAR[PM_PAR_SXX]; 130 shape.sy = PAR[PM_PAR_SYY]; 131 shape.sxy = PAR[PM_PAR_SXY]; 132 133 // for a non-circular Sersic, the flux of the Rmajor equivalent is scaled by the AspectRatio 134 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 127 psEllipseAxes axes; 128 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true); 135 129 136 130 // get the central pixel flux from the lookup table … … 347 341 axes.major = Rmajor; 348 342 axes.minor = Rminor; 349 psEllipseShape shape = psEllipseAxesToShape (axes); 350 351 if (!isfinite(shape.sx)) return false; 352 if (!isfinite(shape.sy)) return false; 353 if (!isfinite(shape.sxy)) return false; 343 344 pmModelAxesToParams (&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], axes, true); 354 345 355 346 float bn = 1.9992*index - 0.3271; … … 357 348 float Io = exp(0.5*bn); 358 349 359 float Sxx = PS_MAX(0.5, shape.sx);360 float Syy = PS_MAX(0.5, shape.sy);361 362 PAR[PM_PAR_SXX] = Sxx;363 PAR[PM_PAR_SYY] = Syy;364 PAR[PM_PAR_SXY] = shape.sxy;365 366 350 // set the model normalization (adjust for Sersic best guess) 367 351 if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) { … … 381 365 psF64 PM_MODEL_FLUX (const psVector *params) 382 366 { 383 psEllipseShape shape;384 385 367 psF32 *PAR = params->data.F32; 386 368 387 shape.sx = PAR[PM_PAR_SXX]; 388 shape.sy = PAR[PM_PAR_SYY]; 389 shape.sxy = PAR[PM_PAR_SXY]; 390 391 // for a non-circular Sersic, the flux of the Rmajor equivalent is scaled by the AspectRatio 392 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 369 psEllipseAxes axes; 370 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true); 393 371 float AspectRatio = axes.minor / axes.major; 394 372 … … 410 388 psF64 PM_MODEL_RADIUS (const psVector *params, psF64 flux) 411 389 { 412 psEllipseShape shape;413 414 390 psF32 *PAR = params->data.F32; 415 391 … … 421 397 return (1.0); 422 398 423 shape.sx = PAR[PM_PAR_SXX]; 424 shape.sy = PAR[PM_PAR_SYY]; 425 shape.sxy = PAR[PM_PAR_SXY]; 426 427 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 399 psEllipseAxes axes; 400 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true); 428 401 429 402 // f = Io exp(-z^n) -> z^n = ln(Io/f) … … 457 430 // the 2D PSF model fits polarization terms (E0,E1,E2) 458 431 // convert to shape terms (SXX,SYY,SXY) 459 if (!pmPSF_FitToModel (out, 0.1)) { 432 bool useReff = pmModelUseReff (modelPSF->type); 433 if (!pmPSF_FitToModel (out, 0.1, useReff)) { 460 434 psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]); 461 435 return false; … … 510 484 // convert to shape terms (SXX,SYY,SXY) 511 485 // XXX user-defined value for limit? 512 if (!pmPSF_FitToModel (PAR, 0.1)) { 486 bool useReff = pmModelUseReff (model->type); 487 if (!pmPSF_FitToModel (PAR, 0.1, useReff)) { 513 488 psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo); 514 489 return false;
Note:
See TracChangeset
for help on using the changeset viewer.
