Changeset 28656
- Timestamp:
- Jul 11, 2010, 3:19:38 PM (16 years ago)
- Location:
- branches/eam_branches/ipp-20100621/psModules/src
- Files:
-
- 8 edited
-
detrend/pmShutterCorrection.c (modified) (1 diff)
-
imcombine/pmPSFEnvelope.c (modified) (1 diff)
-
objects/models/pmModel_SERSIC.c (modified) (1 diff)
-
objects/pmModel.c (modified) (1 diff)
-
objects/pmModelFuncs.h (modified) (1 diff)
-
objects/pmSourceFitModel.c (modified) (9 diffs)
-
objects/pmSourceFitModel.h (modified) (2 diffs)
-
objects/pmSourceFitSet.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100621/psModules/src/detrend/pmShutterCorrection.c
r28405 r28656 302 302 PS_ASSERT_PTR_NON_NULL(guess, NULL); 303 303 304 psMinimization *minInfo = psMinimizationAlloc(15, 0.1 ); // Minimization information304 psMinimization *minInfo = psMinimizationAlloc(15, 0.1, 1.0); // Minimization information 305 305 306 306 psVector *params = psVectorAlloc (3, PS_TYPE_F32); // Fitting parameters -
branches/eam_branches/ipp-20100621/psModules/src/imcombine/pmPSFEnvelope.c
r28643 r28656 416 416 options->fitOptions = pmSourceFitOptionsAlloc(); 417 417 options->fitOptions->nIter = SOURCE_FIT_ITERATIONS; 418 options->fitOptions->tol = 0.01; 418 options->fitOptions->minTol = 0.01; 419 options->fitOptions->maxTol = 1.00; 419 420 options->fitOptions->poissonErrors = true; 420 421 options->fitOptions->weight = VARIANCE_VAL; -
branches/eam_branches/ipp-20100621/psModules/src/objects/models/pmModel_SERSIC.c
r28643 r28656 243 243 244 244 // the other parameters depend on the guess for PAR_7 245 if (0) { 246 } else { 245 if (!isfinite(PAR[PM_PAR_7])) { 247 246 PAR[PM_PAR_7] = 0.25; 248 247 // PAR[PM_PAR_7] = 0.125; -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmModel.c
r28643 r28656 81 81 82 82 for (psS32 i = 0; i < tmp->params->n; i++) { 83 tmp->params->data.F32[i] = 0.0;84 tmp->dparams->data.F32[i] = 0.0;83 tmp->params->data.F32[i] = NAN; 84 tmp->dparams->data.F32[i] = NAN; 85 85 } 86 86 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmModelFuncs.h
r28643 r28656 41 41 PM_MODEL_STATUS_OFFIMAGE = 0x04, ///< model fit drove out of range 42 42 PM_MODEL_STATUS_BADARGS = 0x08, ///< model fit called with invalid args 43 PM_MODEL_STATUS_LIMITS = 0x10 ///< model parameters hit limits 43 PM_MODEL_STATUS_LIMITS = 0x10, ///< model parameters hit limits 44 PM_MODEL_STATUS_WEAK_FIT = 0x20, ///< model fit met loose tolerance, but not tight tolerance 44 45 } pmModelStatus; 45 46 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceFitModel.c
r28643 r28656 44 44 void pmSourceFitOptionsFree(pmSourceFitOptions *opt) 45 45 { 46 return;46 return; 47 47 } 48 48 … … 53 53 54 54 opt->mode = PM_SOURCE_FIT_PSF; 55 opt->nIter = 15; 56 opt->tol = 0.1; 57 opt->weight = 1.0; 55 opt->nIter = 15; 56 opt->minTol = 0.01; 57 opt->maxTol = 1.00; 58 opt->weight = 1.00; 59 opt->maxChisqDOF = NAN; 58 60 opt->poissonErrors = true; 59 61 … … 103 105 // skip nan values in image 104 106 if (!isfinite(source->variance->data.F32[i][j])) { 105 fprintf (stderr, "impossible! %x vs %x\n", source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[i][j], maskVal);106 continue;107 fprintf (stderr, "impossible! %x vs %x\n", source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[i][j], maskVal); 108 continue; 107 109 } 108 110 … … 142 144 int nParams = 0; 143 145 switch (options->mode) { 144 case PM_SOURCE_FIT_NORM:146 case PM_SOURCE_FIT_NORM: 145 147 // NORM-only model fits only source normalization (Io) 146 148 nParams = 1; … … 148 150 constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[PM_PAR_I0] = 0; 149 151 break; 150 case PM_SOURCE_FIT_PSF:152 case PM_SOURCE_FIT_PSF: 151 153 // PSF model only fits x,y,Io 152 154 nParams = 3; … … 156 158 constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[PM_PAR_YPOS] = 0; 157 159 break; 158 case PM_SOURCE_FIT_EXT:160 case PM_SOURCE_FIT_EXT: 159 161 // EXT model fits all params (except sky) 160 162 nParams = params->n - 1; … … 162 164 constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[PM_PAR_SKY] = 1; 163 165 break; 164 default: 165 psAbort("invalid fitting mode"); 166 case PM_SOURCE_FIT_INDEX: 167 // PSF model only fits Io, index (PAR7) -- only Io for models with < 8 params 168 psVectorInit (constraint->paramMask, 1); 169 constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[PM_PAR_I0] = 0; 170 if (params->n == 7) { 171 nParams = 1; 172 } else { 173 nParams = 2; 174 constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[PM_PAR_7] = 0; 175 } 176 break; 177 case PM_SOURCE_FIT_NO_INDEX: 178 // PSF model only fits Io, index (PAR7) -- only Io for models with < 8 params 179 psVectorInit (constraint->paramMask, 0); 180 constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[PM_PAR_SKY] = 1; 181 if (params->n == 7) { 182 nParams = params->n - 1; 183 } else { 184 nParams = params->n - 2; 185 constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[PM_PAR_7] = 1; 186 } 187 break; 188 default: 189 psAbort("invalid fitting mode"); 166 190 } 167 191 // force the floating parameters to fall within the contraint ranges 168 192 for (int i = 0; i < params->n; i++) { 169 model->modelLimits (PS_MINIMIZE_PARAM_MIN, i, params->data.F32, NULL);170 model->modelLimits (PS_MINIMIZE_PARAM_MAX, i, params->data.F32, NULL);193 model->modelLimits (PS_MINIMIZE_PARAM_MIN, i, params->data.F32, NULL); 194 model->modelLimits (PS_MINIMIZE_PARAM_MAX, i, params->data.F32, NULL); 171 195 } 172 196 … … 181 205 } 182 206 183 psMinimization *myMin = psMinimizationAlloc (options->nIter, options-> tol);207 psMinimization *myMin = psMinimizationAlloc (options->nIter, options->minTol, options->maxTol); 184 208 185 209 psImage *covar = psImageAlloc (params->n, params->n, PS_TYPE_F32); … … 202 226 model->flags |= PM_MODEL_STATUS_FITTED; 203 227 if (!fitStatus) model->flags |= PM_MODEL_STATUS_NONCONVERGE; 228 if (myMin->lastDelta > myMin->minTol) model->flags |= PM_MODEL_STATUS_WEAK_FIT; 204 229 205 230 // get the Gauss-Newton distance for fixed model parameters -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceFitModel.h
r28643 r28656 19 19 PM_SOURCE_FIT_EXT, 20 20 PM_SOURCE_FIT_PSF_AND_SKY, 21 PM_SOURCE_FIT_EXT_AND_SKY 21 PM_SOURCE_FIT_EXT_AND_SKY, 22 PM_SOURCE_FIT_INDEX, 23 PM_SOURCE_FIT_NO_INDEX, 22 24 } pmSourceFitMode; 23 25 … … 25 27 pmSourceFitMode mode; ///< optionally fit all or a subset of parameters 26 28 float nIter; ///< max number of allowed iterations 27 float tol; ///< convergence criterion 29 float minTol; ///< convergence criterion 30 float maxTol; ///< convergence criterion 31 float maxChisqDOF; ///< convergence criterion 28 32 float weight; ///< use this weight for constant-weight fits 29 33 bool poissonErrors; ///< use poisson errors for fits? -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceFitSet.c
r28643 r28656 541 541 } 542 542 543 psMinimization *myMin = psMinimizationAlloc (options->nIter, options-> tol);543 psMinimization *myMin = psMinimizationAlloc (options->nIter, options->minTol, options->maxTol); 544 544 545 545 psImage *covar = psImageAlloc (params->n, params->n, PS_TYPE_F32);
Note:
See TracChangeset
for help on using the changeset viewer.
