Changeset 25754 for trunk/psModules/src/objects/models
- Timestamp:
- Oct 2, 2009, 3:11:32 PM (17 years ago)
- Location:
- trunk/psModules/src/objects/models
- Files:
-
- 4 deleted
- 6 edited
-
pmModel_GAUSS.c (modified) (7 diffs)
-
pmModel_PGAUSS.c (modified) (7 diffs)
-
pmModel_PS1_V1.c (modified) (8 diffs)
-
pmModel_QGAUSS.c (modified) (7 diffs)
-
pmModel_RGAUSS.c (modified) (8 diffs)
-
pmModel_SERSIC.c (modified) (7 diffs)
-
pmModel_SGAUSS.c (deleted)
-
pmModel_TGAUSS.c (deleted)
-
pmModel_WAUSS.c (deleted)
-
pmModel_ZGAUSS.c (deleted)
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 -
trunk/psModules/src/objects/models/pmModel_PGAUSS.c
r25738 r25754 1 1 /****************************************************************************** 2 2 * this file defines the PGAUSS 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, … … 165 167 166 168 // make an initial guess for parameters 169 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 167 170 bool PM_MODEL_GUESS (pmModel *model, pmSource *source) 168 171 { … … 179 182 psEllipseShape shape = psEllipseAxesToShape (axes); 180 183 181 PAR[PM_PAR_SKY] = moments->Sky;184 PAR[PM_PAR_SKY] = 0.0; 182 185 PAR[PM_PAR_I0] = peak->flux; 183 186 PAR[PM_PAR_XPOS] = peak->xf; … … 258 261 // choose a z value guaranteed to be beyond our limit 259 262 float z0 = pow((1.0 / limit), (1.0 / 3.0)); 263 psAssert (isfinite(z0), "fix this code: z0 should not be nan for %f", PAR[PM_PAR_I0]); 260 264 float z1 = (1.0 / limit); 265 psAssert (isfinite(z1), "fix this code: z1 should not be nan for %f", PAR[PM_PAR_I0]); 261 266 z1 = PS_MAX (z0, z1); 262 267 z0 = 0.0; … … 389 394 bool PM_MODEL_FIT_STATUS (pmModel *model) 390 395 { 391 psF32 dP;392 396 bool status; 393 397 … … 395 399 psF32 *dPAR = model->dparams->data.F32; 396 400 397 dP = 0;398 dP += PS_SQR(dPAR[PM_PAR_SXX] / PAR[PM_PAR_SXX]);399 dP += PS_SQR(dPAR[PM_PAR_SYY] / PAR[PM_PAR_SYY]);400 dP = sqrt (dP);401 402 401 status = true; 403 status &= (dP < 0.5);404 402 status &= (PAR[PM_PAR_I0] > 0); 405 403 status &= ((dPAR[PM_PAR_I0]/PAR[PM_PAR_I0]) < 0.5); -
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); -
trunk/psModules/src/objects/models/pmModel_QGAUSS.c
r25738 r25754 1 1 /****************************************************************************** 2 2 * this file defines the QGAUSS source shape model (XXX need a better name!). Note that these 3 * model functions are loaded by pmModel Group.c using 'include', and thus need no 'include'3 * model functions are loaded by pmModelClass.c using 'include', and thus need no 'include' 4 4 * statements of their own. The models use a psVector to represent the set of parameters, with 5 5 * the sequence used to specify the meaning of the parameter. The meaning of the parameters … … 38 38 # define PM_MODEL_FIT_STATUS pmModelFitStatus_QGAUSS 39 39 # define PM_MODEL_SET_LIMITS pmModelSetLimits_QGAUSS 40 41 // the model is a function of the pixel coordinate (pixcoord[0,1] = x,y) 42 // 0.5 PIX: the parameters are defined in terms of pixel coords, so the incoming pixcoords 43 // values need to be pixel coords 40 44 41 45 // Lax parameter limits … … 178 182 179 183 // make an initial guess for parameters 184 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 180 185 bool PM_MODEL_GUESS (pmModel *model, pmSource *source) 181 186 { … … 202 207 if (!isfinite(shape.sxy)) return false; 203 208 204 // XXX turn this off here for now PAR[PM_PAR_SKY] = moments->Sky;205 209 PAR[PM_PAR_SKY] = 0.0; 206 210 PAR[PM_PAR_I0] = peak->flux; … … 283 287 // choose a z value guaranteed to be beyond our limit 284 288 float z0 = pow((1.0 / limit), (1.0 / 2.25)); 289 psAssert (isfinite(z0), "fix this code: z0 should not be nan for %f", PAR[PM_PAR_7]); 285 290 float z1 = (1.0 / limit) / PAR[PM_PAR_7]; 291 psAssert (isfinite(z1), "fix this code: z1 should not be nan for %f", PAR[PM_PAR_7]); 286 292 z1 = PS_MAX (z0, z1); 287 293 z0 = 0.0; … … 409 415 bool PM_MODEL_FIT_STATUS (pmModel *model) 410 416 { 411 412 psF32 dP;413 417 bool status; 414 418 … … 416 420 psF32 *dPAR = model->dparams->data.F32; 417 421 418 dP = 0;419 dP += PS_SQR(dPAR[PM_PAR_SXX] / PAR[PM_PAR_SXX]);420 dP += PS_SQR(dPAR[PM_PAR_SYY] / PAR[PM_PAR_SYY]);421 dP = sqrt (dP);422 423 422 status = true; 424 // status &= (dP < 0.5);425 423 status &= (PAR[PM_PAR_I0] > 0); 426 424 status &= ((dPAR[PM_PAR_I0]/PAR[PM_PAR_I0]) < 0.5); -
trunk/psModules/src/objects/models/pmModel_RGAUSS.c
r25738 r25754 1 1 /****************************************************************************** 2 2 * this file defines the RGAUSS source shape model (XXX need a better name!). Note that these 3 * model functions are loaded by pmModel Group.c using 'include', and thus need no 'include'3 * model functions are loaded by pmModelClass.c using 'include', and thus need no 'include' 4 4 * statements of their own. The models use a psVector to represent the set of parameters, with 5 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 PSF6 * may thus vary depending on the specifics of the model. All models which are used as a PSF 7 7 * representations share a few parameters, for which # define names are listed in pmModel.h: 8 8 … … 39 39 # define PM_MODEL_SET_LIMITS pmModelSetLimits_RGAUSS 40 40 41 // the model is a function of the pixel coordinate (pixcoord[0,1] = x,y) 42 // 0.5 PIX: the parameters are defined in terms of pixel coords, so the incoming pixcoords 43 // values need to be pixel coords 44 41 45 // Lax parameter limits 42 46 static float paramsMinLax[] = { -1.0e3, 1.0e-2, -100, -100, 0.5, 0.5, -1.0, 1.25 }; … … 87 91 dPAR[PM_PAR_SXY] = -q*X*Y; 88 92 89 // this model derivative is undefined at z = 0.0, but is actually0.093 // this model derivative is undefined at z = 0.0, but the limit is zero as z -> 0.0 90 94 dPAR[PM_PAR_7] = (z == 0.0) ? 0.0 : -5.0*t*log(z)*p*z; 91 95 } … … 172 176 173 177 // make an initial guess for parameters 178 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 174 179 bool PM_MODEL_GUESS (pmModel *model, pmSource *source) 175 180 { … … 196 201 if (!isfinite(shape.sxy)) return false; 197 202 198 PAR[PM_PAR_SKY] = moments->Sky;203 PAR[PM_PAR_SKY] = 0.0; 199 204 PAR[PM_PAR_I0] = peak->flux; 200 205 PAR[PM_PAR_XPOS] = peak->xf; … … 276 281 // choose a z value guaranteed to be beyond our limit 277 282 float z0 = pow((1.0 / limit), (1.0 / PAR[PM_PAR_7])); 283 psAssert (isfinite(z0), "fix this code: z0 should not be nan for %f", PAR[PM_PAR_7]); 278 284 float z1 = (1.0 / limit); 285 psAssert (isfinite(z1), "fix this code: z1 should not be nan for %f", PAR[PM_PAR_7]); 279 286 z1 = PS_MAX (z0, z1); 280 287 z0 = 0.0; … … 402 409 bool PM_MODEL_FIT_STATUS (pmModel *model) 403 410 { 404 405 psF32 dP;406 411 bool status; 407 412 … … 409 414 psF32 *dPAR = model->dparams->data.F32; 410 415 411 dP = 0;412 dP += PS_SQR(dPAR[PM_PAR_SXX] / PAR[PM_PAR_SXX]);413 dP += PS_SQR(dPAR[PM_PAR_SYY] / PAR[PM_PAR_SYY]);414 dP = sqrt (dP);415 416 416 status = true; 417 status &= (dP < 0.5);418 417 status &= (PAR[PM_PAR_I0] > 0); 419 418 status &= ((dPAR[PM_PAR_I0]/PAR[PM_PAR_I0]) < 0.5); -
trunk/psModules/src/objects/models/pmModel_SERSIC.c
r25738 r25754 1 1 /****************************************************************************** 2 2 * this file defines the SERSIC 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 … … 41 41 # define PM_MODEL_FIT_STATUS pmModelFitStatus_SERSIC 42 42 # define PM_MODEL_SET_LIMITS pmModelSetLimits_SERSIC 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 43 47 44 48 // Lax parameter limits … … 186 190 187 191 // make an initial guess for parameters 192 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 188 193 bool PM_MODEL_GUESS (pmModel *model, pmSource *source) 189 194 { … … 210 215 if (!isfinite(shape.sxy)) return false; 211 216 212 // XXX PAR[PM_PAR_SKY] = moments->Sky;213 217 PAR[PM_PAR_SKY] = 0.0; 214 218 PAR[PM_PAR_I0] = peak->flux; … … 284 288 285 289 psF64 z = pow (-log(limit), (1.0 / PAR[PM_PAR_7])); 290 psAssert (isfinite(z), "fix this code: z should not be nan for %f", PAR[PM_PAR_7]); 286 291 287 292 psF64 radius = sigma * sqrt (2.0 * z); 293 psAssert (isfinite(radius), "fix this code: radius should not be nan for %f, %f", PAR[PM_PAR_7], sigma); 288 294 289 295 if (isnan(radius)) … … 392 398 bool PM_MODEL_FIT_STATUS (pmModel *model) 393 399 { 394 395 psF32 dP;396 400 bool status; 397 401 … … 399 403 psF32 *dPAR = model->dparams->data.F32; 400 404 401 dP = 0;402 dP += PS_SQR(dPAR[PM_PAR_SXX] / PAR[PM_PAR_SXX]);403 dP += PS_SQR(dPAR[PM_PAR_SYY] / PAR[PM_PAR_SYY]);404 dP = sqrt (dP);405 406 405 status = true; 407 // status &= (dP < 0.5);408 406 status &= (PAR[PM_PAR_I0] > 0); 409 407 status &= ((dPAR[PM_PAR_I0]/PAR[PM_PAR_I0]) < 0.5); 410 408 409 <<<<<<< .working 411 410 fprintf (stderr, "SERSIC status pars: dP: %f, I0: %f, S/N: %f\n", 412 411 dP, PAR[PM_PAR_I0], (dPAR[PM_PAR_I0]/PAR[PM_PAR_I0])); 413 412 413 ======= 414 >>>>>>> .merge-right.r25750 414 415 return status; 415 416 }
Note:
See TracChangeset
for help on using the changeset viewer.
