Changeset 13064 for trunk/psModules/src/objects/pmPSFtry.c
- Timestamp:
- Apr 27, 2007, 12:14:08 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmPSFtry.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmPSFtry.c
r13034 r13064 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1.3 6$ $Name: not supported by cvs2svn $8 * @date $Date: 2007-04-2 6 01:20:29$7 * @version $Revision: 1.37 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-04-27 22:14:08 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 352 352 x->data.F64[i] = source->modelEXT->params->data.F32[PM_PAR_XPOS]; 353 353 y->data.F64[i] = source->modelEXT->params->data.F32[PM_PAR_YPOS]; 354 355 // weight by the error on the source flux 356 if (dz) { 357 dz->data.F64[i] = source->modelEXT->dparams->data.F32[PM_PAR_I0]; 358 } 354 359 } 355 360 … … 360 365 psStats *stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); 361 366 362 // skip the unfitted parameters (X, Y, Io, Sky) 367 // The shape parameters (SXX, SXY, SYY) are strongly coupled. We have to handle them very 368 // carefully. First, we convert them to the Ellipse Polarization terms (E0, E1, E2) for 369 // each source and fit this set of parameters. These values are less tightly coupled, but 370 // are still inter-related. The fitted values do a good job of constraining the major axis 371 // and the position angle, but the minor axis is weakly measured. When we apply the PSF 372 // model to construct a source model, we convert the fitted values of E0,E1,E2 to the shape 373 // parameters, with the constraint that the minor axis must be greater than a minimum 374 // threshold. 375 376 // convert the measured source shape paramters to polarization terms 377 psVector *e0 = psVectorAlloc (psfTry->sources->n, PS_TYPE_F64); 378 psVector *e1 = psVectorAlloc (psfTry->sources->n, PS_TYPE_F64); 379 psVector *e2 = psVectorAlloc (psfTry->sources->n, PS_TYPE_F64); 380 for (int i = 0; i < psfTry->sources->n; i++) { 381 pmSource *source = psfTry->sources->data[i]; 382 if (source->modelEXT == NULL) continue; 383 384 psEllipsePol pol = pmPSF_ModelToFit (source->modelEXT->params->data.F32); 385 386 e0->data.F64[i] = pol.e0; 387 e1->data.F64[i] = pol.e1; 388 e2->data.F64[i] = pol.e2; 389 } 390 391 // we run 'clipIter' cycles clipping in each of x and y, with only one iteration each. 392 // This way, the parameters masked by one of the fits will be applied to the others 393 for (int i = 0; i < stats->clipIter; i++) { 394 psVectorClipFitPolynomial2D (psf->params_NEW->data[PM_PAR_E0], stats, psfTry->mask, 0xff, e0, dz, x, y); 395 psVectorClipFitPolynomial2D (psf->params_NEW->data[PM_PAR_E1], stats, psfTry->mask, 0xff, e1, dz, x, y); 396 psVectorClipFitPolynomial2D (psf->params_NEW->data[PM_PAR_E2], stats, psfTry->mask, 0xff, e2, dz, x, y); 397 } 398 399 // skip the unfitted parameters (X, Y, Io, Sky) and the shape parameters (SXX, SYY, SXY) 363 400 for (int i = 0; i < psf->params_NEW->n; i++) { 364 if (i == PM_PAR_SKY) 365 continue; 366 if (i == PM_PAR_I0) 367 continue; 368 if (i == PM_PAR_XPOS) 369 continue; 370 if (i == PM_PAR_YPOS) 371 continue; 401 switch (i) { 402 case PM_PAR_SKY: 403 case PM_PAR_I0: 404 case PM_PAR_XPOS: 405 case PM_PAR_YPOS: 406 case PM_PAR_SXX: 407 case PM_PAR_SYY: 408 case PM_PAR_SXY: 409 continue; 410 default: 411 break; 412 } 372 413 373 414 // select the per-object fitted data for this parameter … … 376 417 if (source->modelEXT == NULL) 377 418 continue; 378 379 419 z->data.F64[j] = source->modelEXT->params->data.F32[i]; 380 if (applyWeight) {381 dz->data.F64[j] = source->modelEXT->dparams->data.F32[i];382 }383 384 // for SXY, we actually fit SXY / (SXX^-2 + SYY^-2)385 if (i == PM_PAR_SXY) {386 z->data.F64[j] = pmPSF_SXYfromModel (source->modelEXT->params->data.F32);387 }388 420 } 389 421 390 422 // fit the collection of measured parameters to the PSF 2D model 391 423 // the mask is carried from previous steps and updated with this operation 392 // the weight is either the parametererror or NULL, depending on 'applyWeights'424 // the weight is either the flux error or NULL, depending on 'applyWeights' 393 425 if (!psVectorClipFitPolynomial2D(psf->params_NEW->data[i], stats, psfTry->mask, 0xff, z, NULL, x, y)) { 394 426 psError(PS_ERR_UNKNOWN, false, "failed to build psf model for parameter %d", i);
Note:
See TracChangeset
for help on using the changeset viewer.
