Changeset 25754 for trunk/psModules/src/objects/models/pmModel_PS1_V1.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_PS1_V1.c
r25738 r25754 1 1 /****************************************************************************** 2 * this file defines the PS1_V1 source shape model (XXX need a better name!). Note that these3 * model functions are loaded by pmModelGroup.c using 'include', and thus need no 'include'4 * statements of their own. The models use a psVector to represent the set of parameters, with5 * the sequence used to specify the meaning of the parameter. The meaning of the parameters6 * may thus vary depending on the specifics of the model. All models which are used a PSF7 * representations share a fewparameters, for which # define names are listed in pmModel.h:2 * this file defines the PS1_V1 source shape model. Note that these model functions are loaded 3 * by pmModelClass.c using 'include', and thus need no 'include' statements of their own. The 4 * models use a psVector to represent the set of parameters, with the sequence used to specify 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 as a PSF representations share a few 7 * parameters, for which # define names are listed in pmModel.h: 8 8 9 9 power-law with fitted linear term … … 42 42 # define ALPHA_M 0.666 43 43 44 // the model is a function of the pixel coordinate (pixcoord[0,1] = x,y) 45 // 0.5 PIX: the parameters are defined in terms of pixel coords, so the incoming pixcoords 46 // values need to be pixel coords 47 44 48 // Lax parameter limits 45 49 static float paramsMinLax[] = { -1.0e3, 1.0e-2, -100, -100, 0.5, 0.5, -1.0, -1.0 }; … … 57 61 58 62 static bool limitsApply = true; // Apply limits? 59 60 63 61 64 psF32 PM_MODEL_FUNC (psVector *deriv, … … 182 185 183 186 // make an initial guess for parameters 187 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 184 188 bool PM_MODEL_GUESS (pmModel *model, pmSource *source) 185 189 { … … 206 210 if (!isfinite(shape.sxy)) return false; 207 211 208 // XXX turn this off here for now PAR[PM_PAR_SKY] = moments->Sky;209 212 PAR[PM_PAR_SKY] = 0.0; 210 213 PAR[PM_PAR_I0] = peak->flux; … … 292 295 293 296 // choose a z value guaranteed to be beyond our limit 294 float z0 = pow((1.0 / limit), (1.0 / ALPHA));295 float z1 = (1.0 / limit) / PAR[PM_PAR_7];296 z1 = PS_MAX (z0, z1);297 z0 = 0.0;297 float z0 = 0.0; 298 float z1 = pow((1.0 / limit), (1.0 / ALPHA)); 299 psAssert (isfinite(z1), "fix this code: z1 should not be nan for %f", PAR[PM_PAR_7]); 300 if (PAR[PM_PAR_7] < 0.0) z1 *= 2.0; 298 301 299 302 // perform a type of bisection to find the value … … 420 423 bool PM_MODEL_FIT_STATUS (pmModel *model) 421 424 { 422 423 psF32 dP;424 425 bool status; 425 426 … … 427 428 psF32 *dPAR = model->dparams->data.F32; 428 429 429 dP = 0;430 dP += PS_SQR(dPAR[PM_PAR_SXX] / PAR[PM_PAR_SXX]);431 dP += PS_SQR(dPAR[PM_PAR_SYY] / PAR[PM_PAR_SYY]);432 dP = sqrt (dP);433 434 430 status = true; 435 // status &= (dP < 0.5);436 431 status &= (PAR[PM_PAR_I0] > 0); 437 432 status &= ((dPAR[PM_PAR_I0]/PAR[PM_PAR_I0]) < 0.5);
Note:
See TracChangeset
for help on using the changeset viewer.
