Changeset 35768 for trunk/psModules/src/objects/models/pmModel_SERSIC.c
- Timestamp:
- Jul 3, 2013, 2:37:22 PM (13 years ago)
- Location:
- trunk/psModules
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/objects/models/pmModel_SERSIC.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130509/psModules (added) merged: 35594,35613,35628,35638-35639,35643-35648,35653,35657,35662,35750
- Property svn:mergeinfo changed
-
trunk/psModules/src/objects/models/pmModel_SERSIC.c
r35560 r35768 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 … … 250 244 // if q1 < 0.0, f2 ~ f1, we have a very large axis ratio near 45deg.. Saturate at that 251 245 // angle and let f2,f1 fight it out 252 q2 = 0.5*sqrtf(q1); 246 // NOTE: the factor of 2 is needed to convert par[SXX,SYY] to shape.sx,sy 247 q2 = 2.0*0.5*sqrtf(q1); 253 248 } 254 249 … … 347 342 axes.major = Rmajor; 348 343 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; 344 345 pmModelAxesToParams (&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], axes, true); 354 346 355 347 float bn = 1.9992*index - 0.3271; … … 357 349 float Io = exp(0.5*bn); 358 350 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 351 // set the model normalization (adjust for Sersic best guess) 367 352 if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) { … … 381 366 psF64 PM_MODEL_FLUX (const psVector *params) 382 367 { 383 psEllipseShape shape;384 385 368 psF32 *PAR = params->data.F32; 386 369 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); 370 psEllipseAxes axes; 371 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true); 393 372 float AspectRatio = axes.minor / axes.major; 394 373 … … 410 389 psF64 PM_MODEL_RADIUS (const psVector *params, psF64 flux) 411 390 { 412 psEllipseShape shape;413 414 391 psF32 *PAR = params->data.F32; 415 392 … … 421 398 return (1.0); 422 399 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); 400 psEllipseAxes axes; 401 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true); 428 402 429 403 // f = Io exp(-z^n) -> z^n = ln(Io/f) … … 457 431 // the 2D PSF model fits polarization terms (E0,E1,E2) 458 432 // convert to shape terms (SXX,SYY,SXY) 459 if (!pmPSF_FitToModel (out, 0.1)) { 433 bool useReff = pmModelUseReff (modelPSF->type); 434 if (!pmPSF_FitToModel (out, 0.1, useReff)) { 460 435 psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]); 461 436 return false; … … 510 485 // convert to shape terms (SXX,SYY,SXY) 511 486 // XXX user-defined value for limit? 512 if (!pmPSF_FitToModel (PAR, 0.1)) { 487 bool useReff = pmModelUseReff (model->type); 488 if (!pmPSF_FitToModel (PAR, 0.1, useReff)) { 513 489 psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo); 514 490 return false;
Note:
See TracChangeset
for help on using the changeset viewer.
