Changeset 30705
- Timestamp:
- Feb 19, 2011, 10:33:39 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213/psModules/src/objects
- Files:
-
- 9 edited
-
pmModel.c (modified) (2 diffs)
-
pmModel.h (modified) (1 diff)
-
pmSourceExtendedPars.c (modified) (2 diffs)
-
pmSourceExtendedPars.h (modified) (2 diffs)
-
pmSourceFitModel.c (modified) (2 diffs)
-
pmSourceFitModel.h (modified) (1 diff)
-
pmSourceFitPCM.c (modified) (1 diff)
-
pmSourceFitSet.c (modified) (6 diffs)
-
pmSourceFitSet.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/psModules/src/objects/pmModel.c
r30621 r30705 41 41 psFree(tmp->params); 42 42 psFree(tmp->dparams); 43 psFree(tmp->covar); 43 44 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 44 45 } … … 71 72 tmp->flags = PM_MODEL_STATUS_NONE; 72 73 tmp->residuals = NULL; // do not free: the model does not own this memory 74 tmp->covar = NULL; 73 75 tmp->isPCM = false; 74 76 -
branches/eam_branches/ipp-20110213/psModules/src/objects/pmModel.h
r30621 r30705 33 33 psVector *params; ///< Paramater values. 34 34 psVector *dparams; ///< Parameter errors. 35 psImage *covar; ///< Optional covariance matrix 35 36 float chisq; ///< Fit chi-squared. 36 37 float chisqNorm; ///< re-normalized fit chi-squared. -
branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourceExtendedPars.c
r30621 r30705 55 55 psFree(radial->flux); 56 56 psFree(radial->fluxErr); 57 psFree(radial->fluxStdev); 57 58 psFree(radial->fill); 58 59 } … … 65 66 radial->flux = NULL; 66 67 radial->fluxErr = NULL; 68 radial->fluxStdev = NULL; 67 69 radial->fill = NULL; 68 70 return radial; -
branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourceExtendedPars.h
r28013 r30705 23 23 typedef struct { 24 24 psVector *flux; // fluxes measured at above radii 25 psVector *fluxStdev; // scatter (standard deviation) of flux 25 26 psVector *fluxErr; // formal error on the fluxes (sqrt\sum(variance)) 26 27 psVector *fill; // angles corresponding to above radial profiles … … 63 64 float petrosianR50; 64 65 float petrosianR50Err; 66 float petrosianFill; 65 67 } pmSourceExtendedPars; 66 68 -
branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourceFitModel.c
r29004 r30705 59 59 opt->maxChisqDOF = NAN; 60 60 opt->poissonErrors = true; 61 opt->saveCovariance = false; 61 62 62 63 return opt; … … 231 232 psTrace ("psModules.objects", 4, "%f +/- %f", params->data.F32[i], dparams->data.F32[i]); 232 233 } 234 if (options->saveCovariance) { 235 model->covar = psMemIncrRefCounter(covar); 236 } 233 237 psTrace ("psModules.objects", 4, "niter: %d, chisq: %f", myMin->iter, myMin->value); 234 238 -
branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourceFitModel.h
r29004 r30705 32 32 float weight; ///< use this weight for constant-weight fits 33 33 bool poissonErrors; ///< use poisson errors for fits? 34 bool saveCovariance; 34 35 } pmSourceFitOptions; 35 36 -
branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourceFitPCM.c
r30621 r30705 69 69 dparams->data.F32[i] = sqrt(covar->data.F32[i][i]); 70 70 psTrace ("psModules.objects", 4, "%f +/- %f", params->data.F32[i], dparams->data.F32[i]); 71 } 72 if (fitOptions->saveCovariance) { 73 pcm->modelConv->covar = psMemIncrRefCounter(covar); 71 74 } 72 75 psTrace ("psphot", 4, "niter: %d, chisq: %f", myMin->iter, myMin->value); -
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 -
branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourceFitSet.h
r29004 r30705 40 40 bool pmSourceFitSetJoin (psVector *deriv, psVector *param, pmSourceFitSetData *set); 41 41 bool pmSourceFitSetSplit (pmSourceFitSetData *set, const psVector *deriv, const psVector *param); 42 bool pmSourceFitSetValues (pmSourceFitSetData *set, const psVector *dparam, const psVector *param, pmSource *source, psMinimization *myMin, int nPix, bool fitStatus); 42 43 bool pmSourceFitSetValues (pmSourceFitSetData *set, 44 const psVector *dparam, const psVector *param, const psImage *covar, 45 pmSource *source, psMinimization *myMin, int nPix, 46 bool fitStatus, bool saveCovariance); 43 47 44 48 psF32 pmSourceFitSetFunction(psVector *deriv, const psVector *param, const psVector *x); … … 57 61 psArray *modelSet, ///< model to be fitted 58 62 pmSourceFitOptions *options, ///< define options for fitting process 59 psImageMaskType maskVal ///< Val e to mask63 psImageMaskType maskVal ///< Value to mask 60 64 61 65 );
Note:
See TracChangeset
for help on using the changeset viewer.
