Changeset 35768 for trunk/psModules/src/objects/models/pmModel_QGAUSS.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_QGAUSS.c (modified) (12 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_QGAUSS.c
r35560 r35768 1 1 /****************************************************************************** 2 * this file defines the QGAUSS source shape model (XXX need a better name!). Note that these 3 * model functions are loaded by pmModelClass.c using 'include', and thus need no 'include' 4 * statements of their own. The models use a psVector to represent the set of parameters, with 5 * the sequence used to specify the meaning of the parameter. The meaning of the parameters 6 * may thus vary depending on the specifics of the model. All models which are used a PSF 7 * representations share a few parameters, for which # define names are listed in pmModel.h: 2 * this file defines the QGAUSS source shape model. Note that these model functions are 3 * loaded by pmModelClass.c using 'include', and thus need no 'include' statements of 4 * their own. The models use a psVector to represent the set of parameters, with the 5 * sequence used to specify the meaning of the parameter. The meaning of the parameters 6 * may thus vary depending on the specifics of the model. All models which are used as a 7 * PSF representations share a few parameters, for which # define names are listed in 8 * pmModel.h: 8 9 9 10 power-law with fitted linear term … … 14 15 * PM_PAR_XPOS 2 - X center of object 15 16 * PM_PAR_YPOS 3 - Y center of object 16 * PM_PAR_SXX 4 - X^2 term of elliptical contour ( sqrt(2) / SigmaX)17 * PM_PAR_SYY 5 - Y^2 term of elliptical contour ( sqrt(2) / SigmaY)17 * PM_PAR_SXX 4 - X^2 term of elliptical contour (SigmaX / sqrt(2)) 18 * PM_PAR_SYY 5 - Y^2 term of elliptical contour (SigmaY / sqrt(2)) 18 19 * PM_PAR_SXY 6 - X*Y term of elliptical contour 19 20 * PM_PAR_7 7 - amplitude of the linear component (k) … … 138 139 # define AR_MAX 20.0 139 140 # define AR_RATIO 0.99 140 141 141 bool PM_MODEL_LIMITS (psMinConstraintMode mode, int nParam, float *params, float *beta) 142 142 { … … 149 149 float q2 = NAN; 150 150 if (nParam == PM_PAR_SXY) { 151 float f1 = 1.0 / PS_SQR(params[PM_PAR_SYY]) + 1.0 / PS_SQR(params[PM_PAR_SXX]); 152 float f2 = 1.0 / PS_SQR(params[PM_PAR_SYY]) - 1.0 / PS_SQR(params[PM_PAR_SXX]); 151 // NOTE: the factor of 2 is needed to convert par[SXX,SYY] to shape.sx,sy 152 float f1 = 2.0 / PS_SQR(params[PM_PAR_SYY]) + 2.0 / PS_SQR(params[PM_PAR_SXX]); 153 float f2 = 2.0 / PS_SQR(params[PM_PAR_SYY]) - 2.0 / PS_SQR(params[PM_PAR_SXX]); 153 154 float q1 = PS_SQR(f1)*AR_RATIO - PS_SQR(f2); 154 155 q1 = (q1 < 0.0) ? 0.0 : q1; … … 203 204 return true; 204 205 } 205 default:206 default: 206 207 psAbort("invalid choice for limits"); 207 208 } … … 221 222 222 223 // set the shape parameters 223 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments )) {224 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments, false)) { 224 225 return false; 225 226 } … … 245 246 { 246 247 float z, norm; 247 psEllipseShape shape;248 248 249 249 psF32 *PAR = params->data.F32; 250 250 251 shape.sx = PAR[PM_PAR_SXX] / M_SQRT2; 252 shape.sy = PAR[PM_PAR_SYY] / M_SQRT2; 253 shape.sxy = PAR[PM_PAR_SXY]; 254 255 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 251 psEllipseAxes axes; 252 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false); 256 253 float AspectRatio = axes.minor / axes.major; 257 254 … … 285 282 { 286 283 psF64 z; 287 psEllipseShape shape;288 284 289 285 psF32 *PAR = params->data.F32; … … 293 289 if (flux >= PAR[PM_PAR_I0]) return 1.0; 294 290 295 // if (PAR[PM_PAR_7] == 0.0) return powf(PAR[PM_PAR_I0] / flux - 1.0, 1.0 / ALPHA); 296 297 shape.sx = PAR[PM_PAR_SXX] / M_SQRT2; 298 shape.sy = PAR[PM_PAR_SYY] / M_SQRT2; 299 shape.sxy = PAR[PM_PAR_SXY]; 300 301 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 291 psEllipseAxes axes; 292 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false); 302 293 psF64 sigma = axes.major; 303 294 … … 307 298 return ( sigma * sqrt (2.0 * z) ); 308 299 } 309 310 300 psF64 limit = flux / PAR[PM_PAR_I0]; 311 301 … … 367 357 // the 2D PSF model fits polarization terms (E0,E1,E2) 368 358 // convert to shape terms (SXX,SYY,SXY) 369 if (!pmPSF_FitToModel (out, 0.1)) { 359 bool useReff = pmModelUseReff (modelPSF->type); 360 if (!pmPSF_FitToModel (out, 0.1, useReff)) { 370 361 psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]); 371 362 return false; … … 424 415 // the 2D PSF model fits polarization terms (E0,E1,E2) 425 416 // convert to shape terms (SXX,SYY,SXY) 426 // XXX user-defined value for limit?427 if (!pmPSF_FitToModel (PAR, 0.1 )) {417 bool useReff = pmModelUseReff (model->type); 418 if (!pmPSF_FitToModel (PAR, 0.1, useReff)) { 428 419 psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo); 429 420 return false;
Note:
See TracChangeset
for help on using the changeset viewer.
