Changeset 25754 for trunk/psModules/src/objects/models/pmModel_GAUSS.c
- Timestamp:
- Oct 2, 2009, 3:11:32 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/models/pmModel_GAUSS.c
r25738 r25754 1 1 /****************************************************************************** 2 2 * this file defines the GAUSS source shape model. Note that these model functions are loaded 3 * by pmModel Group.c using 'include', and thus need no 'include' statements of their own. The3 * by pmModelClass.c using 'include', and thus need no 'include' statements of their own. The 4 4 * models use a psVector to represent the set of parameters, with the sequence used to specify 5 5 * the meaning of the parameter. The meaning of the parameters may thus vary depending on the 6 * specifics of the model. All models which are used a PSF representations share a few6 * specifics of the model. All models which are used as a PSF representations share a few 7 7 * parameters, for which # define names are listed in pmModel.h: 8 8 … … 54 54 55 55 // the model is a function of the pixel coordinate (pixcoord[0,1] = x,y) 56 // 0.5 PIX: the parameters are defined in terms of pixel coords, so the incoming pixcoords 57 // values need to be pixel coords 56 58 psF32 PM_MODEL_FUNC(psVector *deriv, 57 59 const psVector *params, … … 163 165 164 166 // make an initial guess for parameters 167 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 165 168 bool PM_MODEL_GUESS (pmModel *model, pmSource *source) 166 169 { … … 178 181 psEllipseShape shape = psEllipseAxesToShape (axes); 179 182 180 PAR[PM_PAR_SKY] = moments->Sky;183 PAR[PM_PAR_SKY] = 0.0; 181 184 PAR[PM_PAR_I0] = peak->flux; 182 185 PAR[PM_PAR_XPOS] = peak->xf; … … 230 233 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 231 234 psF64 radius = axes.major * sqrt (2.0 * log(PAR[PM_PAR_I0] / flux)); 235 psAssert (isfinite(radius), "fix this code: radius should not be nan for %f", PAR[PM_PAR_I0]); 236 232 237 return (radius); 233 238 } … … 340 345 bool PM_MODEL_FIT_STATUS (pmModel *model) 341 346 { 342 psF32 dP;343 347 bool status; 344 348 … … 346 350 psF32 *dPAR = model->dparams->data.F32; 347 351 348 dP = 0;349 dP += PS_SQR(dPAR[PM_PAR_SXX] / PAR[PM_PAR_SXX]);350 dP += PS_SQR(dPAR[PM_PAR_SYY] / PAR[PM_PAR_SYY]);351 dP = sqrt (dP);352 353 352 status = true; 354 status &= (dP < 0.5);355 353 status &= (PAR[PM_PAR_I0] > 0); 356 354 status &= ((dPAR[PM_PAR_I0]/PAR[PM_PAR_I0]) < 0.5); 357 355 358 if (status) 359 return true; 360 return false; 356 return status; 361 357 } 362 358
Note:
See TracChangeset
for help on using the changeset viewer.
