- Timestamp:
- Aug 22, 2007, 2:55:49 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20070817/psModules/src/objects/models/pmModel_RGAUSS.c
r14323 r14612 20 20 *****************************************************************************/ 21 21 22 # define PM_MODEL_FUNC pmModelFunc_RGAUSS 23 # define PM_MODEL_FLUX pmModelFlux_RGAUSS 24 # define PM_MODEL_GUESS pmModelGuess_RGAUSS 25 # define PM_MODEL_LIMITS pmModelLimits_RGAUSS 26 # define PM_MODEL_RADIUS pmModelRadius_RGAUSS 27 # define PM_MODEL_FROM_PSF pmModelFromPSF_RGAUSS 28 # define PM_MODEL_FIT_STATUS pmModelFitStatus_RGAUSS 22 # define PM_MODEL_FUNC pmModelFunc_RGAUSS 23 # define PM_MODEL_FLUX pmModelFlux_RGAUSS 24 # define PM_MODEL_GUESS pmModelGuess_RGAUSS 25 # define PM_MODEL_LIMITS pmModelLimits_RGAUSS 26 # define PM_MODEL_RADIUS pmModelRadius_RGAUSS 27 # define PM_MODEL_FROM_PSF pmModelFromPSF_RGAUSS 28 # define PM_MODEL_PARAMS_FROM_PSF pmModelParamsFromPSF_RGAUSS 29 # define PM_MODEL_FIT_STATUS pmModelFitStatus_RGAUSS 29 30 30 31 psF32 PM_MODEL_FUNC (psVector *deriv, … … 343 344 344 345 // we require these two parameters to exist 345 assert (psf->params _NEW->n > PM_PAR_YPOS);346 assert (psf->params _NEW->n > PM_PAR_XPOS);347 348 for (int i = 0; i < psf->params _NEW->n; i++) {349 if (psf->params _NEW->data[i] == NULL) {346 assert (psf->params->n > PM_PAR_YPOS); 347 assert (psf->params->n > PM_PAR_XPOS); 348 349 for (int i = 0; i < psf->params->n; i++) { 350 if (psf->params->data[i] == NULL) { 350 351 out[i] = in[i]; 351 352 } else { 352 psPolynomial2D *poly = psf->params _NEW->data[i];353 psPolynomial2D *poly = psf->params->data[i]; 353 354 out[i] = psPolynomial2DEval(poly, in[PM_PAR_XPOS], in[PM_PAR_YPOS]); 354 355 } … … 365 366 // apply the model limits here: this truncates excessive extrapolation 366 367 // XXX do we need to do this still? should we put in asserts to test? 367 for (int i = 0; i < psf->params _NEW->n; i++) {368 for (int i = 0; i < psf->params->n; i++) { 368 369 // apply the limits to all components or just the psf-model parameters? 369 if (psf->params _NEW->data[i] == NULL)370 if (psf->params->data[i] == NULL) 370 371 continue; 371 372 … … 383 384 } 384 385 386 // construct the PSF model from the FLT model and the psf 387 // XXX is this sufficiently general do be a global function, not a pmModelClass function? 388 bool PM_MODEL_PARAMS_FROM_PSF (pmModel *model, pmPSF *psf, float Xo, float Yo, float Io) 389 { 390 psF32 *PAR = model->params->data.F32; 391 392 // we require these two parameters to exist 393 assert (psf->params->n > PM_PAR_YPOS); 394 assert (psf->params->n > PM_PAR_XPOS); 395 396 PAR[PM_PAR_SKY] = 0.0; 397 PAR[PM_PAR_I0] = Io; 398 PAR[PM_PAR_XPOS] = Xo; 399 PAR[PM_PAR_YPOS] = Yo; 400 401 // supply the model-fitted parameters, or copy from the input 402 for (int i = 0; i < psf->params->n; i++) { 403 if (i == PM_PAR_SKY) continue; 404 if (i == PM_PAR_I0) continue; 405 if (i == PM_PAR_XPOS) continue; 406 if (i == PM_PAR_YPOS) continue; 407 psPolynomial2D *poly = psf->params->data[i]; 408 assert (poly); 409 PAR[i] = psPolynomial2DEval(poly, Xo, Yo); 410 } 411 412 // the 2D PSF model fits polarization terms (E0,E1,E2) 413 // convert to shape terms (SXX,SYY,SXY) 414 // XXX user-defined value for limit? 415 if (!pmPSF_FitToModel (PAR, 0.1)) { 416 psError(PM_ERR_PSF, false, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo); 417 return false; 418 } 419 420 // apply the model limits here: this truncates excessive extrapolation 421 // XXX do we need to do this still? should we put in asserts to test? 422 for (int i = 0; i < psf->params->n; i++) { 423 // apply the limits to all components or just the psf-model parameters? 424 if (psf->params->data[i] == NULL) 425 continue; 426 427 bool status = true; 428 status &= PM_MODEL_LIMITS (PS_MINIMIZE_PARAM_MIN, i, PAR, NULL); 429 status &= PM_MODEL_LIMITS (PS_MINIMIZE_PARAM_MAX, i, PAR, NULL); 430 if (!status) { 431 psTrace ("psModules.objects", 5, "Hitting parameter limits at (r,c) = (%.1f, %.1f)", Xo, Yo); 432 model->flags |= PM_MODEL_STATUS_LIMITS; 433 } 434 } 435 return(true); 436 } 437 385 438 bool PM_MODEL_FIT_STATUS (pmModel *model) 386 439 { … … 411 464 # undef PM_MODEL_RADIUS 412 465 # undef PM_MODEL_FROM_PSF 466 # undef PM_MODEL_PARAMS_FROM_PSF 413 467 # undef PM_MODEL_FIT_STATUS
Note:
See TracChangeset
for help on using the changeset viewer.
