- Timestamp:
- Feb 19, 2011, 10:33:39 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourceFitSet.c
r29004 r30705 296 296 297 297 // set the model parameters for this fit set 298 bool pmSourceFitSetValues (pmSourceFitSetData *set, const psVector *dparam, 299 const psVector *param, pmSource *source, 300 psMinimization *myMin, int nPix, bool fitStatus) 298 bool pmSourceFitSetValues (pmSourceFitSetData *set, 299 const psVector *dparam, const psVector *param, const psImage *covar, 300 pmSource *source, psMinimization *myMin, int nPix, 301 bool fitStatus, bool saveCovariance) 301 302 { 302 303 PS_ASSERT_PTR_NON_NULL(set, false); … … 311 312 312 313 int n = 0; 314 int nStart = 0; 313 315 for (int i = 0; i < set->paramSet->n; i++) { 314 316 … … 320 322 psTrace ("psModules.objects", 4, "%f +/- %f", param->data.F32[n], dparam->data.F32[n]); 321 323 } 324 if (saveCovariance) { 325 // we only save the covar matrix for this object with itself (ignore cross terms between objects) 326 model->covar = psImageAlloc(model->params->n, model->params->n, PS_TYPE_F32); 327 for (int ix = 0; ix < model->params->n; ix++) { 328 for (int iy = 0; iy < model->params->n; iy++) { 329 model->covar->data.F32[iy][ix] = covar->data.F32[nStart+iy][nStart+ix]; 330 } 331 } 332 } 333 nStart += model->params->n; 322 334 psTrace ("psModules.objects", 4, " src %d", i); 323 335 … … 550 562 } 551 563 552 // parameter errors from the covariance matrix564 // parameter errors from the covariance matrix 553 565 psVector *dparams = psVectorAlloc (thisSet->nParamSet, PS_TYPE_F32); 554 566 for (int i = 0; i < dparams->n; i++) { … … 558 570 } 559 571 560 // get the Gauss-Newton distance for fixed model parameters572 // get the Gauss-Newton distance for fixed model parameters 561 573 if (constraint->paramMask != NULL) { 562 574 psVector *delta = psVectorAlloc (params->n, PS_TYPE_F32); … … 580 592 } 581 593 582 pmSourceFitSetValues (thisSet, dparams, params, source, myMin, y->n, fitStatus);594 pmSourceFitSetValues (thisSet, dparams, params, covar, source, myMin, y->n, fitStatus, options->saveCovariance); 583 595 psTrace ("psModules.objects", 5, "onPic: %d, fitStatus: %d, nIter: %d, chisq: %f, nPix: %ld\n", onPic, fitStatus, myMin->iter, myMin->value, y->n); 584 596
Note:
See TracChangeset
for help on using the changeset viewer.
