Changeset 36633 for trunk/psphot/src/psphotGalaxyShape.c
- Timestamp:
- Apr 2, 2014, 10:50:14 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
psphot/src (modified) (1 prop)
-
psphot/src/psphotGalaxyShape.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/tags/ipp-20140114 merged: 36557,36559-36560,36584-36588,36597-36602,36607-36609
- Property svn:mergeinfo changed
-
trunk/psphot/src
- Property svn:mergeinfo changed
/tags/ipp-20140114/psphot/src merged: 36588,36599,36607
- Property svn:mergeinfo changed
-
trunk/psphot/src/psphotGalaxyShape.c
r36441 r36633 205 205 if (!(source->tmpFlags & PM_SOURCE_TMPF_MOMENTS_MEASURED)) continue; 206 206 if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) continue; 207 if (!source->modelPSF) continue; 207 208 208 209 // psphotSetRadiusMomentsExact sets the radius based on Mrf … … 274 275 275 276 int i = source->galaxyFits->chisq->n - 1; 276 float thisChisq = source->galaxyFits->chisq->data.F32[i]; 277 if (isfinite(thisChisq) && (!isfinite(chisqBest) || thisChisq < chisqBest)) { 278 chisqBest = thisChisq; 279 fRmajorBest = fRmajor; 280 fRminorBest = fRminor; 277 float flux = source->galaxyFits->Flux->data.F32[i]; 278 if (isfinite(flux)) { 279 float thisChisq = source->galaxyFits->chisq->data.F32[i]; 280 if (isfinite(thisChisq) && isfinite(flux) && (!isfinite(chisqBest) || thisChisq < chisqBest)) { 281 chisqBest = thisChisq; 282 fRmajorBest = fRmajor; 283 fRminorBest = fRminor; 284 } 281 285 } 286 // reset I0 to avoid potential problems on the next iteration 287 PAR[PM_PAR_I0] = 1.0; 282 288 } 283 289 } 284 290 291 #define SAVE_BEST_MODEL 285 292 #ifdef SAVE_BEST_MODEL 286 293 // Save model with smallest chisq … … 301 308 psphotGalaxyShapeSource (pcm, source, maskVal, psfSize, false); 302 309 303 // Replace modelEXT with this model 304 // XXX: only do this if the model is good 305 psFree (source->modelEXT); 306 307 source->modelEXT = psMemIncrRefCounter (pcm->modelConv); 308 source->type = PM_SOURCE_TYPE_EXTENDED; 309 source->mode |= PM_SOURCE_MODE_EXTMODEL; 310 source->mode |= PM_SOURCE_MODE_NONLINEAR_FIT; 311 312 // cache the model flux 313 pmPCMCacheModel (source, maskVal, psfSize, fitOptions->nsigma); 310 // Replace modelEXT with this model, if the model is good 311 if (isfinite(PAR[PM_PAR_I0])) { 312 psFree (source->modelEXT); 313 314 source->modelEXT = psMemIncrRefCounter (pcm->modelConv); 315 source->type = PM_SOURCE_TYPE_EXTENDED; 316 source->mode |= PM_SOURCE_MODE_EXTMODEL; 317 source->mode |= PM_SOURCE_MODE_NONLINEAR_FIT; 318 319 // cache the model flux 320 pmPCMCacheModel (source, maskVal, psfSize, fitOptions->nsigma); 321 } 314 322 } 315 323
Note:
See TracChangeset
for help on using the changeset viewer.
